add an event_serial argument and use it when the pointer is already

2003-11-24  Havoc Pennington  <hp@redhat.com>

	* 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
This commit is contained in:
Havoc Pennington 2003-11-24 18:09:47 +00:00 committed by Havoc Pennington
parent feefcdd892
commit 423b5f5f39
9 changed files with 45 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2003-11-24 Havoc Pennington <hp@redhat.com>
* 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 <hp@redhat.com> 2003-11-24 Havoc Pennington <hp@redhat.com>
* Apply patch from Gregory Merchan to avoid using CurrentTime when * Apply patch from Gregory Merchan to avoid using CurrentTime when

View File

@ -678,6 +678,7 @@ meta_core_begin_grab_op (Display *xdisplay,
Window frame_xwindow, Window frame_xwindow,
MetaGrabOp op, MetaGrabOp op,
gboolean pointer_already_grabbed, gboolean pointer_already_grabbed,
int event_serial,
int button, int button,
gulong modmask, gulong modmask,
Time timestamp, Time timestamp,
@ -699,6 +700,7 @@ meta_core_begin_grab_op (Display *xdisplay,
return meta_display_begin_grab_op (display, screen, window, return meta_display_begin_grab_op (display, screen, window,
op, pointer_already_grabbed, op, pointer_already_grabbed,
event_serial,
button, modmask, button, modmask,
timestamp, root_x, root_y); timestamp, root_x, root_y);
} }

View File

@ -133,6 +133,7 @@ gboolean meta_core_begin_grab_op (Display *xdisplay,
Window frame_xwindow, Window frame_xwindow,
MetaGrabOp op, MetaGrabOp op,
gboolean pointer_already_grabbed, gboolean pointer_already_grabbed,
int event_serial,
int button, int button,
gulong modmask, gulong modmask,
Time timestamp, Time timestamp,
@ -163,6 +164,8 @@ void meta_core_get_screen_size (Display *xdisplay,
*/ */
void meta_core_increment_event_serial (Display *display); void meta_core_increment_event_serial (Display *display);
int meta_ui_get_last_event_serial (Display *xdisplay);
#endif #endif

View File

@ -1427,6 +1427,7 @@ event_callback (XEvent *event,
window, window,
op, op,
TRUE, TRUE,
event->xbutton.serial,
event->xbutton.button, event->xbutton.button,
0, 0,
event->xbutton.time, event->xbutton.time,
@ -1481,6 +1482,7 @@ event_callback (XEvent *event,
window, window,
META_GRAB_OP_MOVING, META_GRAB_OP_MOVING,
TRUE, TRUE,
event->xbutton.serial,
event->xbutton.button, event->xbutton.button,
0, 0,
event->xbutton.time, event->xbutton.time,
@ -2880,6 +2882,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,
gboolean pointer_already_grabbed, gboolean pointer_already_grabbed,
int event_serial,
int button, int button,
gulong modmask, gulong modmask,
Time timestamp, Time timestamp,
@ -2902,6 +2905,9 @@ meta_display_begin_grab_op (MetaDisplay *display,
} }
/* We'll ignore any events < this serial. */ /* 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); display->grab_start_serial = XNextRequest (display->xdisplay);
/* FIXME: /* FIXME:

View File

@ -366,6 +366,7 @@ gboolean meta_display_begin_grab_op (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,
gboolean pointer_already_grabbed, gboolean pointer_already_grabbed,
int event_serial,
int button, int button,
gulong modmask, gulong modmask,
Time timestamp, Time timestamp,

View File

@ -2,6 +2,7 @@
/* /*
* Copyright (C) 2001 Havoc Pennington * Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2003 Red Hat, Inc.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * 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, frame->xwindow,
op, op,
TRUE, TRUE,
meta_ui_get_last_event_serial (gdk_display),
event->button, event->button,
0, 0,
event->time, event->time,
@ -1336,6 +1338,7 @@ meta_frames_button_press_event (GtkWidget *widget,
frame->xwindow, frame->xwindow,
op, op,
TRUE, TRUE,
meta_ui_get_last_event_serial (gdk_display),
event->button, event->button,
0, 0,
event->time, event->time,
@ -1355,6 +1358,7 @@ meta_frames_button_press_event (GtkWidget *widget,
frame->xwindow, frame->xwindow,
META_GRAB_OP_MOVING, META_GRAB_OP_MOVING,
TRUE, TRUE,
meta_ui_get_last_event_serial (gdk_display),
event->button, event->button,
0, 0,
event->time, event->time,

View File

@ -2957,6 +2957,7 @@ do_choose_window (MetaDisplay *display,
tab_op_from_tab_type (type) : tab_op_from_tab_type (type) :
cycle_op_from_tab_type (type), cycle_op_from_tab_type (type),
FALSE, FALSE,
event->xkey.serial,
0, 0,
binding->mask, binding->mask,
event->xkey.time, event->xkey.time,
@ -3364,6 +3365,7 @@ handle_workspace_switch (MetaDisplay *display,
NULL, NULL,
META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING, META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING,
FALSE, FALSE,
event->xkey.serial,
0, 0,
grab_mask, grab_mask,
event->xkey.time, event->xkey.time,

View File

@ -69,6 +69,7 @@ struct _EventFunc
{ {
MetaEventFunc func; MetaEventFunc func;
gpointer data; gpointer data;
int last_event_serial;
}; };
static GdkFilterReturn static GdkFilterReturn
@ -83,7 +84,10 @@ filter_func (GdkXEvent *xevent,
if ((* ef->func) (xevent, ef->data)) if ((* ef->func) (xevent, ef->data))
return GDK_FILTER_REMOVE; return GDK_FILTER_REMOVE;
else else
{
ef->last_event_serial = ((XEvent*)xevent)->xany.serial;
return GDK_FILTER_CONTINUE; return GDK_FILTER_CONTINUE;
}
} }
static EventFunc *ef = NULL; static EventFunc *ef = NULL;
@ -116,6 +120,16 @@ meta_ui_remove_event_func (Display *xdisplay,
ef = NULL; 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* MetaUI*
meta_ui_new (Display *xdisplay, meta_ui_new (Display *xdisplay,
Screen *screen) Screen *screen)

View File

@ -3893,7 +3893,7 @@ meta_window_client_message (MetaWindow *window,
window->screen, window->screen,
window, window,
op, op,
FALSE, FALSE, 0 /* event_serial */,
button, 0, button, 0,
meta_display_get_current_time (window->display), meta_display_get_current_time (window->display),
x_root, x_root,
@ -6710,7 +6710,10 @@ meta_window_begin_grab_op (MetaWindow *window,
window->screen, window->screen,
window, window,
op, op,
FALSE, 0, 0, FALSE,
grab_start_serial /* event_serial */,
0 /* button */,
0,
timestamp, timestamp,
x, y); x, y);