Re: Mysterious extra button_release event?



Daniel Erat <dan_erat pobox com> writes: 
> > The pointer is automatically grabbed when a button is pressed, you don't
> > actually have to do it yourself, for exactly this reason.
> 
> Even when the button_press event occurs on a GtkNotebook tab?  When I
> comment out the pointer grab, the notebook doesn't receive a button_release
> event after I press on it, drag off, and then release.  Is there something
> else I need to be doing?

I forgot an important detail, the catch is that in GTK 1.2, the "auto
grab" on button press is like grabbing with owner_events set to TRUE,
meaning that events don't go to the grab window, instead they go to
whichever window the mouse pointer is inside. So your
gdk_pointer_grab() does have some effect, it sets owner_events to
FALSE. The usual workaround for this is to gtk_grab_add() in addition
to gdk_pointer_grab(), gtk_grab_add() will forward events to your
widget, even if they occurred on another widget; and it will apply to
already-received-but-not-yet-processed events.

In GTK 2.0 the "auto grab" has owner_events of FALSE, so you don't
have to do the gtk_grab_add(), and usually not even the
gdk_pointer_grab().

Havoc






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