[mutter/wip/xinput2b: 7/19] window: Move grab op sync handling code out
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/xinput2b: 7/19] window: Move grab op sync handling code out
- Date: Wed, 21 Nov 2012 02:42:21 +0000 (UTC)
commit b031d45221d4dac17eef2423900b68c41f8fe10d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Nov 15 17:18:06 2012 -0500
window: Move grab op sync handling code out
This removes some duplicate event type checks, and will make
the code cleaner in the future when we want to make the grab_op_event
handler take an XIDeviceEvent directly.
https://bugzilla.gnome.org/show_bug.cgi?id=688779
src/core/window-private.h | 5 ++
src/core/window.c | 92 +++++++++++++++++++++++----------------------
2 files changed, 52 insertions(+), 45 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 1db735e..33fff73 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -580,6 +580,11 @@ void meta_window_shove_titlebar_onscreen (MetaWindow *window);
void meta_window_set_gravity (MetaWindow *window,
int gravity);
+#ifdef HAVE_XSYNC
+void meta_window_handle_mouse_grab_op_sync_event (MetaWindow *window,
+ XEvent *event);
+#endif /* HAVE_XSYNC */
+
void meta_window_handle_mouse_grab_op_event (MetaWindow *window,
XEvent *event);
diff --git a/src/core/window.c b/src/core/window.c
index e99411b..833c834 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -9225,59 +9225,61 @@ update_tile_mode (MetaWindow *window)
}
}
+#ifdef HAVE_XSYNC
void
-meta_window_handle_mouse_grab_op_event (MetaWindow *window,
- XEvent *event)
+meta_window_handle_mouse_grab_op_sync_event (MetaWindow *window,
+ XEvent *event)
{
-#ifdef HAVE_XSYNC
- if (event->type == (window->display->xsync_event_base + XSyncAlarmNotify))
- {
- meta_topic (META_DEBUG_RESIZING,
- "Alarm event received last motion x = %d y = %d\n",
- window->display->grab_latest_motion_x,
- window->display->grab_latest_motion_y);
+ meta_topic (META_DEBUG_RESIZING,
+ "Alarm event received last motion x = %d y = %d\n",
+ window->display->grab_latest_motion_x,
+ window->display->grab_latest_motion_y);
- /* If sync was previously disabled, turn it back on and hope
- * the application has come to its senses (maybe it was just
- * busy with a pagefault or a long computation).
- */
- window->disable_sync = FALSE;
- window->sync_request_time.tv_sec = 0;
- window->sync_request_time.tv_usec = 0;
+ /* If sync was previously disabled, turn it back on and hope
+ * the application has come to its senses (maybe it was just
+ * busy with a pagefault or a long computation).
+ */
+ window->disable_sync = FALSE;
+ window->sync_request_time.tv_sec = 0;
+ window->sync_request_time.tv_usec = 0;
- /* This means we are ready for another configure. */
- switch (window->display->grab_op)
- {
- case META_GRAB_OP_RESIZING_E:
- case META_GRAB_OP_RESIZING_W:
- case META_GRAB_OP_RESIZING_S:
- case META_GRAB_OP_RESIZING_N:
- case META_GRAB_OP_RESIZING_SE:
- case META_GRAB_OP_RESIZING_SW:
- case META_GRAB_OP_RESIZING_NE:
- case META_GRAB_OP_RESIZING_NW:
- case META_GRAB_OP_KEYBOARD_RESIZING_S:
- case META_GRAB_OP_KEYBOARD_RESIZING_N:
- case META_GRAB_OP_KEYBOARD_RESIZING_W:
- case META_GRAB_OP_KEYBOARD_RESIZING_E:
- case META_GRAB_OP_KEYBOARD_RESIZING_SE:
- case META_GRAB_OP_KEYBOARD_RESIZING_NE:
- case META_GRAB_OP_KEYBOARD_RESIZING_SW:
- case META_GRAB_OP_KEYBOARD_RESIZING_NW:
- /* no pointer round trip here, to keep in sync */
- update_resize (window,
- window->display->grab_last_user_action_was_snap,
- window->display->grab_latest_motion_x,
- window->display->grab_latest_motion_y,
- TRUE);
- break;
+ /* This means we are ready for another configure. */
+ switch (window->display->grab_op)
+ {
+ case META_GRAB_OP_RESIZING_E:
+ case META_GRAB_OP_RESIZING_W:
+ case META_GRAB_OP_RESIZING_S:
+ case META_GRAB_OP_RESIZING_N:
+ case META_GRAB_OP_RESIZING_SE:
+ case META_GRAB_OP_RESIZING_SW:
+ case META_GRAB_OP_RESIZING_NE:
+ case META_GRAB_OP_RESIZING_NW:
+ case META_GRAB_OP_KEYBOARD_RESIZING_S:
+ case META_GRAB_OP_KEYBOARD_RESIZING_N:
+ case META_GRAB_OP_KEYBOARD_RESIZING_W:
+ case META_GRAB_OP_KEYBOARD_RESIZING_E:
+ case META_GRAB_OP_KEYBOARD_RESIZING_SE:
+ case META_GRAB_OP_KEYBOARD_RESIZING_NE:
+ case META_GRAB_OP_KEYBOARD_RESIZING_SW:
+ case META_GRAB_OP_KEYBOARD_RESIZING_NW:
+ /* no pointer round trip here, to keep in sync */
+ update_resize (window,
+ window->display->grab_last_user_action_was_snap,
+ window->display->grab_latest_motion_x,
+ window->display->grab_latest_motion_y,
+ TRUE);
+ break;
- default:
- break;
- }
+ default:
+ break;
}
+}
#endif /* HAVE_XSYNC */
+void
+meta_window_handle_mouse_grab_op_event (MetaWindow *window,
+ XEvent *event)
+{
switch (event->type)
{
case ButtonRelease:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]