diff --git a/ChangeLog b/ChangeLog index 08eddf786..63f9ab3b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-11-24 Havoc Pennington + + * src/display.c (meta_display_begin_grab_op): add an event_serial + argument and use it when the pointer is already grabbed + automatically on the button press. May fix bug #126871 + 2003-11-24 Havoc Pennington * Apply patch from Gregory Merchan to avoid using CurrentTime when diff --git a/src/core.c b/src/core.c index ee7ff2d40..422ef3c2c 100644 --- a/src/core.c +++ b/src/core.c @@ -678,6 +678,7 @@ meta_core_begin_grab_op (Display *xdisplay, Window frame_xwindow, MetaGrabOp op, gboolean pointer_already_grabbed, + int event_serial, int button, gulong modmask, Time timestamp, @@ -699,6 +700,7 @@ meta_core_begin_grab_op (Display *xdisplay, return meta_display_begin_grab_op (display, screen, window, op, pointer_already_grabbed, + event_serial, button, modmask, timestamp, root_x, root_y); } diff --git a/src/core.h b/src/core.h index be4065a1c..e1886a499 100644 --- a/src/core.h +++ b/src/core.h @@ -133,6 +133,7 @@ gboolean meta_core_begin_grab_op (Display *xdisplay, Window frame_xwindow, MetaGrabOp op, gboolean pointer_already_grabbed, + int event_serial, int button, gulong modmask, Time timestamp, @@ -163,6 +164,8 @@ 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); + #endif diff --git a/src/display.c b/src/display.c index 8855648fa..bbfba65bf 100644 --- a/src/display.c +++ b/src/display.c @@ -1427,6 +1427,7 @@ event_callback (XEvent *event, window, op, TRUE, + event->xbutton.serial, event->xbutton.button, 0, event->xbutton.time, @@ -1481,6 +1482,7 @@ event_callback (XEvent *event, window, META_GRAB_OP_MOVING, TRUE, + event->xbutton.serial, event->xbutton.button, 0, event->xbutton.time, @@ -2880,6 +2882,7 @@ meta_display_begin_grab_op (MetaDisplay *display, MetaWindow *window, MetaGrabOp op, gboolean pointer_already_grabbed, + int event_serial, int button, gulong modmask, Time timestamp, @@ -2902,7 +2905,10 @@ meta_display_begin_grab_op (MetaDisplay *display, } /* We'll ignore any events < this serial. */ - display->grab_start_serial = XNextRequest (display->xdisplay); + 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 diff --git a/src/display.h b/src/display.h index 97cc901c3..fc7e631c0 100644 --- a/src/display.h +++ b/src/display.h @@ -366,6 +366,7 @@ gboolean meta_display_begin_grab_op (MetaDisplay *display, MetaWindow *window, MetaGrabOp op, gboolean pointer_already_grabbed, + int event_serial, int button, gulong modmask, Time timestamp, diff --git a/src/frames.c b/src/frames.c index 3086837ef..d1622cbe2 100644 --- a/src/frames.c +++ b/src/frames.c @@ -2,6 +2,7 @@ /* * Copyright (C) 2001 Havoc Pennington + * Copyright (C) 2003 Red Hat, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -1257,6 +1258,7 @@ meta_frames_button_press_event (GtkWidget *widget, frame->xwindow, op, TRUE, + meta_ui_get_last_event_serial (gdk_display), event->button, 0, event->time, @@ -1336,6 +1338,7 @@ meta_frames_button_press_event (GtkWidget *widget, frame->xwindow, op, TRUE, + meta_ui_get_last_event_serial (gdk_display), event->button, 0, event->time, @@ -1355,6 +1358,7 @@ meta_frames_button_press_event (GtkWidget *widget, frame->xwindow, META_GRAB_OP_MOVING, 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 3c50d390f..921736e35 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -2957,6 +2957,7 @@ do_choose_window (MetaDisplay *display, tab_op_from_tab_type (type) : cycle_op_from_tab_type (type), FALSE, + event->xkey.serial, 0, binding->mask, event->xkey.time, @@ -3364,6 +3365,7 @@ handle_workspace_switch (MetaDisplay *display, NULL, META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING, FALSE, + event->xkey.serial, 0, grab_mask, event->xkey.time, diff --git a/src/ui.c b/src/ui.c index 93a6beb15..76fb958ad 100644 --- a/src/ui.c +++ b/src/ui.c @@ -69,6 +69,7 @@ struct _EventFunc { MetaEventFunc func; gpointer data; + int last_event_serial; }; static GdkFilterReturn @@ -83,7 +84,10 @@ filter_func (GdkXEvent *xevent, if ((* ef->func) (xevent, ef->data)) return GDK_FILTER_REMOVE; else - return GDK_FILTER_CONTINUE; + { + ef->last_event_serial = ((XEvent*)xevent)->xany.serial; + return GDK_FILTER_CONTINUE; + } } static EventFunc *ef = NULL; @@ -116,6 +120,16 @@ 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 c3b29c3df..552f09032 100644 --- a/src/window.c +++ b/src/window.c @@ -3893,7 +3893,7 @@ meta_window_client_message (MetaWindow *window, window->screen, window, op, - FALSE, + FALSE, 0 /* event_serial */, button, 0, meta_display_get_current_time (window->display), x_root, @@ -6710,7 +6710,10 @@ meta_window_begin_grab_op (MetaWindow *window, window->screen, window, op, - FALSE, 0, 0, + FALSE, + grab_start_serial /* event_serial */, + 0 /* button */, + 0, timestamp, x, y);