Re: Peeking into the event queue?

Ian Britten <> writes: 
> Ya, when I first saw it, I thought it would fix my problem too.  However,
> it only returns the first event in the queue, and there doesn't appear to
> be any way to look at any remaining events in the queue (Which is what led
> me into the source code in the first place to find the event queue, and
> see what other functionality accessed it)
> Thanks for all the suggestions so far though!  Keep em coming!

Well, you could gdk_event_get() a bunch of events then gdk_event_put()
them all back. But it's a horrible hack and I suspect your application
will end up being subtly broken...

An easier solution might be to pop up a modal dialog with a Cancel
button, and then the user can't touch anything but the Cancel
button... just throwing out ideas, I don't know what all your
constraints are. You can even call gtk_grab_add() on widgets other
than dialogs if you want to be weird, you could have a modal button
inside your app that's bound to Escape... or you could have an
offscreen GtkInvisible that's modal, and you connnect to
key_press_event on that and listen for Escape, setting some flag if
Escape is pressed. 

In general fooling with the GDK event queue is low-level and bypasses
the GTK-level mechanisms, it just isn't a good approach if you can
help it.


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