backend-x11: Take the touch grab on the stage window

So we don't get assert fails when touching the screen on mutter nested.
This commit is contained in:
Jasper St. Pierre 2014-07-14 17:23:22 -04:00
parent c5abf5ddbb
commit 3b85e4b2b9
5 changed files with 25 additions and 3 deletions

View File

@ -50,6 +50,7 @@ struct _MetaBackendClass
GObjectClass parent_class;
void (* post_init) (MetaBackend *backend);
void (* compositor_created) (MetaBackend *backend);
MetaIdleMonitor * (* create_idle_monitor) (MetaBackend *backend,
int device_id);

View File

@ -79,6 +79,11 @@ meta_backend_real_post_init (MetaBackend *backend)
priv->cursor_renderer = META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend);
}
static void
meta_backend_real_compositor_created (MetaBackend *backend)
{
}
static MetaCursorRenderer *
meta_backend_real_create_cursor_renderer (MetaBackend *backend)
{
@ -114,6 +119,7 @@ meta_backend_class_init (MetaBackendClass *klass)
klass->create_cursor_renderer = meta_backend_real_create_cursor_renderer;
klass->grab_device = meta_backend_real_grab_device;
klass->ungrab_device = meta_backend_real_ungrab_device;
klass->compositor_created = meta_backend_real_compositor_created;
}
static void
@ -145,6 +151,12 @@ meta_backend_post_init (MetaBackend *backend)
META_BACKEND_GET_CLASS (backend)->post_init (backend);
}
void
meta_backend_compositor_created (MetaBackend *backend)
{
META_BACKEND_GET_CLASS (backend)->compositor_created (backend);
}
MetaIdleMonitor *
meta_backend_get_idle_monitor (MetaBackend *backend,
int device_id)

View File

@ -38,6 +38,8 @@ GType meta_backend_get_type (void);
MetaBackend * meta_get_backend (void);
void meta_backend_compositor_created (MetaBackend *backend);
MetaIdleMonitor * meta_backend_get_idle_monitor (MetaBackend *backend,
int device_id);
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);

View File

@ -266,7 +266,7 @@ take_touch_grab (MetaBackend *backend)
XISetMask (mask.mask, XI_TouchEnd);
XIGrabTouchBegin (priv->xdisplay, META_VIRTUAL_CORE_POINTER_ID,
DefaultRootWindow (priv->xdisplay),
meta_backend_x11_get_xwindow (x11),
False, &mask, 1, &mods);
}
@ -307,11 +307,15 @@ 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);
}
static void
meta_backend_x11_compositor_created (MetaBackend *backend)
{
take_touch_grab (backend);
}
static MetaIdleMonitor *
meta_backend_x11_create_idle_monitor (MetaBackend *backend,
int device_id)
@ -408,6 +412,7 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
MetaBackendClass *backend_class = META_BACKEND_CLASS (klass);
backend_class->post_init = meta_backend_x11_post_init;
backend_class->compositor_created = meta_backend_x11_compositor_created;
backend_class->create_idle_monitor = meta_backend_x11_create_idle_monitor;
backend_class->create_monitor_manager = meta_backend_x11_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_x11_create_cursor_renderer;

View File

@ -822,6 +822,8 @@ meta_display_open (void)
enable_compositor (display);
meta_backend_compositor_created (meta_get_backend ());
meta_screen_create_guard_window (screen);
/* Set up touch support */