[mutter/wip/carlosg/input-refactors-pt1: 19/23] clutter: Drop clutter_input_device_set_stage()




commit 22eb7aaa5b964d17671893317bd3e8cc5ac67a02
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 5 17:58:29 2020 +0200

    clutter: Drop clutter_input_device_set_stage()
    
    Also drop the stage argument from clutter_input_device_set_coords()
    in consequence. No one uses this already.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1486

 clutter/clutter/clutter-input-device-private.h | 12 +-----
 clutter/clutter/clutter-input-device.c         | 56 ++++----------------------
 clutter/clutter/clutter-stage.c                |  2 +-
 src/backends/native/meta-seat-native.c         |  3 +-
 src/tests/clutter/performance/test-common.h    |  2 +-
 5 files changed, 13 insertions(+), 62 deletions(-)
---
diff --git a/clutter/clutter/clutter-input-device-private.h b/clutter/clutter/clutter-input-device-private.h
index 138e12bada..8011a90e2a 100644
--- a/clutter/clutter/clutter-input-device-private.h
+++ b/clutter/clutter/clutter-input-device-private.h
@@ -120,9 +120,6 @@ struct _ClutterInputDevice
   /* the current click count */
   int click_count;
 
-  /* the stage the device is on */
-  ClutterStage *stage;
-
   /* the current state */
   float current_x;
   float current_y;
@@ -178,14 +175,10 @@ CLUTTER_EXPORT
 void clutter_input_device_update_from_tool (ClutterInputDevice     *device,
                                             ClutterInputDeviceTool *tool);
 CLUTTER_EXPORT
-void _clutter_input_device_set_stage (ClutterInputDevice *device,
-                                      ClutterStage       *stage);
-CLUTTER_EXPORT
 void _clutter_input_device_set_coords (ClutterInputDevice   *device,
                                        ClutterEventSequence *sequence,
                                        gfloat                x,
-                                       gfloat                y,
-                                       ClutterStage         *stage);
+                                       gfloat                y);
 CLUTTER_EXPORT
 void _clutter_input_device_set_state (ClutterInputDevice  *device,
                                       ClutterModifierType  state);
@@ -258,8 +251,7 @@ ClutterInputDeviceTool *
 
 CLUTTER_EXPORT
 void clutter_input_device_update_from_event (ClutterInputDevice  *device,
-                                             ClutterEvent        *event,
-                                             gboolean             update_stage);
+                                             ClutterEvent        *event);
 CLUTTER_EXPORT
 gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
                                                 guint               hardware_keycode,
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
index 92448295b7..fe46adfb91 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -525,8 +525,7 @@ clutter_input_device_init (ClutterInputDevice *self)
 
 static ClutterTouchInfo *
 _clutter_input_device_ensure_touch_info (ClutterInputDevice *device,
-                                         ClutterEventSequence *sequence,
-                                         ClutterStage *stage)
+                                         ClutterEventSequence *sequence)
 {
   ClutterTouchInfo *info;
 
@@ -537,9 +536,6 @@ _clutter_input_device_ensure_touch_info (ClutterInputDevice *device,
       info = g_slice_new0 (ClutterTouchInfo);
       info->sequence = sequence;
       g_hash_table_insert (device->touch_sequences_info, sequence, info);
-
-      if (g_hash_table_size (device->touch_sequences_info) == 1)
-        _clutter_input_device_set_stage (device, stage);
     }
 
   return info;
@@ -558,8 +554,7 @@ void
 _clutter_input_device_set_coords (ClutterInputDevice   *device,
                                   ClutterEventSequence *sequence,
                                   gfloat                x,
-                                  gfloat                y,
-                                  ClutterStage         *stage)
+                                  gfloat                y)
 {
   g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
 
@@ -574,7 +569,7 @@ _clutter_input_device_set_coords (ClutterInputDevice   *device,
   else
     {
       ClutterTouchInfo *info;
-      info = _clutter_input_device_ensure_touch_info (device, sequence, stage);
+      info = _clutter_input_device_ensure_touch_info (device, sequence);
       info->current_x = x;
       info->current_y = y;
     }
@@ -632,29 +627,6 @@ _clutter_input_device_set_time (ClutterInputDevice *device,
     device->current_time = time_;
 }
 
-/*< private >
- * clutter_input_device_set_stage:
- * @device: a #ClutterInputDevice
- * @stage: a #ClutterStage or %NULL
- *
- * Stores the stage under the device
- */
-void
-_clutter_input_device_set_stage (ClutterInputDevice *device,
-                                 ClutterStage       *stage)
-{
-  if (device->stage == stage)
-    return;
-
-  device->stage = stage;
-
-  /* we leave the ->cursor_actor in place in order to check
-   * if we left the stage without crossing it again; this way
-   * we can emit a leave event on the cursor actor right before
-   * we emit the leave event on the stage.
-   */
-}
-
 static void
 _clutter_input_device_free_touch_info (gpointer data)
 {
@@ -673,9 +645,8 @@ _clutter_input_device_associate_actor (ClutterInputDevice   *device,
       GList *sequences =
         g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
       ClutterTouchInfo *info;
-      ClutterStage *stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
 
-      info = _clutter_input_device_ensure_touch_info (device, sequence, stage);
+      info = _clutter_input_device_ensure_touch_info (device, sequence);
       info->actor = actor;
 
       g_hash_table_insert (device->inv_touch_sequence_actors,
@@ -1170,7 +1141,7 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
  *   device = clutter_seat_get_pointer (seat);
  *
  *   // update the state of the input device
- *   clutter_input_device_update_from_event (device, &c_event, FALSE);
+ *   clutter_input_device_update_from_event (device, &c_event);
  *
  *   clutter_do_event (&c_event);
  * ]|
@@ -1183,12 +1154,10 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
  */
 void
 clutter_input_device_update_from_event (ClutterInputDevice *device,
-                                        ClutterEvent       *event,
-                                        gboolean            update_stage)
+                                        ClutterEvent       *event)
 {
   ClutterModifierType event_state;
   ClutterEventSequence *sequence;
-  ClutterStage *event_stage;
   gfloat event_x, event_y;
   guint32 event_time;
 
@@ -1197,16 +1166,12 @@ clutter_input_device_update_from_event (ClutterInputDevice *device,
 
   event_state = clutter_event_get_state (event);
   event_time = clutter_event_get_time (event);
-  event_stage = clutter_event_get_stage (event);
   sequence = clutter_event_get_event_sequence (event);
   clutter_event_get_coords (event, &event_x, &event_y);
 
-  _clutter_input_device_set_coords (device, sequence, event_x, event_y, event_stage);
+  _clutter_input_device_set_coords (device, sequence, event_x, event_y);
   _clutter_input_device_set_state (device, event_state);
   _clutter_input_device_set_time (device, event_time);
-
-  if (update_stage)
-    _clutter_input_device_set_stage (device, event_stage);
 }
 
 /*< private >
@@ -1602,16 +1567,11 @@ _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
                                           ClutterEvent       *event)
 {
   ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
-  ClutterStage *stage;
 
   if (sequence == NULL)
     return;
 
-  stage = clutter_event_get_stage (event);
-  if (stage == NULL)
-    return;
-
-  _clutter_input_device_ensure_touch_info (device, sequence, stage);
+  _clutter_input_device_ensure_touch_info (device, sequence);
 }
 
 /*< private >
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index dc7b3f6099..4774180876 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -957,7 +957,7 @@ _clutter_stage_queue_event (ClutterStage *stage,
 
       clutter_event_get_coords (event, &event_x, &event_y);
 
-      _clutter_input_device_set_coords (device, sequence, event_x, event_y, stage);
+      _clutter_input_device_set_coords (device, sequence, event_x, event_y);
       _clutter_input_device_set_time (device, event_time);
     }
 
diff --git a/src/backends/native/meta-seat-native.c b/src/backends/native/meta-seat-native.c
index 0295120ab3..411636f32f 100644
--- a/src/backends/native/meta-seat-native.c
+++ b/src/backends/native/meta-seat-native.c
@@ -2502,8 +2502,7 @@ meta_seat_native_constructed (GObject *object)
   seat->pointer_x = INITIAL_POINTER_X;
   seat->pointer_y = INITIAL_POINTER_Y;
   _clutter_input_device_set_coords (device, NULL,
-                                    seat->pointer_x, seat->pointer_y,
-                                    NULL);
+                                    seat->pointer_x, seat->pointer_y);
   seat->core_pointer = device;
 
   device = meta_input_device_native_new_virtual (
diff --git a/src/tests/clutter/performance/test-common.h b/src/tests/clutter/performance/test-common.h
index 10dd8fed8c..32b13d7fa4 100644
--- a/src/tests/clutter/performance/test-common.h
+++ b/src/tests/clutter/performance/test-common.h
@@ -110,7 +110,7 @@ static gboolean perf_fake_mouse_cb (gpointer stage)
       event2->crossing.related = NULL;
 
       clutter_event_set_device (event2, device);
-      clutter_input_device_update_from_event (device, event2, TRUE);
+      clutter_input_device_update_from_event (device, event2);
 
       clutter_event_put (event2);
       clutter_event_free (event2);


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