[mutter/wip/carlosg/clutter-seat: 27/35] clutter: Replace ClutterDeviceManager usage in favor of ClutterSeat



commit 984ea8c441c4acb11c0537c51a6435bee9114255
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 4 21:55:30 2019 +0200

    clutter: Replace ClutterDeviceManager usage in favor of ClutterSeat
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/852

 clutter/clutter/clutter-input-method.c |  7 +++----
 clutter/clutter/clutter-main.c         |  7 ++-----
 clutter/clutter/clutter-stage.c        | 16 ++++++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/clutter/clutter/clutter-input-method.c b/clutter/clutter/clutter-input-method.c
index 0fb093122..89d765101 100644
--- a/clutter/clutter/clutter-input-method.c
+++ b/clutter/clutter/clutter-input-method.c
@@ -452,8 +452,8 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
                                   gboolean            press)
 {
   ClutterInputMethodPrivate *priv;
-  ClutterDeviceManager *device_manager;
   ClutterInputDevice *keyboard;
+  ClutterSeat *seat;
   ClutterStage *stage;
   ClutterEvent *event;
 
@@ -463,9 +463,8 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
   if (!priv->focus)
     return;
 
-  device_manager = clutter_device_manager_get_default ();
-  keyboard = clutter_device_manager_get_core_device (device_manager,
-                                                     CLUTTER_KEYBOARD_DEVICE);
+  seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
+  keyboard = clutter_seat_get_keyboard (seat);
   stage = _clutter_input_device_get_stage (keyboard);
   if (stage == NULL)
     return;
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index c4c24cc50..752d87555 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -1838,8 +1838,7 @@ _clutter_process_event_details (ClutterActor        *stage,
                 gfloat x, y;
 
                 clutter_event_get_coords (event, &x, &y);
-                core_pointer = clutter_device_manager_get_core_device (device->device_manager,
-                                                                       CLUTTER_POINTER_DEVICE);
+                core_pointer = clutter_event_get_device (event);
                 _clutter_input_pointer_a11y_on_motion_event (core_pointer, x, y);
               }
           }
@@ -1881,9 +1880,7 @@ _clutter_process_event_details (ClutterActor        *stage,
               {
                 ClutterInputDevice *core_pointer;
 
-                core_pointer = clutter_device_manager_get_core_device (device->device_manager,
-                                                                       CLUTTER_POINTER_DEVICE);
-
+                core_pointer = clutter_event_get_device (event);
                 _clutter_input_pointer_a11y_on_button_event (core_pointer,
                                                              event->button.button,
                                                              event->type == CLUTTER_BUTTON_PRESS);
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 6f92477b3..a0ffaec80 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -1389,21 +1389,23 @@ static GSList *
 _clutter_stage_check_updated_pointers (ClutterStage *stage)
 {
   ClutterStagePrivate *priv = stage->priv;
-  ClutterDeviceManager *device_manager;
+  ClutterBackend *backend;
+  ClutterSeat *seat;
   GSList *updating = NULL;
-  const GSList *devices;
+  GList *l, *devices;
   cairo_rectangle_int_t clip;
   graphene_point_t point;
   gboolean has_clip;
 
   has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);
 
-  device_manager = clutter_device_manager_get_default ();
-  devices = clutter_device_manager_peek_devices (device_manager);
+  backend = clutter_get_default_backend ();
+  seat = clutter_backend_get_default_seat (backend);
+  devices = clutter_seat_list_devices (seat);
 
-  for (; devices != NULL; devices = devices->next)
+  for (l = devices; l; l = l->next)
     {
-      ClutterInputDevice *dev = devices->data;
+      ClutterInputDevice *dev = l->data;
 
       if (clutter_input_device_get_device_mode (dev) !=
           CLUTTER_INPUT_MODE_MASTER)
@@ -1434,6 +1436,8 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
         }
     }
 
+  g_list_free (devices);
+
   return updating;
 }
 


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