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>
* 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,
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);
}

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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)

View File

@ -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);