[mutter/wip/wayland-display: 10/55] wayland: add input device handling too
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-display: 10/55] wayland: add input device handling too
- Date: Tue, 30 Jul 2013 16:16:41 +0000 (UTC)
commit 763fe905375b7d72d59e27af00a02368f50cdaf5
Author: Giovanni Campagna <gcampagn redhat com>
Date: Mon Jul 15 18:39:32 2013 +0200
wayland: add input device handling too
Use the new hook in clutter-evdev to ask weston-launch for the
FDs of the input devices we need.
src/wayland/meta-wayland.c | 31 ++++++++++++++++++++++++-------
1 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 7481e27..959c61e 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -24,6 +24,7 @@
#include <clutter/clutter.h>
#include <clutter/wayland/clutter-wayland-compositor.h>
#include <clutter/wayland/clutter-wayland-surface.h>
+#include <clutter/evdev/clutter-evdev.h>
#include <glib.h>
#include <sys/time.h>
@@ -1805,6 +1806,8 @@ on_our_vt_enter (MetaTTY *tty,
g_warning ("Failed to become DRM master: %s", error->message);
g_error_free (error);
}
+
+ clutter_evdev_reclaim_devices ();
}
static void
@@ -1821,7 +1824,19 @@ on_our_vt_leave (MetaTTY *tty,
g_error_free (error);
}
- /* FIXME: we must release input devices as well! */
+ clutter_evdev_release_devices ();
+}
+
+static int
+on_evdev_device_open (const char *path,
+ int flags,
+ gpointer user_data,
+ GError **error)
+{
+ MetaWaylandCompositor *compositor = user_data;
+
+ return meta_weston_launch_open_input_device (compositor->weston_launch,
+ path, flags, error);
}
void
@@ -1832,6 +1847,7 @@ meta_wayland_init (void)
ClutterBackend *backend;
CoglContext *cogl_context;
CoglRenderer *cogl_renderer;
+ int weston_launch_fd;
memset (compositor, 0, sizeof (MetaWaylandCompositor));
@@ -1868,6 +1884,13 @@ meta_wayland_init (void)
clutter_wayland_set_compositor_display (compositor->wayland_display);
+ /* We need to set this before clutter_init(), so we do it unconditionally.
+ It doesn't harm anyway to do it under X11 */
+ weston_launch_fd = env_get_fd ("WESTON_LAUNCHER_SOCK");
+ if (weston_launch_fd >= 0)
+ compositor->weston_launch = g_socket_new_from_fd (weston_launch_fd, NULL);
+ clutter_evdev_set_open_callback (on_evdev_device_open, compositor);
+
if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
g_error ("Failed to initialize Clutter");
@@ -1883,12 +1906,6 @@ meta_wayland_init (void)
if (compositor->drm_fd >= 0)
{
/* Running on bare metal, let's initalize DRM master and VT handling */
- int weston_launch_fd;
-
- weston_launch_fd = env_get_fd ("WESTON_LAUNCHER_SOCK");
- if (weston_launch_fd >= 0)
- compositor->weston_launch = g_socket_new_from_fd (weston_launch_fd, NULL);
-
compositor->tty = meta_tty_new ();
if (compositor->tty)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]