Re: [gtkmm] emiting key release signals



On Friday 15 August 2003 10:12 pm, Peter Gasper wrote:
> No ideas?
>
> On Wed, 2003-08-13 at 16:06, Peter Gasper wrote:
> > How can I emit a key_release signal?
> >
> > I tried using gtk_main_do_event() as instructed in the docs for
> > Gtk::Wiget::event() but that didn't work. I don't know if I was doing it
> > right, but I also don't know if that is the correct way in the first
> > place. If this is the correct method, let me know and I'll post the code
> > that doesn't work.
> >
> >
> > background: I have some custom hardware with keys on them (including a
> > number pad) and I'm trying to figure out how to programmically emit key
> > press/release signals.
> >
> > thanks.

The Gtk+ reference material on gtk_main_do_event() is somewhat delphic (it 
advises that the function should not generally be used).

Having said that, the usual standard reply to those who want to synthesize 
events directly is, I am afraid, why are you trying to do this?  If it is to 
cause the hardware to think that a key has been released, Gtk+ won't do this 
for you (as far as I am aware), nor I suspect will any other other X based 
GUI toolkit.  If on the other hand you want the program to behave as if a key 
had been released, why not call the code which would otherwise be executed by 
Gtk::Widget::on_key_release_event(), either directly or by connecting a 
custom signal to the event handler?

I personally have never come across any circumstances in which I have had to 
try to spoof the main event loop into thinking that an event has occurred, 
and the absence of a response to your question probably indicates that others 
haven't either.  I do not say there are no circumstances in which that may 
not be a sensible coding solution to a particular problem, but your short 
explanation does not indicate why you need to do it.

If you want to follow up the use of gtk_main_do_event() further, probably it 
would be best to do so on the Gtk+ mailing list.

Chris.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]