mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
display: Grab buttons with XI2
https://bugzilla.gnome.org/show_bug.cgi?id=688779
This commit is contained in:
parent
c1b8e0ac8f
commit
8fb9e0072c
@ -3699,7 +3699,7 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
|
|||||||
grab_xwindow,
|
grab_xwindow,
|
||||||
timestamp,
|
timestamp,
|
||||||
cursor,
|
cursor,
|
||||||
GrabModeAsync, GrabModeAsync,
|
XIGrabModeAsync, XIGrabModeAsync,
|
||||||
False, /* owner_events */
|
False, /* owner_events */
|
||||||
&mask) == Success)
|
&mask) == Success)
|
||||||
{
|
{
|
||||||
@ -4096,6 +4096,13 @@ meta_change_button_grab (MetaDisplay *display,
|
|||||||
{
|
{
|
||||||
unsigned int ignored_mask;
|
unsigned int ignored_mask;
|
||||||
|
|
||||||
|
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
|
||||||
|
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
|
||||||
|
|
||||||
|
XISetMask (mask.mask, XI_ButtonPress);
|
||||||
|
XISetMask (mask.mask, XI_ButtonRelease);
|
||||||
|
XISetMask (mask.mask, XI_Motion);
|
||||||
|
|
||||||
meta_verbose ("%s 0x%lx sync = %d button = %d modmask 0x%x\n",
|
meta_verbose ("%s 0x%lx sync = %d button = %d modmask 0x%x\n",
|
||||||
grab ? "Grabbing" : "Ungrabbing",
|
grab ? "Grabbing" : "Ungrabbing",
|
||||||
xwindow,
|
xwindow,
|
||||||
@ -4106,6 +4113,8 @@ meta_change_button_grab (MetaDisplay *display,
|
|||||||
ignored_mask = 0;
|
ignored_mask = 0;
|
||||||
while (ignored_mask <= display->ignored_modifier_mask)
|
while (ignored_mask <= display->ignored_modifier_mask)
|
||||||
{
|
{
|
||||||
|
XIGrabModifiers mods;
|
||||||
|
|
||||||
if (ignored_mask & ~(display->ignored_modifier_mask))
|
if (ignored_mask & ~(display->ignored_modifier_mask))
|
||||||
{
|
{
|
||||||
/* Not a combination of ignored modifiers
|
/* Not a combination of ignored modifiers
|
||||||
@ -4115,22 +4124,24 @@ meta_change_button_grab (MetaDisplay *display,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mods = (XIGrabModifiers) { modmask | ignored_mask, 0 };
|
||||||
|
|
||||||
if (meta_is_debugging ())
|
if (meta_is_debugging ())
|
||||||
meta_error_trap_push_with_return (display);
|
meta_error_trap_push_with_return (display);
|
||||||
|
|
||||||
/* GrabModeSync means freeze until XAllowEvents */
|
/* GrabModeSync means freeze until XAllowEvents */
|
||||||
|
|
||||||
if (grab)
|
if (grab)
|
||||||
XGrabButton (display->xdisplay, button, modmask | ignored_mask,
|
XIGrabButton (display->xdisplay,
|
||||||
xwindow, False,
|
META_VIRTUAL_CORE_POINTER_ID,
|
||||||
ButtonPressMask | ButtonReleaseMask |
|
button, xwindow, None,
|
||||||
PointerMotionMask | PointerMotionHintMask,
|
sync ? XIGrabModeSync : XIGrabModeAsync,
|
||||||
sync ? GrabModeSync : GrabModeAsync,
|
XIGrabModeAsync, False,
|
||||||
GrabModeAsync,
|
&mask, 1, &mods);
|
||||||
False, None);
|
|
||||||
else
|
else
|
||||||
XUngrabButton (display->xdisplay, button, modmask | ignored_mask,
|
XIUngrabButton (display->xdisplay,
|
||||||
xwindow);
|
META_VIRTUAL_CORE_POINTER_ID,
|
||||||
|
button, xwindow, 1, &mods);
|
||||||
|
|
||||||
if (meta_is_debugging ())
|
if (meta_is_debugging ())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user