keybindings: use the right device for querying the modifier mask.

This commit is contained in:
Carlos Garnacho 2011-07-03 21:06:55 +02:00
parent 656fa71649
commit 5ecbb3ec3b

View File

@ -35,6 +35,7 @@
#include "frame.h" #include "frame.h"
#include "place.h" #include "place.h"
#include "input-events.h" #include "input-events.h"
#include "device-pointer.h"
#include <meta/prefs.h> #include <meta/prefs.h>
#include <meta/util.h> #include <meta/util.h>
@ -1236,11 +1237,10 @@ keycode_is_primary_modifier (MetaDisplay *display,
static gboolean static gboolean
primary_modifier_still_pressed (MetaDisplay *display, primary_modifier_still_pressed (MetaDisplay *display,
MetaDevice *device,
unsigned int entire_binding_mask) unsigned int entire_binding_mask)
{ {
unsigned int primary_modifier; unsigned int primary_modifier;
int x, y, root_x, root_y;
Window root, child;
guint mask; guint mask;
MetaScreen *random_screen; MetaScreen *random_screen;
Window random_xwindow; Window random_xwindow;
@ -1249,12 +1249,11 @@ primary_modifier_still_pressed (MetaDisplay *display,
random_screen = display->screens->data; random_screen = display->screens->data;
random_xwindow = random_screen->no_focus_window; random_xwindow = random_screen->no_focus_window;
XQueryPointer (display->xdisplay, meta_device_pointer_query_position (META_DEVICE_POINTER (device),
random_xwindow, /* some random window */ random_xwindow, /* some random window */
&root, &child, NULL, NULL, NULL,
&root_x, &root_y, NULL, NULL, NULL,
&x, &y, &mask);
&mask);
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Primary modifier 0x%x full grab mask 0x%x current state 0x%x\n", "Primary modifier 0x%x full grab mask 0x%x current state 0x%x\n",
@ -3253,7 +3252,7 @@ do_choose_window (MetaDisplay *display,
0, 0)) 0, 0))
return; return;
if (!primary_modifier_still_pressed (display, binding->mask)) if (!primary_modifier_still_pressed (display, device, binding->mask))
{ {
/* This handles a race where modifier might be released before /* This handles a race where modifier might be released before
* we establish the grab. must end grab prior to trying to focus * we establish the grab. must end grab prior to trying to focus
@ -3672,7 +3671,8 @@ handle_workspace_switch (MetaDisplay *display,
next = meta_workspace_get_neighbor (screen->active_workspace, motion); next = meta_workspace_get_neighbor (screen->active_workspace, motion);
g_assert (next); g_assert (next);
grabbed_before_release = primary_modifier_still_pressed (display, grab_mask); grabbed_before_release = primary_modifier_still_pressed (display, device,
grab_mask);
meta_topic (META_DEBUG_KEYBINDINGS, "Activating target workspace\n"); meta_topic (META_DEBUG_KEYBINDINGS, "Activating target workspace\n");