After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 126871 - Grab not disabled by early button release
Grab not disabled by early button release
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2003-11-13 06:01 UTC by Keith Packard
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
attempted fix (10.65 KB, patch)
2003-11-24 18:09 UTC, Havoc Pennington
none Details | Review

Description Keith Packard 2003-11-13 06:01:32 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 &&
Comment 1 Havoc Pennington 2003-11-13 13:24:28 UTC
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.
Comment 2 Keith Packard 2003-11-13 18:38:20 UTC
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...
Comment 3 Havoc Pennington 2003-11-13 23:43:06 UTC
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.
Comment 4 Havoc Pennington 2003-11-24 18:09:35 UTC
Created attachment 21770 [details] [review]
attempted fix
Comment 5 Havoc Pennington 2003-11-24 18:10:02 UTC
See if it's fixed now...