[mutter/wip/xinput2b: 19/22] keybindings: Grab keys with XI2
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/xinput2b: 19/22] keybindings: Grab keys with XI2
- Date: Wed, 21 Nov 2012 02:27:26 +0000 (UTC)
commit dc51f686ad6e81a157b08a08a3ea959255968923
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Nov 20 18:04:42 2012 -0500
keybindings: Grab keys with XI2
src/core/keybindings.c | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index b82fa8b..cd557dd 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -810,6 +810,12 @@ meta_change_keygrab (MetaDisplay *display,
{
unsigned int ignored_mask;
+ unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
+ XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
+
+ XISetMask (mask.mask, XI_KeyPress);
+ XISetMask (mask.mask, XI_KeyRelease);
+
/* Grab keycode/modmask, together with
* all combinations of ignored modifiers.
* X provides no better way to do this.
@@ -827,6 +833,8 @@ meta_change_keygrab (MetaDisplay *display,
ignored_mask = 0;
while (ignored_mask <= display->ignored_modifier_mask)
{
+ XIGrabModifiers mods;
+
if (ignored_mask & ~(display->ignored_modifier_mask))
{
/* Not a combination of ignored modifiers
@@ -836,18 +844,20 @@ meta_change_keygrab (MetaDisplay *display,
continue;
}
+ mods = (XIGrabModifiers) { modmask | ignored_mask, 0 };
+
if (meta_is_debugging ())
meta_error_trap_push_with_return (display);
if (grab)
- XGrabKey (display->xdisplay, keycode,
- modmask | ignored_mask,
- xwindow,
- True,
- GrabModeAsync, GrabModeSync);
+ XIGrabKeycode (display->xdisplay,
+ VIRTUAL_CORE_KEYBOARD_ID,
+ keycode, xwindow,
+ GrabModeAsync, GrabModeSync,
+ False, &mask, 1, &mods);
else
- XUngrabKey (display->xdisplay, keycode,
- modmask | ignored_mask,
- xwindow);
+ XIUngrabKeycode (display->xdisplay,
+ VIRTUAL_CORE_KEYBOARD_ID,
+ keycode, xwindow, 1, &mods);
if (meta_is_debugging ())
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]