[mutter/wip/carlosg/input-thread: 160/185] backends/native: Drop meta_seat_native_[gs]et_stage()




commit db4a0bfb82cb89a91767a992c76d12428d0eee40
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jul 31 20:20:43 2020 +0200

    backends/native: Drop meta_seat_native_[gs]et_stage()
    
    This is now unused.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 src/backends/native/meta-seat-native.c | 111 ++-------------------------------
 src/backends/native/meta-seat-native.h |   9 ---
 2 files changed, 4 insertions(+), 116 deletions(-)
---
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index a18754c6be..21fb47ff50 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -1548,34 +1548,22 @@ process_base_event (MetaSeatNative        *seat,
   ClutterInputDevice *device = NULL;
   ClutterEvent *device_event = NULL;
   struct libinput_device *libinput_device;
-  ClutterStage *stage;
-
-  stage = meta_seat_native_get_stage (seat);
 
   switch (libinput_event_get_type (event))
     {
     case LIBINPUT_EVENT_DEVICE_ADDED:
       libinput_device = libinput_event_get_device (event);
       device = evdev_add_device (seat, libinput_device);
-
-      if (stage)
-        {
-          device_event = clutter_event_new (CLUTTER_DEVICE_ADDED);
-          clutter_event_set_device (device_event, device);
-        }
+      device_event = clutter_event_new (CLUTTER_DEVICE_ADDED);
+      clutter_event_set_device (device_event, device);
       break;
 
     case LIBINPUT_EVENT_DEVICE_REMOVED:
       libinput_device = libinput_event_get_device (event);
 
       device = libinput_device_get_user_data (libinput_device);
-
-      if (stage)
-        {
-          device_event = clutter_event_new (CLUTTER_DEVICE_REMOVED);
-          clutter_event_set_device (device_event, device);
-        }
-
+      device_event = clutter_event_new (CLUTTER_DEVICE_REMOVED);
+      clutter_event_set_device (device_event, device);
       evdev_remove_device (seat,
                            META_INPUT_DEVICE_NATIVE (device));
       break;
@@ -2615,15 +2603,6 @@ meta_seat_native_dispose (GObject *object)
 {
   MetaSeatNative *seat = META_SEAT_NATIVE (object);
 
-  g_clear_signal_handler (&seat->stage_added_handler, seat->stage_manager);
-  g_clear_signal_handler (&seat->stage_removed_handler, seat->stage_manager);
-
-  if (seat->stage_manager)
-    {
-      g_object_unref (seat->stage_manager);
-      seat->stage_manager = NULL;
-    }
-
   if (seat->libinput)
     {
       libinput_unref (seat->libinput);
@@ -2932,58 +2911,9 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
                                     "touch-mode");
 }
 
-static void
-meta_seat_native_stage_added_cb (ClutterStageManager *manager,
-                                 ClutterStage        *stage,
-                                 MetaSeatNative      *seat)
-{
-  /* NB: Currently we can only associate a single stage with all evdev
-   * devices.
-   *
-   * We save a pointer to the stage so if we release/reclaim input
-   * devices due to switching virtual terminals then we know what
-   * stage to re associate the devices with.
-   */
-  meta_seat_native_set_stage (seat, stage);
-
-  /* We only want to do this once so we can catch the default
-     stage. If the application has multiple stages then it will need
-     to manage the stage of the input devices itself */
-  g_clear_signal_handler (&seat->stage_added_handler, seat->stage_manager);
-}
-
-static void
-meta_seat_native_stage_removed_cb (ClutterStageManager *manager,
-                                   ClutterStage        *stage,
-                                   MetaSeatNative      *seat)
-{
-  meta_seat_native_set_stage (seat, NULL);
-}
-
 static void
 meta_seat_native_init (MetaSeatNative *seat)
 {
-  seat->stage_manager = clutter_stage_manager_get_default ();
-  g_object_ref (seat->stage_manager);
-
-  /* evdev doesn't have any way to link an event to a particular stage
-     so we'll have to leave it up to applications to set the
-     corresponding stage for an input device. However to make it
-     easier for applications that are only using one fullscreen stage
-     (which is probably the most frequent use-case for the evdev
-     backend) we'll associate any input devices that don't have a
-     stage with the first stage created. */
-  seat->stage_added_handler =
-    g_signal_connect (seat->stage_manager,
-                      "stage-added",
-                      G_CALLBACK (meta_seat_native_stage_added_cb),
-                      seat);
-  seat->stage_removed_handler =
-    g_signal_connect (seat->stage_manager,
-                      "stage-removed",
-                      G_CALLBACK (meta_seat_native_stage_removed_cb),
-                      seat);
-
   seat->device_id_next = INITIAL_DEVICE_ID;
 
   seat->repeat = TRUE;
@@ -2995,39 +2925,6 @@ meta_seat_native_init (MetaSeatNative *seat)
   seat->reserved_virtual_slots = g_hash_table_new (NULL, NULL);
 }
 
-void
-meta_seat_native_set_stage (MetaSeatNative *seat,
-                            ClutterStage   *stage)
-{
-  GSList *l;
-
-  if (seat->stage == stage)
-    return;
-
-  seat->stage = stage;
-
-  for (l = seat->devices; l; l = l->next)
-    {
-      ClutterInputDevice *device = l->data;
-
-      if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_PHYSICAL)
-        {
-          ClutterEvent *device_event;
-
-          device_event = clutter_event_new (CLUTTER_DEVICE_ADDED);
-          clutter_event_set_device (device_event, device);
-          device_event->device.stage = stage;
-          queue_event (seat, device_event);
-        }
-    }
-}
-
-ClutterStage *
-meta_seat_native_get_stage (MetaSeatNative *seat)
-{
-  return seat->stage;
-}
-
 /**
  * meta_seat_native_set_device_callbacks: (skip)
  * @open_callback: the user replacement for open()
diff --git a/src/backends/native/meta-seat-native.h b/src/backends/native/meta-seat-native.h
index 7550dfe5dd..137287d1a1 100644
--- a/src/backends/native/meta-seat-native.h
+++ b/src/backends/native/meta-seat-native.h
@@ -75,11 +75,6 @@ struct _MetaSeatNative
   uint32_t button_state;
   int button_count[KEY_CNT];
 
-  ClutterStage *stage;
-  ClutterStageManager *stage_manager;
-  gulong stage_added_handler;
-  gulong stage_removed_handler;
-
   int device_id_next;
   GList *free_device_ids;
 
@@ -186,10 +181,6 @@ MetaTouchState * meta_seat_native_lookup_touch_state  (MetaSeatNative *seat,
 void meta_seat_native_release_touch_state (MetaSeatNative *seat,
                                            int             seat_slot);
 
-void meta_seat_native_set_stage (MetaSeatNative *seat,
-                                 ClutterStage   *stage);
-ClutterStage * meta_seat_native_get_stage (MetaSeatNative *seat);
-
 void meta_seat_native_clear_repeat_timer (MetaSeatNative *seat);
 
 gint meta_seat_native_acquire_device_id (MetaSeatNative     *seat);


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