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



commit c8a7e345f3067fc6b38e7fa2c5881fd5fb47504c
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 c9644eb25..bc33eee95 100644
--- a/src/tests/clutter/interactive/test-devices.c
+++ b/src/tests/clutter/interactive/test-devices.c
@@ -150,9 +150,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;
@@ -183,9 +183,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;
@@ -213,8 +213,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;
@@ -239,15 +239,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.");
@@ -283,6 +283,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 8c07389aa..e15caa349 100644
--- a/src/tests/clutter/performance/test-common.h
+++ b/src/tests/clutter/performance/test-common.h
@@ -90,7 +90,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]