[mutter/wayland] wayland: Remove is_native from seat



commit 304a525744189f8780d56b79ad15c853ea7a7cd9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Feb 17 20:49:04 2014 -0500

    wayland: Remove is_native from seat
    
    We can easily do this with a Clutter backend check instead...

 src/wayland/meta-wayland-keyboard.c |   12 +++++++-----
 src/wayland/meta-wayland-keyboard.h |    4 +---
 src/wayland/meta-wayland-pointer.c  |   16 +++++++++++-----
 src/wayland/meta-wayland-pointer.h  |    3 +--
 src/wayland/meta-wayland-seat.c     |    8 +++-----
 src/wayland/meta-wayland-seat.h     |    3 +--
 src/wayland/meta-wayland.c          |    2 +-
 7 files changed, 25 insertions(+), 23 deletions(-)
---
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 2787bb0..566a596 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -201,13 +201,17 @@ meta_wayland_keyboard_take_keymap (MetaWaylandKeyboard *keyboard,
   strcpy (xkb_info->keymap_area, keymap_str);
   free (keymap_str);
 
-  if (keyboard->is_evdev)
+#if defined(CLUTTER_WINDOWING_EGL)
+  /* XXX -- the evdev backend can be used regardless of the
+   * windowing backend. To do this properly we need a Clutter
+   * API to check the input backend. */
+  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
     {
       ClutterDeviceManager *manager;
-
       manager = clutter_device_manager_get_default ();
       clutter_evdev_set_keyboard_map (manager, xkb_info->keymap);
     }
+#endif
 
   inform_clients_of_new_keymap (keyboard, flags);
 
@@ -331,8 +335,7 @@ static MetaWaylandKeyboardGrabInterface modal_grab = {
 
 gboolean
 meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
-                            struct wl_display   *display,
-                           gboolean             is_evdev)
+                            struct wl_display   *display)
 {
   memset (keyboard, 0, sizeof *keyboard);
   keyboard->xkb_info.keymap_fd = -1;
@@ -347,7 +350,6 @@ meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
   keyboard->display = display;
 
   keyboard->xkb_context = xkb_context_new (0 /* flags */);
-  keyboard->is_evdev = is_evdev;
 
   /* Compute a default until gnome-settings-daemon starts and sets
      the appropriate values
diff --git a/src/wayland/meta-wayland-keyboard.h b/src/wayland/meta-wayland-keyboard.h
index d528073..fd87c86 100644
--- a/src/wayland/meta-wayland-keyboard.h
+++ b/src/wayland/meta-wayland-keyboard.h
@@ -110,7 +110,6 @@ struct _MetaWaylandKeyboard
   struct wl_display *display;
 
   struct xkb_context *xkb_context;
-  gboolean is_evdev;
   MetaWaylandXkbInfo xkb_info;
 
   MetaWaylandKeyboardGrab input_method_grab;
@@ -119,8 +118,7 @@ struct _MetaWaylandKeyboard
 
 gboolean
 meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
-                            struct wl_display   *display,
-                           gboolean             is_evdev);
+                            struct wl_display   *display);
 
 typedef enum {
   META_WAYLAND_KEYBOARD_SKIP_XCLIENTS = 1,
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 189a99b..59ed093 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -257,8 +257,7 @@ pointer_constrain_callback (ClutterInputDevice *device,
 }
 
 void
-meta_wayland_pointer_init (MetaWaylandPointer *pointer,
-                          gboolean            is_native)
+meta_wayland_pointer_init (MetaWaylandPointer *pointer)
 {
   ClutterDeviceManager *manager;
   ClutterInputDevice *device;
@@ -274,9 +273,16 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer,
   manager = clutter_device_manager_get_default ();
   device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
 
-  if (is_native)
-    clutter_evdev_set_pointer_constrain_callback (manager, pointer_constrain_callback,
-                                                 pointer, NULL);
+#if defined(CLUTTER_WINDOWING_EGL)
+  /* XXX -- the evdev backend can be used regardless of the
+   * windowing backend. To do this properly we need a Clutter
+   * API to check the input backend. */
+  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL))
+    {
+      clutter_evdev_set_pointer_constrain_callback (manager, pointer_constrain_callback,
+                                                    pointer, NULL);
+    }
+#endif
 
   clutter_input_device_get_coords (device, NULL, &current);
   pointer->x = wl_fixed_from_double (current.x);
diff --git a/src/wayland/meta-wayland-pointer.h b/src/wayland/meta-wayland-pointer.h
index d753d5f..e5ee4c1 100644
--- a/src/wayland/meta-wayland-pointer.h
+++ b/src/wayland/meta-wayland-pointer.h
@@ -67,8 +67,7 @@ struct _MetaWaylandPointer
 };
 
 void
-meta_wayland_pointer_init (MetaWaylandPointer *pointer,
-                          gboolean            is_native);
+meta_wayland_pointer_init (MetaWaylandPointer *pointer);
 
 void
 meta_wayland_pointer_release (MetaWaylandPointer *pointer);
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 83987cb..9e838f9 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -204,8 +204,7 @@ pointer_handle_cursor_surface_destroy (struct wl_listener *listener, void *data)
 }
 
 MetaWaylandSeat *
-meta_wayland_seat_new (struct wl_display *display,
-                      gboolean           is_native)
+meta_wayland_seat_new (struct wl_display *display)
 {
   MetaWaylandSeat *seat = g_new0 (MetaWaylandSeat, 1);
 
@@ -213,9 +212,8 @@ meta_wayland_seat_new (struct wl_display *display,
   wl_list_init (&seat->base_resource_list);
   wl_list_init (&seat->data_device_resource_list);
 
-  meta_wayland_pointer_init (&seat->pointer, is_native);
-
-  meta_wayland_keyboard_init (&seat->keyboard, display, is_native);
+  meta_wayland_pointer_init (&seat->pointer);
+  meta_wayland_keyboard_init (&seat->keyboard, display);
 
   seat->display = display;
 
diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h
index f2c7fc2..cee2ea6 100644
--- a/src/wayland/meta-wayland-seat.h
+++ b/src/wayland/meta-wayland-seat.h
@@ -74,8 +74,7 @@ struct _MetaWaylandSeat
 };
 
 MetaWaylandSeat *
-meta_wayland_seat_new (struct wl_display *display,
-                      gboolean           is_native);
+meta_wayland_seat_new (struct wl_display *display);
 
 void
 meta_wayland_seat_update_pointer (MetaWaylandSeat *seat,
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 254b4d0..16b0156 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -698,7 +698,7 @@ meta_wayland_init (void)
 
   meta_wayland_data_device_manager_init (compositor->wayland_display);
 
-  compositor->seat = meta_wayland_seat_new (compositor->wayland_display, compositor->native);
+  compositor->seat = meta_wayland_seat_new (compositor->wayland_display);
 
   meta_wayland_init_shell (compositor);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]