From 3a3be74e37048a33fb29b355aff99a5cc7f75419 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 16 Dec 2012 21:47:11 -0500 Subject: [PATCH] Remove some server calls for core devices These were missed in the first porting. https://bugzilla.gnome.org/show_bug.cgi?id=691363 --- src/core/display.c | 16 +++++++---- src/core/keybindings.c | 23 ++++++++------- src/core/screen.c | 64 +++++++++++++++++++++++++----------------- src/core/window.c | 37 +++++++++++++----------- 4 files changed, 82 insertions(+), 58 deletions(-) diff --git a/src/core/display.c b/src/core/display.c index 835620104..a23665813 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1648,9 +1648,11 @@ window_focus_on_pointer_rest_callback (gpointer data) { MetaScreen *screen; MetaWindow *window; Window root, child; - int root_x, root_y, x, y; + double root_x, root_y, x, y; guint32 timestamp; - guint mask; + XIButtonState buttons; + XIModifierState mods; + XIGroupState group; focus_data = data; display = focus_data->display; @@ -1660,10 +1662,12 @@ window_focus_on_pointer_rest_callback (gpointer data) { goto out; meta_error_trap_push (display); - XQueryPointer (display->xdisplay, - screen->xroot, - &root, &child, - &root_x, &root_y, &x, &y, &mask); + XIQueryPointer (display->xdisplay, + META_VIRTUAL_CORE_POINTER_ID, + screen->xroot, + &root, &child, + &root_x, &root_y, &x, &y, + &buttons, &mods, &group); meta_error_trap_pop (display); if (root_x != focus_data->pointer_x || diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 223d67072..cd980d947 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1350,9 +1350,11 @@ primary_modifier_still_pressed (MetaDisplay *display, unsigned int entire_binding_mask) { unsigned int primary_modifier; - int x, y, root_x, root_y; + double x, y, root_x, root_y; Window root, child; - guint mask; + XIButtonState buttons; + XIModifierState mods; + XIGroupState group; MetaScreen *random_screen; Window random_xwindow; @@ -1360,18 +1362,19 @@ primary_modifier_still_pressed (MetaDisplay *display, random_screen = display->screens->data; random_xwindow = random_screen->no_focus_window; - XQueryPointer (display->xdisplay, - random_xwindow, /* some random window */ - &root, &child, - &root_x, &root_y, - &x, &y, - &mask); + XIQueryPointer (display->xdisplay, + META_VIRTUAL_CORE_POINTER_ID, + random_xwindow, /* some random window */ + &root, &child, + &root_x, &root_y, + &x, &y, + &buttons, &mods, &group); meta_topic (META_DEBUG_KEYBINDINGS, "Primary modifier 0x%x full grab mask 0x%x current state 0x%x\n", - primary_modifier, entire_binding_mask, mask); + primary_modifier, entire_binding_mask, mods.effective); - if ((mask & primary_modifier) == 0) + if ((mods.effective & primary_modifier) == 0) return FALSE; else return TRUE; diff --git a/src/core/screen.c b/src/core/screen.c index f80824384..7a39496fa 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -1963,24 +1963,29 @@ meta_screen_get_mouse_window (MetaScreen *screen, { MetaWindow *window; Window root_return, child_return; - int root_x_return, root_y_return; - int win_x_return, win_y_return; - unsigned int mask_return; - + double root_x_return, root_y_return; + double win_x_return, win_y_return; + XIButtonState buttons; + XIModifierState mods; + XIGroupState group; + if (not_this_one) meta_topic (META_DEBUG_FOCUS, "Focusing mouse window excluding %s\n", not_this_one->desc); meta_error_trap_push (screen->display); - XQueryPointer (screen->display->xdisplay, - screen->xroot, - &root_return, - &child_return, - &root_x_return, - &root_y_return, - &win_x_return, - &win_y_return, - &mask_return); + XIQueryPointer (screen->display->xdisplay, + META_VIRTUAL_CORE_POINTER_ID, + screen->xroot, + &root_return, + &child_return, + &root_x_return, + &root_y_return, + &win_x_return, + &win_y_return, + &buttons, + &mods, + &group); meta_error_trap_pop (screen->display); window = meta_stack_get_default_focus_window_at_point (screen->stack, @@ -2191,23 +2196,32 @@ meta_screen_get_current_monitor (MetaScreen *screen) if (screen->display->monitor_cache_invalidated) { Window root_return, child_return; - int win_x_return, win_y_return; - unsigned int mask_return; + double win_x_return, win_y_return; + double root_x_return, root_y_return; + XIButtonState buttons; + XIModifierState mods; + XIGroupState group; int i; MetaRectangle pointer_position; - + screen->display->monitor_cache_invalidated = FALSE; + XIQueryPointer (screen->display->xdisplay, + META_VIRTUAL_CORE_POINTER_ID, + screen->xroot, + &root_return, + &child_return, + &root_x_return, + &root_y_return, + &win_x_return, + &win_y_return, + &buttons, + &mods, + &group); + + pointer_position.x = root_x_return; + pointer_position.y = root_y_return; pointer_position.width = pointer_position.height = 1; - XQueryPointer (screen->display->xdisplay, - screen->xroot, - &root_return, - &child_return, - &pointer_position.x, - &pointer_position.y, - &win_x_return, - &win_y_return, - &mask_return); screen->last_monitor_index = 0; for (i = 0; i < screen->n_monitor_infos; i++) diff --git a/src/core/window.c b/src/core/window.c index 829e12d28..b2db85e11 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -6670,28 +6670,30 @@ meta_window_client_message (MetaWindow *window, */ if (button == 0) { - int x, y, query_root_x, query_root_y; + double x, y, query_root_x, query_root_y; Window root, child; - guint mask; + XIButtonState buttons; + XIModifierState mods; + XIGroupState group; /* The race conditions in this _NET_WM_MOVERESIZE thing * are mind-boggling */ - mask = 0; meta_error_trap_push (window->display); - XQueryPointer (window->display->xdisplay, - window->xwindow, - &root, &child, - &query_root_x, &query_root_y, - &x, &y, - &mask); + XIQueryPointer (window->display->xdisplay, + META_VIRTUAL_CORE_POINTER_ID, + window->xwindow, + &root, &child, + &query_root_x, &query_root_y, + &x, &y, + &buttons, &mods, &group); meta_error_trap_pop (window->display); - if (mask & Button1Mask) + if (mods.effective & Button1Mask) button = 1; - else if (mask & Button2Mask) + else if (mods.effective & Button2Mask) button = 2; - else if (mask & Button3Mask) + else if (mods.effective & Button3Mask) button = 3; else button = 0; @@ -9850,11 +9852,12 @@ warp_grab_pointer (MetaWindow *window, meta_window_get_client_root_coords (window, &display->grab_anchor_window_pos); - XWarpPointer (display->xdisplay, - None, - window->screen->xroot, - 0, 0, 0, 0, - *x, *y); + XIWarpPointer (display->xdisplay, + META_VIRTUAL_CORE_POINTER_ID, + None, + window->screen->xroot, + 0, 0, 0, 0, + *x, *y); if (meta_error_trap_pop_with_return (display) != Success) {