[mutter/wip/carlosg/clutter-seat: 19/25] tests: Replace ClutterDeviceManager usage in favor of ClutterSeat



commit 5b8a1a46e12f67179f0d9260cc265555730aa069
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 4 21:57:46 2019 +0200

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

 src/tests/clutter/interactive/test-devices.c | 30 +++++++++++++++-------------
 src/tests/clutter/interactive/test-grab.c    |  6 +++---
 src/tests/clutter/performance/test-common.h  |  5 ++++-
 3 files changed, 23 insertions(+), 18 deletions(-)
---
diff --git a/src/tests/clutter/interactive/test-devices.c b/src/tests/clutter/interactive/test-devices.c
index 28e978992..072c2e730 100644
--- a/src/tests/clutter/interactive/test-devices.c
+++ b/src/tests/clutter/interactive/test-devices.c
@@ -152,9 +152,9 @@ stage_motion_event_cb (ClutterActor   *actor,
 }
 
 static void
-manager_device_added_cb (ClutterDeviceManager *manager,
-                         ClutterInputDevice   *device,
-                         TestDevicesApp       *app)
+seat_device_added_cb (ClutterSeat        *seat,
+                      ClutterInputDevice *device,
+                      TestDevicesApp     *app)
 {
   ClutterInputDeviceType device_type;
   ClutterActor *hand = NULL;
@@ -185,9 +185,9 @@ manager_device_added_cb (ClutterDeviceManager *manager,
 }
 
 static void
-manager_device_removed_cb (ClutterDeviceManager *manager,
-                           ClutterInputDevice   *device,
-                           TestDevicesApp       *app)
+seat_device_removed_cb (ClutterSeat        *seat,
+                        ClutterInputDevice *device,
+                        TestDevicesApp     *app)
 {
   ClutterInputDeviceType device_type;
   ClutterActor *hand = NULL;
@@ -215,8 +215,8 @@ test_devices_main (int argc, char **argv)
 {
   ClutterActor *stage;
   TestDevicesApp *app;
-  ClutterDeviceManager *manager;
-  const GSList *stage_devices, *l;
+  ClutterSeat *seat;
+  GList *stage_devices, *l;
 
   if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
     return 1;
@@ -241,15 +241,15 @@ test_devices_main (int argc, char **argv)
 
   clutter_actor_show_all (stage);
 
-  manager = clutter_device_manager_get_default ();
-  g_signal_connect (manager,
-                    "device-added", G_CALLBACK (manager_device_added_cb),
+  seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
+  g_signal_connect (seat,
+                    "device-added", G_CALLBACK (seat_device_added_cb),
                     app);
-  g_signal_connect (manager,
-                    "device-removed", G_CALLBACK (manager_device_removed_cb),
+  g_signal_connect (seat,
+                    "device-removed", G_CALLBACK (seat_device_removed_cb),
                     app);
 
-  stage_devices = clutter_device_manager_peek_devices (manager);
+  stage_devices = clutter_seat_list_devices (seat);
 
   if (stage_devices == NULL)
     g_error ("No input devices found.");
@@ -285,6 +285,8 @@ test_devices_main (int argc, char **argv)
         }
     }
 
+  g_list_free (stage_devices);
+
   clutter_main ();
 
   return EXIT_SUCCESS;
diff --git a/src/tests/clutter/interactive/test-grab.c b/src/tests/clutter/interactive/test-grab.c
index cb48fe6cf..eabec8778 100644
--- a/src/tests/clutter/interactive/test-grab.c
+++ b/src/tests/clutter/interactive/test-grab.c
@@ -192,9 +192,9 @@ cyan_press_cb (ClutterActor    *actor,
                ClutterEvent    *event,
                gpointer         data)
 {
-  ClutterDeviceManager *dm = clutter_device_manager_get_default ();
-  ClutterInputDevice *device =
-    clutter_device_manager_get_core_device (dm, CLUTTER_KEYBOARD_DEVICE);
+  ClutterBackend *backend = clutter_get_default_backend ();
+  ClutterSeat *seat = clutter_backend_get_default_seat (backend);
+  ClutterInputDevice *device = clutter_seat_get_pointer (seat);
 
   if (clutter_input_device_get_grabbed_actor (device) != NULL)
     clutter_input_device_ungrab (device);
diff --git a/src/tests/clutter/performance/test-common.h b/src/tests/clutter/performance/test-common.h
index aae2b3cd3..693d9188a 100644
--- a/src/tests/clutter/performance/test-common.h
+++ b/src/tests/clutter/performance/test-common.h
@@ -95,7 +95,10 @@ static gboolean perf_fake_mouse_cb (gpointer stage)
                 */
     {
       ClutterEvent *event2 = clutter_event_new (CLUTTER_ENTER);
-      device = clutter_device_manager_get_core_device (clutter_device_manager_get_default (), 
CLUTTER_POINTER_DEVICE);
+      ClutterBackend *backend = clutter_get_default_backend ();
+      ClutterSeat *seat = clutter_backend_get_default_seat (backend);
+
+      device = clutter_seat_get_pointer (seat);
 
       event2->crossing.stage = stage;
       event2->crossing.source = stage;


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