From ebfbef86a0f0d985197b7b2715d82025459456ca Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Mon, 9 Apr 2007 05:49:57 +0000 Subject: [PATCH] Remove grab_start_serial, which we expect to be an ancient attempt to 2007-04-08 Elijah Newren Remove grab_start_serial, which we expect to be an ancient attempt to workaround sloppy/mouse focus bugs that have since been correctly fixed. May fix some race conditions. May cause nasty bugs in sloppy/mouse focus modes. We'll find out soon enough... See #304430. * src/display.c (event_callback): remove event->xany.serial >= display->grab_start_serial in several event callback handlers * src/display.[ch] (struct _MetaDisplay, meta_display_begin_grab_op): * src/keybindings.c (do_choose_window, handle_workspace_switch): * src/frames.c (meta_frames_button_press_event): * src/core.[ch] (meta_core_begin_grab_op): * src/window.c (meta_window_client_message, meta_window_begin_grab_op): don't require an event_serial to be passed to meta_display_begin_grab_op () and don't record it anymore. * src/ui.c (struct _EventFunc, filter_func, meta_ui_get_last_event_serial) * src/core.h (meta_ui_get_last_event_serial): remove meta_ui_get_last_event_serial() function (don't ask me why it was declared in core.h) and the last_even_serial field of _EventFunc svn path=/trunk/; revision=3182 --- ChangeLog | 27 +++++++++++++++++++++++++++ src/core.c | 2 -- src/core.h | 3 --- src/display.c | 15 --------------- src/display.h | 2 -- src/frames.c | 3 --- src/keybindings.c | 2 -- src/ui.c | 21 +-------------------- src/window.c | 10 ---------- 9 files changed, 28 insertions(+), 57 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71f2fbf2f..6af8f1ba3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2007-04-08 Elijah Newren + + Remove grab_start_serial, which we expect to be an ancient attempt + to workaround sloppy/mouse focus bugs that have since been + correctly fixed. May fix some race conditions. May cause nasty + bugs in sloppy/mouse focus modes. We'll find out soon enough... + See #304430. + + * src/display.c (event_callback): + remove event->xany.serial >= display->grab_start_serial in several + event callback handlers + + * src/display.[ch] (struct _MetaDisplay, meta_display_begin_grab_op): + * src/keybindings.c (do_choose_window, handle_workspace_switch): + * src/frames.c (meta_frames_button_press_event): + * src/core.[ch] (meta_core_begin_grab_op): + * src/window.c (meta_window_client_message, meta_window_begin_grab_op): + don't require an event_serial to be passed to + meta_display_begin_grab_op () and don't record it anymore. + + * src/ui.c (struct _EventFunc, filter_func, + meta_ui_get_last_event_serial) + * src/core.h (meta_ui_get_last_event_serial): + remove meta_ui_get_last_event_serial() function (don't ask me why + it was declared in core.h) and the last_even_serial field of + _EventFunc + 2007-04-08 Elijah Newren Fix move/resize events in relation to combinations of diff --git a/src/core.c b/src/core.c index 5480dc4d7..fe918bfe5 100644 --- a/src/core.c +++ b/src/core.c @@ -630,7 +630,6 @@ meta_core_begin_grab_op (Display *xdisplay, MetaGrabOp op, gboolean pointer_already_grabbed, gboolean frame_action, - int event_serial, int button, gulong modmask, guint32 timestamp, @@ -649,7 +648,6 @@ meta_core_begin_grab_op (Display *xdisplay, return meta_display_begin_grab_op (display, screen, window, op, pointer_already_grabbed, frame_action, - event_serial, button, modmask, timestamp, root_x, root_y); } diff --git a/src/core.h b/src/core.h index 5cb60337c..b28907db9 100644 --- a/src/core.h +++ b/src/core.h @@ -151,7 +151,6 @@ gboolean meta_core_begin_grab_op (Display *xdisplay, MetaGrabOp op, gboolean pointer_already_grabbed, gboolean frame_action, - int event_serial, int button, gulong modmask, guint32 timestamp, @@ -182,8 +181,6 @@ void meta_core_get_screen_size (Display *xdisplay, */ void meta_core_increment_event_serial (Display *display); -int meta_ui_get_last_event_serial (Display *xdisplay); - void meta_invalidate_default_icons (void); #endif diff --git a/src/display.c b/src/display.c index 2111a2711..604f778ce 100644 --- a/src/display.c +++ b/src/display.c @@ -1570,7 +1570,6 @@ event_callback (XEvent *event, if (display->grab_op != META_GRAB_OP_NONE && display->grab_window != NULL && - event->xany.serial >= display->grab_start_serial && grab_op_is_mouse (display->grab_op)) meta_window_handle_mouse_grab_op_event (display->grab_window, event); } @@ -1656,7 +1655,6 @@ event_callback (XEvent *event, if ((window && grab_op_is_mouse (display->grab_op) && display->grab_button != (int) event->xbutton.button && - event->xany.serial >= display->grab_start_serial && display->grab_window == window) || grab_op_is_keyboard (display->grab_op)) { @@ -1776,7 +1774,6 @@ event_callback (XEvent *event, op, TRUE, FALSE, - event->xbutton.serial, event->xbutton.button, 0, event->xbutton.time, @@ -1834,7 +1831,6 @@ event_callback (XEvent *event, META_GRAB_OP_MOVING, TRUE, FALSE, - event->xbutton.serial, event->xbutton.button, 0, event->xbutton.time, @@ -1845,19 +1841,16 @@ event_callback (XEvent *event, break; case ButtonRelease: if (display->grab_window == window && - event->xany.serial >= display->grab_start_serial && grab_op_is_mouse (display->grab_op)) meta_window_handle_mouse_grab_op_event (window, event); break; case MotionNotify: if (display->grab_window == window && - event->xany.serial >= display->grab_start_serial && grab_op_is_mouse (display->grab_op)) meta_window_handle_mouse_grab_op_event (window, event); break; case EnterNotify: if (display->grab_window == window && - event->xany.serial >= display->grab_start_serial && grab_op_is_mouse (display->grab_op)) { meta_window_handle_mouse_grab_op_event (window, event); @@ -1951,7 +1944,6 @@ event_callback (XEvent *event, break; case LeaveNotify: if (display->grab_window == window && - 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 (window != NULL) @@ -3305,7 +3297,6 @@ meta_display_begin_grab_op (MetaDisplay *display, MetaGrabOp op, gboolean pointer_already_grabbed, gboolean frame_action, - int event_serial, int button, gulong modmask, guint32 timestamp, @@ -3350,12 +3341,6 @@ meta_display_begin_grab_op (MetaDisplay *display, } } - /* We'll ignore any events < this serial. */ - if (pointer_already_grabbed) - display->grab_start_serial = event_serial; - else - display->grab_start_serial = XNextRequest (display->xdisplay); - /* FIXME: * If we have no MetaWindow we do our best * and try to do the grab on the RootWindow. diff --git a/src/display.h b/src/display.h index 5afc58209..59585f162 100644 --- a/src/display.h +++ b/src/display.h @@ -254,7 +254,6 @@ struct _MetaDisplay MetaScreen *grab_screen; MetaWindow *grab_window; Window grab_xwindow; - gulong grab_start_serial; int grab_button; int grab_anchor_root_x; int grab_anchor_root_y; @@ -450,7 +449,6 @@ gboolean meta_display_begin_grab_op (MetaDisplay *display, MetaGrabOp op, gboolean pointer_already_grabbed, gboolean frame_action, - int event_serial, int button, gulong modmask, guint32 timestamp, diff --git a/src/frames.c b/src/frames.c index 874fb842f..71a906fee 100644 --- a/src/frames.c +++ b/src/frames.c @@ -1406,7 +1406,6 @@ meta_frames_button_press_event (GtkWidget *widget, op, TRUE, TRUE, - meta_ui_get_last_event_serial (gdk_display), event->button, 0, event->time, @@ -1497,7 +1496,6 @@ meta_frames_button_press_event (GtkWidget *widget, op, TRUE, TRUE, - meta_ui_get_last_event_serial (gdk_display), event->button, 0, event->time, @@ -1518,7 +1516,6 @@ meta_frames_button_press_event (GtkWidget *widget, META_GRAB_OP_MOVING, TRUE, TRUE, - meta_ui_get_last_event_serial (gdk_display), event->button, 0, event->time, diff --git a/src/keybindings.c b/src/keybindings.c index 90ba32510..189a61af0 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -3332,7 +3332,6 @@ do_choose_window (MetaDisplay *display, cycle_op_from_tab_type (type), FALSE, FALSE, - event->xkey.serial, 0, binding->mask, event->xkey.time, @@ -3768,7 +3767,6 @@ handle_workspace_switch (MetaDisplay *display, META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING, FALSE, FALSE, - event->xkey.serial, 0, grab_mask, event->xkey.time, diff --git a/src/ui.c b/src/ui.c index e41a90e01..16b95255a 100644 --- a/src/ui.c +++ b/src/ui.c @@ -71,7 +71,6 @@ struct _EventFunc { MetaEventFunc func; gpointer data; - int last_event_serial; }; static EventFunc *ef = NULL; @@ -86,15 +85,7 @@ filter_func (GdkXEvent *xevent, if ((* ef->func) (xevent, ef->data)) return GDK_FILTER_REMOVE; else - { - /* ef would be NULL here if we removed the filter function - * in response to the event. - */ - if (ef != NULL) - ef->last_event_serial = ((XEvent*)xevent)->xany.serial; - - return GDK_FILTER_CONTINUE; - } + return GDK_FILTER_CONTINUE; } void @@ -125,16 +116,6 @@ meta_ui_remove_event_func (Display *xdisplay, ef = NULL; } -int -meta_ui_get_last_event_serial (Display *xdisplay) -{ - g_assert (ef != NULL); - - /* This is technically broken since it's not per-display */ - - return ef->last_event_serial; -} - MetaUI* meta_ui_new (Display *xdisplay, Screen *screen) diff --git a/src/window.c b/src/window.c index 117f86f87..13fce2964 100644 --- a/src/window.c +++ b/src/window.c @@ -4957,7 +4957,6 @@ meta_window_client_message (MetaWindow *window, op, FALSE, frame_action, - 0 /* event_serial */, button, 0, timestamp, x_root, @@ -7762,10 +7761,7 @@ meta_window_begin_grab_op (MetaWindow *window, guint32 timestamp) { int x, y; - gulong grab_start_serial; - grab_start_serial = XNextRequest (window->display->xdisplay); - warp_grab_pointer (window, op, &x, &y); @@ -7775,16 +7771,10 @@ meta_window_begin_grab_op (MetaWindow *window, op, FALSE, frame_action, - grab_start_serial /* event_serial */, 0 /* button */, 0, timestamp, x, y); - - /* We override the one set in display_begin_grab_op since we - * did additional stuff as part of the grabbing process - */ - window->display->grab_start_serial = grab_start_serial; } void