[mutter/wip/carlosg/grabs-pt2: 25/32] clutter: Drop clutter_stage_[gs]et_motion_events_enabled()




commit f7e5e31b20cb2010ac0e14273ffe0ecbc911e3cd
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 4 17:01:33 2021 +0100

    clutter: Drop clutter_stage_[gs]et_motion_events_enabled()
    
    This is (luckily!) unused, and it's inconvenient to have a toggle to
    break the input model we are striving towards. Drop this function
    and stick to the default behavior.

 clutter/clutter/clutter-main.c              | 62 ---------------------------
 clutter/clutter/clutter-stage.c             | 66 -----------------------------
 clutter/clutter/clutter-stage.h             |  5 ---
 src/tests/clutter/interactive/test-events.c | 40 +----------------
 src/tests/clutter/interactive/test-grab.c   | 32 --------------
 5 files changed, 2 insertions(+), 203 deletions(-)
---
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 98f64eeb6e..156a1f498a 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -1011,33 +1011,6 @@ _clutter_process_event_details (ClutterActor        *stage,
                 _clutter_input_pointer_a11y_on_motion_event (device, x, y);
               }
           }
-        /* only the stage gets motion events if they are enabled */
-        if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
-            event->any.source == NULL)
-          {
-            /* Only stage gets motion events */
-            event->any.source = stage;
-
-            if (_clutter_event_process_filters (event))
-              break;
-
-            if (device != NULL && device->pointer_grab_actor != NULL)
-              {
-                clutter_actor_event (device->pointer_grab_actor,
-                                     event,
-                                     FALSE);
-                break;
-              }
-
-            /* Trigger handlers on stage in both capture .. */
-            if (!clutter_actor_event (stage, event, TRUE))
-              {
-                /* and bubbling phase */
-                clutter_actor_event (stage, event, FALSE);
-              }
-            break;
-          }
-
         G_GNUC_FALLTHROUGH;
       case CLUTTER_BUTTON_PRESS:
       case CLUTTER_BUTTON_RELEASE:
@@ -1128,41 +1101,6 @@ _clutter_process_event_details (ClutterActor        *stage,
         }
 
       case CLUTTER_TOUCH_UPDATE:
-        /* only the stage gets motion events if they are enabled */
-        if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
-            event->any.source == NULL)
-          {
-            ClutterActor *grab_actor = NULL;
-
-            /* Only stage gets motion events */
-            event->any.source = stage;
-
-            if (_clutter_event_process_filters (event))
-              break;
-
-            /* global grabs */
-            if (device->sequence_grab_actors != NULL)
-              {
-                grab_actor = g_hash_table_lookup (device->sequence_grab_actors,
-                                                  event->touch.sequence);
-              }
-
-            if (grab_actor != NULL)
-              {
-                clutter_actor_event (grab_actor, event, FALSE);
-                break;
-              }
-
-            /* Trigger handlers on stage in both capture .. */
-            if (!clutter_actor_event (stage, event, TRUE))
-              {
-                /* and bubbling phase */
-                clutter_actor_event (stage, event, FALSE);
-              }
-            break;
-          }
-
-        G_GNUC_FALLTHROUGH;
       case CLUTTER_TOUCH_BEGIN:
       case CLUTTER_TOUCH_CANCEL:
       case CLUTTER_TOUCH_END:
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 6ebcddbe30..2fcad5082e 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -133,7 +133,6 @@ struct _ClutterStagePrivate
   GHashTable *touch_sequences;
 
   guint throttle_motion_events : 1;
-  guint motion_events_enabled  : 1;
   guint actor_needs_immediate_relayout : 1;
 };
 
@@ -1558,7 +1557,6 @@ clutter_stage_init (ClutterStage *self)
   priv->event_queue = g_queue_new ();
 
   priv->throttle_motion_events = TRUE;
-  priv->motion_events_enabled = TRUE;
 
   priv->pointer_devices =
     g_hash_table_new_full (NULL, NULL,
@@ -2741,70 +2739,6 @@ clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage)
     }
 }
 
-/**
- * clutter_stage_set_motion_events_enabled:
- * @stage: a #ClutterStage
- * @enabled: %TRUE to enable the motion events delivery, and %FALSE
- *   otherwise
- *
- * Sets whether per-actor motion events (and relative crossing
- * events) should be disabled or not.
- *
- * The default is %TRUE.
- *
- * If @enable is %FALSE the following signals will not be emitted
- * by the actors children of @stage:
- *
- *  - #ClutterActor::motion-event
- *  - #ClutterActor::enter-event
- *  - #ClutterActor::leave-event
- *
- * The events will still be delivered to the #ClutterStage.
- *
- * The main side effect of this function is that disabling the motion
- * events will disable picking to detect the #ClutterActor underneath
- * the pointer for each motion event. This is useful, for instance,
- * when dragging a #ClutterActor across the @stage: the actor underneath
- * the pointer is not going to change, so it's meaningless to perform
- * a pick.
- *
- * Since: 1.8
- */
-void
-clutter_stage_set_motion_events_enabled (ClutterStage *stage,
-                                         gboolean      enabled)
-{
-  ClutterStagePrivate *priv;
-
-  g_return_if_fail (CLUTTER_IS_STAGE (stage));
-
-  priv = stage->priv;
-
-  enabled = !!enabled;
-
-  if (priv->motion_events_enabled != enabled)
-    priv->motion_events_enabled = enabled;
-}
-
-/**
- * clutter_stage_get_motion_events_enabled:
- * @stage: a #ClutterStage
- *
- * Retrieves the value set using clutter_stage_set_motion_events_enabled().
- *
- * Return value: %TRUE if the per-actor motion event delivery is enabled
- *   and %FALSE otherwise
- *
- * Since: 1.8
- */
-gboolean
-clutter_stage_get_motion_events_enabled (ClutterStage *stage)
-{
-  g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
-
-  return stage->priv->motion_events_enabled;
-}
-
 void
 _clutter_stage_add_pointer_drag_actor (ClutterStage       *stage,
                                        ClutterInputDevice *device,
diff --git a/clutter/clutter/clutter-stage.h b/clutter/clutter/clutter-stage.h
index fc90f69104..7c815f2d7b 100644
--- a/clutter/clutter/clutter-stage.h
+++ b/clutter/clutter/clutter-stage.h
@@ -200,11 +200,6 @@ void            clutter_stage_set_throttle_motion_events        (ClutterStage
 CLUTTER_EXPORT
 gboolean        clutter_stage_get_throttle_motion_events        (ClutterStage          *stage);
 CLUTTER_EXPORT
-void            clutter_stage_set_motion_events_enabled         (ClutterStage          *stage,
-                                                                 gboolean               enabled);
-CLUTTER_EXPORT
-gboolean        clutter_stage_get_motion_events_enabled         (ClutterStage          *stage);
-CLUTTER_EXPORT
 gboolean        clutter_stage_event                             (ClutterStage          *stage,
                                                                  ClutterEvent          *event);
 
diff --git a/src/tests/clutter/interactive/test-events.c b/src/tests/clutter/interactive/test-events.c
index ea7ca8e494..3361873c11 100644
--- a/src/tests/clutter/interactive/test-events.c
+++ b/src/tests/clutter/interactive/test-events.c
@@ -104,28 +104,6 @@ get_event_state_string (const ClutterEvent *event)
   return g_strjoinv (",", (char **) mods);
 }
 
-static gboolean
-red_button_cb (ClutterActor *actor,
-               ClutterEvent *event,
-               gpointer      data)
-{
-  ClutterActor *stage;
-
-  if (IsMotion)
-    IsMotion = FALSE;
-  else
-    IsMotion = TRUE;
-
-  stage = clutter_actor_get_stage (actor);
-  clutter_stage_set_motion_events_enabled (CLUTTER_STAGE (stage),
-                                           IsMotion);
-
-  g_print ("*** Per actor motion events %s ***\n",
-           IsMotion ? "enabled" : "disabled");
-
-  return FALSE;
-}
-
 static gboolean
 capture_cb (ClutterActor *actor,
            ClutterEvent *event,
@@ -393,22 +371,6 @@ test_events_main (int argc, char *argv[])
   clutter_actor_set_name (focus_box, "Focus Box");
   clutter_container_add (CLUTTER_CONTAINER(stage), focus_box, NULL);
 
-  actor = clutter_actor_new ();
-  clutter_actor_set_background_color (actor, CLUTTER_COLOR_Red);
-  clutter_actor_set_name (actor, "Red Box");
-  clutter_actor_set_size (actor, 100, 100);
-  clutter_actor_set_position (actor, 100, 100);
-  clutter_actor_set_reactive (actor, TRUE);
-  clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
-  g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "red box");
-  g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
-                   focus_box);
-  /* Toggle motion - enter/leave capture */
-  g_signal_connect (actor, "button-press-event",
-                    G_CALLBACK (red_button_cb), NULL);
-
-  clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor);
-
   actor = clutter_actor_new ();
   clutter_actor_set_background_color (actor, CLUTTER_COLOR_Green);
   clutter_actor_set_name (actor, "Green Box");
@@ -421,6 +383,8 @@ test_events_main (int argc, char *argv[])
                    focus_box);
   g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL);
 
+  clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor);
+
   /* non reactive */
   actor = clutter_actor_new ();
   clutter_actor_set_background_color (actor, CLUTTER_COLOR_Black);
diff --git a/src/tests/clutter/interactive/test-grab.c b/src/tests/clutter/interactive/test-grab.c
index fc41a34df6..4c421b3e97 100644
--- a/src/tests/clutter/interactive/test-grab.c
+++ b/src/tests/clutter/interactive/test-grab.c
@@ -129,25 +129,6 @@ blue_release_cb (ClutterActor    *actor,
   return FALSE;
 }
 
-static gboolean
-green_press_cb (ClutterActor    *actor,
-                ClutterEvent    *event,
-                gpointer         data)
-{
-  ClutterActor *stage;
-  gboolean enabled;
-
-  stage = clutter_actor_get_stage (actor);
-  enabled = !clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage));
-
-  clutter_stage_set_motion_events_enabled (CLUTTER_STAGE (stage), enabled);
-
-  g_print ("per actor motion events are now %s\n",
-           enabled ? "enabled" : "disabled");
-
-  return FALSE;
-}
-
 static gboolean
 toggle_grab_pointer_cb (ClutterActor    *actor,
                         ClutterEvent    *event,
@@ -192,7 +173,6 @@ test_grab_main (int argc, char *argv[])
   ClutterActor   *stage, *actor;
   ClutterColor    rcol = { 0xff, 0, 0, 0xff}, 
                   bcol = { 0, 0, 0xff, 0xff },
-                 gcol = { 0, 0xff, 0, 0xff },
                  ccol = { 0, 0xff, 0xff, 0xff },
                  ycol = { 0xff, 0xff, 0, 0xff };
 
@@ -245,18 +225,6 @@ test_grab_main (int argc, char *argv[])
   g_signal_connect (actor, "button-release-event",
                     G_CALLBACK (blue_release_cb), NULL);
 
-  actor = clutter_actor_new ();
-  clutter_actor_set_background_color (actor, &gcol);
-  clutter_actor_set_size (actor, 100, 100);
-  clutter_actor_set_position (actor, 300, 300);
-  clutter_actor_set_reactive (actor, TRUE);
-  clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
-  g_signal_connect (actor, "event",
-                    G_CALLBACK (debug_event_cb), (char *) "green box");
-  g_signal_connect (actor, "button-press-event",
-                    G_CALLBACK (green_press_cb), NULL);
-
-
   actor = clutter_actor_new ();
   clutter_actor_set_background_color (actor, &ccol);
   clutter_actor_set_size (actor, 100, 100);


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