GNOME Bugzilla – Bug 126871
Grab not disabled by early button release
Last modified: 2004-12-22 21:47:04 UTC
A button release with serial number less than that of the first request executed after the grab was started will not disable the grab. This causes the grab to remain active until the button is pressed and released again. Here's my kludge to release the grab: Index: display.c =================================================================== RCS file: /cvs/gnome/metacity/src/display.c,v retrieving revision 1.198 diff -u -r1.198 display.c --- display.c 13 Oct 2003 20:15:40 -0000 1.198 +++ display.c 13 Nov 2003 05:41:44 -0000 @@ -1462,6 +1462,9 @@ event->xany.serial > display->grab_start_serial && grab_op_is_mouse (display->grab_op)) meta_window_handle_mouse_grab_op_event (window, event); + else if (display->grab_window == window && + grab_op_is_mouse (display->grab_op)) + meta_display_end_grab_op (window->display, event->xbutton.time); break; case MotionNotify: if (display->grab_window == window &&
It seems like the real bug is that the grab_start_serial concept is broken somehow. My speculation on the other bug about this (which may be on bugzilla.redhat.com) was that it works when we call XGrabPointer() (the XNextRequest() then is supposed to be the serial of the grab request itself) but is busted if you are getting the automatic grab from the ButtonPress. I don't remember exactly what problem I was trying to solve with grab_start_serial though.
Yes, I'm sure the grab_start_serial concept is bogus, although discarding events when you've called XGrabPointer is probably legit. Perhaps the grab_start_serial should be set to the event serial for passive grabs? That would effectively disable it in that case. Oh, I note also that there is no minimum movement required for repositioning windows when I click on them, so I'm now taking advantage of this change by clicking quickly so that my windows don't shuffle around the screen by a pixel or two when I raise them. I did notice that the grab code seemed really twisty...
Yeah, setting grab_start_serial to the event serial seems right, if the grab is known to already be in effect due to said event.
Created attachment 21770 [details] [review] attempted fix
See if it's fixed now...