[gtk+/wip/matthiasc/kill-device-manager: 25/26] wayland: Drop GdkWaylandDeviceManager



commit 24915abeb8cef42e7e55e59bcff602b4fac6f176
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 25 08:12:48 2017 -0500

    wayland: Drop GdkWaylandDeviceManager
    
    This object had no functionality left.

 gdk/wayland/gdkdevice-wayland.c  |  157 ++------------------------------------
 gdk/wayland/gdkdisplay-wayland.c |    9 +--
 gdk/wayland/gdkdisplay-wayland.h |    2 -
 gdk/wayland/gdkprivate-wayland.h |   15 +---
 gdk/wayland/gdkwaylanddevice.h   |    2 -
 5 files changed, 15 insertions(+), 170 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 2058116..58af1f3 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -191,7 +191,6 @@ struct _GdkWaylandSeat
   struct zwp_tablet_seat_v2 *wp_tablet_seat;
 
   GdkDisplay *display;
-  GdkWaylandDeviceManager *device_manager;
 
   GdkDevice *master_pointer;
   GdkDevice *master_keyboard;
@@ -281,38 +280,14 @@ G_DEFINE_TYPE_WITH_CODE (GdkWaylandDevicePad, gdk_wayland_device_pad,
                          G_IMPLEMENT_INTERFACE (GDK_TYPE_DEVICE_PAD,
                                                 gdk_wayland_device_pad_iface_init))
 
-#define GDK_TYPE_WAYLAND_DEVICE_MANAGER        (gdk_wayland_device_manager_get_type ())
-#define GDK_WAYLAND_DEVICE_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), 
GDK_TYPE_WAYLAND_DEVICE_MANAGER, GdkWaylandDeviceManager))
-#define GDK_WAYLAND_DEVICE_MANAGER_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), 
GDK_TYPE_WAYLAND_DEVICE_MANAGER, GdkWaylandDeviceManagerClass))
-#define GDK_IS_WAYLAND_DEVICE_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
GDK_TYPE_WAYLAND_DEVICE_MANAGER))
-#define GDK_IS_WAYLAND_DEVICE_MANAGER_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), 
GDK_TYPE_WAYLAND_DEVICE_MANAGER))
-#define GDK_WAYLAND_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), 
GDK_TYPE_WAYLAND_DEVICE_MANAGER, GdkWaylandDeviceManagerClass))
-
 #define GDK_SLOT_TO_EVENT_SEQUENCE(s) ((GdkEventSequence *) GUINT_TO_POINTER((s) + 1))
 #define GDK_EVENT_SEQUENCE_TO_SLOT(s) (GPOINTER_TO_UINT(s) - 1)
 
-typedef struct _GdkWaylandDeviceManager GdkWaylandDeviceManager;
-typedef struct _GdkWaylandDeviceManagerClass GdkWaylandDeviceManagerClass;
-
-struct _GdkWaylandDeviceManager
-{
-  GObject parent_instance;
-  GList *devices;
-};
-
-struct _GdkWaylandDeviceManagerClass
-{
-  GObjectClass parent_class;
-};
-
 static void deliver_key_event (GdkWaylandSeat       *seat,
                                uint32_t              time_,
                                uint32_t              key,
                                uint32_t              state,
                                gboolean              from_key_repeat);
-GType gdk_wayland_device_manager_get_type (void);
-
-G_DEFINE_TYPE (GdkWaylandDeviceManager, gdk_wayland_device_manager, G_TYPE_OBJECT)
 
 static gboolean
 gdk_wayland_device_get_history (GdkDevice      *device,
@@ -2758,19 +2733,10 @@ static void
 _gdk_wayland_seat_remove_tablet (GdkWaylandSeat       *seat,
                                  GdkWaylandTabletData *tablet)
 {
-  GdkWaylandDeviceManager *device_manager = seat->device_manager;
-
   seat->tablets = g_list_remove (seat->tablets, tablet);
 
   zwp_tablet_v2_destroy (tablet->wp_tablet);
 
-  device_manager->devices =
-    g_list_remove (device_manager->devices, tablet->master);
-  device_manager->devices =
-    g_list_remove (device_manager->devices, tablet->stylus_device);
-  device_manager->devices =
-    g_list_remove (device_manager->devices, tablet->eraser_device);
-
   _gdk_device_set_associated_device (tablet->master, NULL);
   _gdk_device_set_associated_device (tablet->stylus_device, NULL);
   _gdk_device_set_associated_device (tablet->eraser_device, NULL);
@@ -2792,13 +2758,8 @@ static void
 _gdk_wayland_seat_remove_tablet_pad (GdkWaylandSeat          *seat,
                                      GdkWaylandTabletPadData *pad)
 {
-  GdkWaylandDeviceManager *device_manager = seat->device_manager;
-
   seat->tablet_pads = g_list_remove (seat->tablet_pads, pad);
 
-  device_manager->devices =
-    g_list_remove (device_manager->devices, pad->device);
-
   _gdk_device_set_associated_device (pad->device, NULL);
 
   g_object_unref (pad->device);
@@ -2862,7 +2823,6 @@ tablet_handle_done (void                 *data,
   GdkWaylandTabletData *tablet = data;
   GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
   GdkDisplay *display = gdk_seat_get_display (GDK_SEAT (seat));
-  GdkWaylandDeviceManager *device_manager = seat->device_manager;
   GdkDevice *master, *stylus_device, *eraser_device;
   gchar *master_name, *eraser_name;
   gchar *vid, *pid;
@@ -2909,16 +2869,8 @@ tablet_handle_done (void                 *data,
                                 NULL);
 
   tablet->master = master;
-  device_manager->devices =
-    g_list_prepend (device_manager->devices, tablet->master);
-
   tablet->stylus_device = stylus_device;
-  device_manager->devices =
-    g_list_prepend (device_manager->devices, tablet->stylus_device);
-
   tablet->eraser_device = eraser_device;
-  device_manager->devices =
-    g_list_prepend (device_manager->devices, tablet->eraser_device);
 
   _gdk_device_set_associated_device (master, seat->master_keyboard);
   _gdk_device_set_associated_device (stylus_device, master);
@@ -2994,7 +2946,6 @@ seat_handle_capabilities (void                    *data,
                           enum wl_seat_capability  caps)
 {
   GdkWaylandSeat *seat = data;
-  GdkWaylandDeviceManager *device_manager = seat->device_manager;
   GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
 
   GDK_NOTE (MISC,
@@ -3020,9 +2971,6 @@ seat_handle_capabilities (void                    *data,
                                     NULL);
       _gdk_device_set_associated_device (seat->pointer, seat->master_pointer);
 
-      device_manager->devices =
-        g_list_prepend (device_manager->devices, seat->pointer);
-
       if (display_wayland->pointer_gestures)
         {
           seat->wp_pointer_gesture_swipe =
@@ -3048,18 +2996,12 @@ seat_handle_capabilities (void                    *data,
       seat->wl_pointer = NULL;
       _gdk_device_set_associated_device (seat->pointer, NULL);
 
-      device_manager->devices =
-        g_list_remove (device_manager->devices, seat->pointer);
-
       g_clear_object (&seat->pointer);
 
       if (seat->wheel_scrolling)
         {
           _gdk_device_set_associated_device (seat->wheel_scrolling, NULL);
 
-          device_manager->devices =
-            g_list_remove (device_manager->devices, seat->wheel_scrolling);
-
           g_clear_object (&seat->wheel_scrolling);
         }
 
@@ -3067,9 +3009,6 @@ seat_handle_capabilities (void                    *data,
         {
           _gdk_device_set_associated_device (seat->finger_scrolling, NULL);
 
-          device_manager->devices =
-            g_list_remove (device_manager->devices, seat->finger_scrolling);
-
           g_clear_object (&seat->finger_scrolling);
         }
 
@@ -3077,9 +3016,6 @@ seat_handle_capabilities (void                    *data,
         {
           _gdk_device_set_associated_device (seat->continuous_scrolling, NULL);
 
-          device_manager->devices =
-            g_list_remove (device_manager->devices, seat->continuous_scrolling);
-
           g_clear_object (&seat->continuous_scrolling);
         }
     }
@@ -3101,9 +3037,6 @@ seat_handle_capabilities (void                    *data,
                                      NULL);
       _gdk_device_reset_axes (seat->keyboard);
       _gdk_device_set_associated_device (seat->keyboard, seat->master_keyboard);
-
-      device_manager->devices =
-        g_list_prepend (device_manager->devices, seat->keyboard);
     }
   else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && seat->wl_keyboard)
     {
@@ -3111,9 +3044,6 @@ seat_handle_capabilities (void                    *data,
       seat->wl_keyboard = NULL;
       _gdk_device_set_associated_device (seat->keyboard, NULL);
 
-      device_manager->devices =
-        g_list_remove (device_manager->devices, seat->keyboard);
-
       g_clear_object (&seat->keyboard);
     }
 
@@ -3135,9 +3065,6 @@ seat_handle_capabilities (void                    *data,
       GDK_WAYLAND_DEVICE (seat->touch_master)->pointer = &seat->touch_info;
       _gdk_device_set_associated_device (seat->touch_master, seat->master_keyboard);
 
-      device_manager->devices =
-        g_list_prepend (device_manager->devices, seat->touch_master);
-
       seat->touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
                                   "name", "Wayland Touch",
                                   "type", GDK_DEVICE_TYPE_SLAVE,
@@ -3148,9 +3075,6 @@ seat_handle_capabilities (void                    *data,
                                   "seat", seat,
                                   NULL);
       _gdk_device_set_associated_device (seat->touch, seat->touch_master);
-
-      device_manager->devices =
-        g_list_prepend (device_manager->devices, seat->touch);
     }
   else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && seat->wl_touch)
     {
@@ -3159,11 +3083,6 @@ seat_handle_capabilities (void                    *data,
       _gdk_device_set_associated_device (seat->touch_master, NULL);
       _gdk_device_set_associated_device (seat->touch, NULL);
 
-      device_manager->devices =
-        g_list_remove (device_manager->devices, seat->touch_master);
-      device_manager->devices =
-        g_list_remove (device_manager->devices, seat->touch);
-
       g_clear_object (&seat->touch_master);
       g_clear_object (&seat->touch);
     }
@@ -3178,8 +3097,6 @@ static GdkDevice *
 get_scroll_device (GdkWaylandSeat              *seat,
                    enum wl_pointer_axis_source  source)
 {
-  GdkWaylandDeviceManager *device_manager = seat->device_manager;
-
   if (!seat->pointer)
     return NULL;
 
@@ -3198,9 +3115,6 @@ get_scroll_device (GdkWaylandSeat              *seat,
                                                 "seat", seat,
                                                 NULL);
           _gdk_device_set_associated_device (seat->wheel_scrolling, seat->master_pointer);
-
-          device_manager->devices =
-            g_list_append (device_manager->devices, seat->wheel_scrolling);
         }
       return seat->wheel_scrolling;
 
@@ -3217,9 +3131,6 @@ get_scroll_device (GdkWaylandSeat              *seat,
                                                  "seat", seat,
                                                  NULL);
           _gdk_device_set_associated_device (seat->finger_scrolling, seat->master_pointer);
-
-          device_manager->devices =
-            g_list_append (device_manager->devices, seat->finger_scrolling);
         }
       return seat->finger_scrolling;
 
@@ -3236,9 +3147,6 @@ get_scroll_device (GdkWaylandSeat              *seat,
                                                      "seat", seat,
                                                      NULL);
           _gdk_device_set_associated_device (seat->continuous_scrolling, seat->master_pointer);
-
-          device_manager->devices =
-            g_list_append (device_manager->devices, seat->continuous_scrolling);
         }
       return seat->continuous_scrolling;
 
@@ -4414,8 +4322,6 @@ static const struct zwp_tablet_seat_v2_listener tablet_seat_listener = {
 static void
 init_devices (GdkWaylandSeat *seat)
 {
-  GdkWaylandDeviceManager *device_manager = seat->device_manager;
-
   /* pointer */
   seat->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
                                        "name", "Core Pointer",
@@ -4429,9 +4335,6 @@ init_devices (GdkWaylandSeat *seat)
 
   GDK_WAYLAND_DEVICE (seat->master_pointer)->pointer = &seat->pointer_info;
 
-  device_manager->devices =
-    g_list_prepend (device_manager->devices, seat->master_pointer);
-
   /* keyboard */
   seat->master_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
                                         "name", "Core Keyboard",
@@ -4444,9 +4347,6 @@ init_devices (GdkWaylandSeat *seat)
                                         NULL);
   _gdk_device_reset_axes (seat->master_keyboard);
 
-  device_manager->devices =
-    g_list_prepend (device_manager->devices, seat->master_keyboard);
-
   /* link both */
   _gdk_device_set_associated_device (seat->master_pointer, seat->master_keyboard);
   _gdk_device_set_associated_device (seat->master_keyboard, seat->master_pointer);
@@ -4874,23 +4774,19 @@ gdk_wayland_seat_init (GdkWaylandSeat *seat)
 }
 
 void
-_gdk_wayland_device_manager_add_seat (GdkWaylandDeviceManager *device_manager,
-                                      GdkDisplay              *display,
-                                      guint32                  id,
-                                     struct wl_seat          *wl_seat)
+_gdk_wayland_display_create_seat (GdkWaylandDisplay *display_wayland,
+                                  guint32            id,
+                                 struct wl_seat    *wl_seat)
 {
-  GdkWaylandDisplay *display_wayland;
+  GdkDisplay *display = GDK_DISPLAY (display_wayland);
   GdkWaylandSeat *seat;
 
-  display_wayland = GDK_WAYLAND_DISPLAY (display);
-
   seat = g_object_new (GDK_TYPE_WAYLAND_SEAT,
-                       "display", display,
+                       "display", display_wayland,
                        NULL);
   seat->id = id;
   seat->keymap = _gdk_wayland_keymap_new ();
   seat->display = display;
-  seat->device_manager = device_manager;
   seat->touches = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_free);
   seat->foreign_dnd_window = create_foreign_dnd_window (display);
   seat->wl_seat = wl_seat;
@@ -4939,10 +4835,10 @@ _gdk_wayland_device_manager_add_seat (GdkWaylandDeviceManager *device_manager,
 }
 
 void
-_gdk_wayland_device_manager_remove_seat (GdkWaylandDeviceManager *manager,
-                                         GdkDisplay              *display,
-                                         guint32                  id)
+_gdk_wayland_display_remove_seat (GdkWaylandDisplay *display_wayland,
+                                  guint32            id)
 {
+  GdkDisplay *display = GDK_DISPLAY (display_wayland);
   GList *l, *seats;
 
   seats = gdk_display_list_seats (display);
@@ -4961,43 +4857,6 @@ _gdk_wayland_device_manager_remove_seat (GdkWaylandDeviceManager *manager,
   g_list_free (seats);
 }
 
-static void
-free_device (gpointer data)
-{
-  g_object_unref (data);
-}
-
-static void
-gdk_wayland_device_manager_finalize (GObject *object)
-{
-  GdkWaylandDeviceManager *device_manager;
-
-  device_manager = GDK_WAYLAND_DEVICE_MANAGER (object);
-
-  g_list_free_full (device_manager->devices, free_device);
-
-  G_OBJECT_CLASS (gdk_wayland_device_manager_parent_class)->finalize (object);
-}
-
-static void
-gdk_wayland_device_manager_class_init (GdkWaylandDeviceManagerClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  object_class->finalize = gdk_wayland_device_manager_finalize;
-}
-
-static void
-gdk_wayland_device_manager_init (GdkWaylandDeviceManager *device_manager)
-{
-}
-
-GdkWaylandDeviceManager *
-_gdk_wayland_device_manager_new (GdkDisplay *display)
-{
-  return g_object_new (GDK_TYPE_WAYLAND_DEVICE_MANAGER, NULL);
-}
-
 uint32_t
 _gdk_wayland_device_get_implicit_grab_serial (GdkWaylandDevice *device,
                                               const GdkEvent   *event)
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 16d6e96..453d403 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -224,9 +224,7 @@ _gdk_wayland_display_add_seat (GdkWaylandDisplay *display_wayland,
   seat = wl_registry_bind (display_wayland->wl_registry,
                            id, &wl_seat_interface,
                            display_wayland->seat_version);
-  _gdk_wayland_device_manager_add_seat (display_wayland->device_manager,
-                                        GDK_DISPLAY (display_wayland),
-                                        id, seat);
+  _gdk_wayland_display_create_seat (display_wayland, id, seat);
   _gdk_wayland_display_async_roundtrip (display_wayland);
 }
 
@@ -527,9 +525,7 @@ gdk_registry_handle_global_remove (void               *data,
   GdkWaylandDisplay *display_wayland = data;
 
   GDK_NOTE (MISC, g_message ("remove global %u", id));
-  _gdk_wayland_device_manager_remove_seat (display_wayland->device_manager,
-                                           GDK_DISPLAY (display_wayland),
-                                           id);
+  _gdk_wayland_display_remove_seat (display_wayland, id);
   gdk_wayland_display_remove_output (display_wayland, id);
 
   g_hash_table_remove (display_wayland->known_globals, GUINT_TO_POINTER (id));
@@ -597,7 +593,6 @@ _gdk_wayland_display_open (const gchar *display_name)
 
   display = g_object_new (GDK_TYPE_WAYLAND_DISPLAY, NULL);
   display_wayland = GDK_WAYLAND_DISPLAY (display);
-  display_wayland->device_manager = _gdk_wayland_device_manager_new (display);
   display_wayland->wl_display = wl_display;
   display_wayland->event_source = _gdk_wayland_display_event_source_new (display);
 
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index d972c32..ec1d486 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -68,8 +68,6 @@ struct _GdkWaylandDisplay
   GdkDisplay parent_instance;
   GList *toplevels;
 
-  GdkWaylandDeviceManager *device_manager;
-
   GHashTable *settings;
   GsdXftSettings xft_settings;
 
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 87d5901..0a21c89 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -40,8 +40,6 @@
 #include "gdkinternals.h"
 #include "wayland/gtk-primary-selection-client-protocol.h"
 
-typedef struct _GdkWaylandDeviceManager GdkWaylandDeviceManager;
-
 #define WL_SURFACE_HAS_BUFFER_SCALE 3
 #define WL_POINTER_HAS_FRAME 5
 
@@ -171,14 +169,11 @@ gint        _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay    *disp
 gchar *     _gdk_wayland_display_utf8_to_string_target (GdkDisplay  *display,
                                                        const gchar *str);
 
-GdkWaylandDeviceManager *_gdk_wayland_device_manager_new         (GdkDisplay              *display);
-void                     _gdk_wayland_device_manager_add_seat    (GdkWaylandDeviceManager *device_manager,
-                                                                  GdkDisplay              *display,
-                                                                  guint32                  id,
-                                                                  struct wl_seat          *seat);
-void                    _gdk_wayland_device_manager_remove_seat  (GdkWaylandDeviceManager *device_manager,
-                                                                  GdkDisplay              *display,
-                                                                  guint32                  id);
+void        _gdk_wayland_display_create_seat    (GdkWaylandDisplay *display,
+                                                 guint32                  id,
+                                                 struct wl_seat          *seat);
+void        _gdk_wayland_display_remove_seat    (GdkWaylandDisplay       *display,
+                                                 guint32                  id);
 
 GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
 uint32_t _gdk_wayland_device_get_implicit_grab_serial(GdkWaylandDevice *device,
diff --git a/gdk/wayland/gdkwaylanddevice.h b/gdk/wayland/gdkwaylanddevice.h
index 6ba4313..e7a3b9a 100644
--- a/gdk/wayland/gdkwaylanddevice.h
+++ b/gdk/wayland/gdkwaylanddevice.h
@@ -42,8 +42,6 @@ typedef struct _GdkWaylandDeviceClass GdkWaylandDeviceClass;
 #define GDK_IS_WAYLAND_DEVICE_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_WAYLAND_DEVICE))
 #define GDK_WAYLAND_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_WAYLAND_DEVICE, 
GdkWaylandDeviceClass))
 
-typedef struct _GdkWaylandDeviceManager GdkWaylandDeviceManager;
-
 GDK_AVAILABLE_IN_ALL
 GType                gdk_wayland_device_get_type            (void);
 


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