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.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2099>
This commit is contained in:
Carlos Garnacho 2021-11-04 17:01:33 +01:00 committed by Marge Bot
parent 4b0e998ab8
commit 6144244201
5 changed files with 2 additions and 197 deletions

View File

@ -995,30 +995,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 (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:
@ -1052,38 +1028,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;
/* 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:

View File

@ -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;
};
@ -1559,7 +1558,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,
@ -2742,70 +2740,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,

View File

@ -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);

View File

@ -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,
@ -396,22 +374,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");
@ -424,6 +386,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);

View File

@ -132,25 +132,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,
@ -195,7 +176,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 };
@ -248,18 +228,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);