[mutter/wip/rstrode/rhel-8.0.0: 48/117] clutter/evdev: Use `clutter_event_set_device()`



commit 53a5c6a14a7f13f901ffa8058dc69ade3b39ed0f
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Mon Nov 19 14:55:51 2018 +0100

    clutter/evdev: Use `clutter_event_set_device()`
    
    Use the relevant clutter device API `clutter_event_set_device()` instead
    of setting the device directly in the event field.

 clutter/clutter/evdev/clutter-device-manager-evdev.c | 3 +--
 clutter/clutter/evdev/clutter-seat-evdev.c           | 4 ----
 clutter/clutter/evdev/clutter-xkb-utils.c            | 2 +-
 clutter/tests/performance/test-common.h              | 4 ++--
 4 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c 
b/clutter/clutter/evdev/clutter-device-manager-evdev.c
index f2aeda696..a885b9027 100644
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
@@ -324,7 +324,6 @@ new_absolute_motion_event (ClutterInputDevice *input_device,
   _clutter_evdev_event_set_time_usec (event, time_us);
   event->motion.time = us2ms (time_us);
   event->motion.stage = stage;
-  event->motion.device = seat->core_pointer;
   _clutter_xkb_translate_state (event, seat->xkb, seat->button_state);
   event->motion.x = x;
   event->motion.y = y;
@@ -332,6 +331,7 @@ new_absolute_motion_event (ClutterInputDevice *input_device,
                                                     &event->motion.x,
                                                     &event->motion.y);
   event->motion.axes = axes;
+  clutter_event_set_device (event, seat->core_pointer);
   clutter_event_set_source_device (event, input_device);
 
   if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
@@ -519,7 +519,6 @@ notify_proximity (ClutterInputDevice *input_device,
 
   event->proximity.time = us2ms (time_us);
   event->proximity.stage = CLUTTER_STAGE (stage);
-  event->proximity.device = seat->core_pointer;
   clutter_event_set_device_tool (event, device_evdev->last_tool);
   clutter_event_set_device (event, seat->core_pointer);
   clutter_event_set_source_device (event, input_device);
diff --git a/clutter/clutter/evdev/clutter-seat-evdev.c b/clutter/clutter/evdev/clutter-seat-evdev.c
index a453b1150..7cba51657 100644
--- a/clutter/clutter/evdev/clutter-seat-evdev.c
+++ b/clutter/clutter/evdev/clutter-seat-evdev.c
@@ -385,7 +385,6 @@ new_absolute_motion_event (ClutterSeatEvdev   *seat,
   _clutter_evdev_event_set_time_usec (event, time_us);
   event->motion.time = us2ms (time_us);
   event->motion.stage = stage;
-  event->motion.device = seat->core_pointer;
   _clutter_xkb_translate_state (event, seat->xkb, seat->button_state);
   event->motion.x = x;
   event->motion.y = y;
@@ -631,7 +630,6 @@ notify_scroll (ClutterInputDevice       *input_device,
   _clutter_evdev_event_set_time_usec (event, time_us);
   event->scroll.time = us2ms (time_us);
   event->scroll.stage = CLUTTER_STAGE (stage);
-  event->scroll.device = seat->core_pointer;
   _clutter_xkb_translate_state (event, seat->xkb, seat->button_state);
 
   /* libinput pointer axis events are in pointer motion coordinate space.
@@ -684,7 +682,6 @@ notify_discrete_scroll (ClutterInputDevice     *input_device,
   _clutter_evdev_event_set_time_usec (event, time_us);
   event->scroll.time = us2ms (time_us);
   event->scroll.stage = CLUTTER_STAGE (stage);
-  event->scroll.device = seat->core_pointer;
   _clutter_xkb_translate_state (event, seat->xkb, seat->button_state);
 
   event->scroll.direction = direction;
@@ -813,7 +810,6 @@ clutter_seat_evdev_notify_touch_event (ClutterSeatEvdev   *seat,
   _clutter_evdev_event_set_time_usec (event, time_us);
   event->touch.time = us2ms (time_us);
   event->touch.stage = CLUTTER_STAGE (stage);
-  event->touch.device = seat->core_pointer;
   event->touch.x = x;
   event->touch.y = y;
   clutter_input_device_evdev_translate_coordinates (input_device, stage,
diff --git a/clutter/clutter/evdev/clutter-xkb-utils.c b/clutter/clutter/evdev/clutter-xkb-utils.c
index 7f47682d1..0a9a8387b 100644
--- a/clutter/clutter/evdev/clutter-xkb-utils.c
+++ b/clutter/clutter/evdev/clutter-xkb-utils.c
@@ -76,12 +76,12 @@ _clutter_key_event_new_from_evdev (ClutterInputDevice *device,
   else
     sym = XKB_KEY_NoSymbol;
 
-  event->key.device = core_device;
   event->key.stage = stage;
   event->key.time = _time;
   _clutter_xkb_translate_state (event, xkb_state, button_state);
   event->key.hardware_keycode = key;
   event->key.keyval = sym;
+  clutter_event_set_device (event, core_device);
   clutter_event_set_source_device (event, device);
 
   n = xkb_keysym_to_utf8 (sym, buffer, sizeof (buffer));
diff --git a/clutter/tests/performance/test-common.h b/clutter/tests/performance/test-common.h
index b0bed1082..919fa743d 100644
--- a/clutter/tests/performance/test-common.h
+++ b/clutter/tests/performance/test-common.h
@@ -92,9 +92,9 @@ static gboolean perf_fake_mouse_cb (gpointer stage)
       event2->crossing.source = stage;
       event2->crossing.x = 10;
       event2->crossing.y = 10;
-      event2->crossing.device = device;
       event2->crossing.related = NULL;
 
+      clutter_event_set_device (event2, device);
       clutter_input_device_update_from_event (device, event2, TRUE);
 
       clutter_event_put (event2);
@@ -104,7 +104,7 @@ static gboolean perf_fake_mouse_cb (gpointer stage)
 
   clutter_actor_get_size (stage, &w, &h);
   event->motion.stage = stage;
-  event->motion.device = device;
+  clutter_event_set_device (event, device);
 
   /* called about every 60fps, and do 10 picks per stage */
   for (i = 0; i < 10; i++)


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