Take the touch grab in MetaBackendX11

This means that it won't trigger when we're running as a Wayland
compositor, which will cause a few warnings and possibly more
brokenness.
This commit is contained in:
Jasper St. Pierre 2014-07-14 09:41:10 -04:00
parent 379bb0a77d
commit 55354f5c38
2 changed files with 20 additions and 31 deletions

View File

@ -252,6 +252,24 @@ x_event_source_new (MetaBackend *backend)
return source;
}
static void
take_touch_grab (MetaBackend *backend)
{
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask mask = { META_VIRTUAL_CORE_POINTER_ID, sizeof (mask_bits), mask_bits };
XIGrabModifiers mods = { XIAnyModifier, 0 };
XISetMask (mask.mask, XI_TouchBegin);
XISetMask (mask.mask, XI_TouchUpdate);
XISetMask (mask.mask, XI_TouchEnd);
XIGrabTouchBegin (priv->xdisplay, META_VIRTUAL_CORE_POINTER_ID,
DefaultRootWindow (priv->xdisplay),
False, &mask, 1, &mods);
}
static void
meta_backend_x11_post_init (MetaBackend *backend)
{
@ -289,6 +307,8 @@ meta_backend_x11_post_init (MetaBackend *backend)
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
}
take_touch_grab (backend);
META_BACKEND_CLASS (meta_backend_x11_parent_class)->post_init (backend);
}

View File

@ -428,35 +428,6 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker,
DefaultRootWindow (display->xdisplay), event_mode);
}
static void
meta_display_grab_window_touch (MetaDisplay *display,
Window xwindow)
{
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask mask = { META_VIRTUAL_CORE_POINTER_ID, sizeof (mask_bits), mask_bits };
XIGrabModifiers mods = { XIAnyModifier, 0 };
XISetMask (mask.mask, XI_TouchBegin);
XISetMask (mask.mask, XI_TouchUpdate);
XISetMask (mask.mask, XI_TouchEnd);
XIGrabTouchBegin (meta_backend_x11_get_xdisplay (backend),
META_VIRTUAL_CORE_POINTER_ID,
xwindow, False, &mask, 1, &mods);
}
static void
meta_display_ungrab_window_touch (MetaDisplay *display,
Window xwindow)
{
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
XIGrabModifiers mods = { XIAnyModifier, 0 };
XIUngrabTouchBegin (meta_backend_x11_get_xdisplay (backend),
META_VIRTUAL_CORE_POINTER_ID, xwindow, 1, &mods);
}
/**
* meta_display_open:
*
@ -857,7 +828,6 @@ meta_display_open (void)
display->gesture_tracker = meta_gesture_tracker_new ();
g_signal_connect (display->gesture_tracker, "state-changed",
G_CALLBACK (gesture_tracker_state_changed), display);
meta_display_grab_window_touch (display, DefaultRootWindow (display->xdisplay));
/* We know that if mutter is running as a Wayland compositor,
* we start out with no windows.
@ -1029,7 +999,6 @@ meta_display_close (MetaDisplay *display,
meta_display_remove_autoraise_callback (display);
meta_display_ungrab_window_touch (display, DefaultRootWindow (display->xdisplay));
g_clear_object (&display->gesture_tracker);
if (display->focus_timeout_id)