mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
clutter: Change clutter_do_event() name/signature
It is a bit backwards that events contain information about the stage they are being handled by. It makes more sense to specify in the ClutterEvent handling entrypoint the stage that will handle the event. As a first step, add this ClutterStage argument, even though the information is still carried through the event in order to keep satisfying calls to the getter function. This entrypoint has been also renamed to clutter_stage_handle_event(), so that its ownership/namespace is clearer. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
parent
72c433ef02
commit
2e3d55c948
@ -757,7 +757,8 @@ maybe_remove_device_for_event (ClutterStage *stage,
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_do_event:
|
||||
* clutter_stage_handle_event:
|
||||
* @stage: a #ClutterStage.
|
||||
* @event: a #ClutterEvent.
|
||||
*
|
||||
* Processes an event.
|
||||
@ -769,21 +770,20 @@ maybe_remove_device_for_event (ClutterStage *stage,
|
||||
* toolkit, and it should never be called by applications.
|
||||
*/
|
||||
void
|
||||
clutter_do_event (ClutterEvent *event)
|
||||
clutter_stage_handle_event (ClutterStage *stage,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterContext *context = _clutter_context_get_default();
|
||||
ClutterActor *event_actor = NULL;
|
||||
gboolean filtered;
|
||||
|
||||
/* we need the stage for the event */
|
||||
if (event->any.stage == NULL)
|
||||
{
|
||||
g_warning ("%s: Event does not have a stage: discarding.", G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
clutter_event_set_stage (event, stage);
|
||||
|
||||
/* stages in destruction do not process events */
|
||||
if (CLUTTER_ACTOR_IN_DESTRUCTION (event->any.stage))
|
||||
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
|
||||
return;
|
||||
|
||||
switch (event->any.type)
|
||||
@ -793,7 +793,7 @@ clutter_do_event (ClutterEvent *event)
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_TOUCH_BEGIN:
|
||||
case CLUTTER_TOUCH_UPDATE:
|
||||
update_device_for_event (event->any.stage, event, TRUE);
|
||||
update_device_for_event (stage, event, TRUE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -804,7 +804,7 @@ clutter_do_event (ClutterEvent *event)
|
||||
event->any.type != CLUTTER_NOTHING &&
|
||||
event->any.type != CLUTTER_EVENT_LAST)
|
||||
{
|
||||
event_actor = clutter_stage_get_event_actor (event->any.stage, event);
|
||||
event_actor = clutter_stage_get_event_actor (stage, event);
|
||||
}
|
||||
|
||||
context->current_event = g_slist_prepend (context->current_event, event);
|
||||
@ -825,20 +825,20 @@ clutter_do_event (ClutterEvent *event)
|
||||
ClutterInputDevice *device = clutter_event_get_device (event);
|
||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
||||
|
||||
clutter_stage_maybe_lost_implicit_grab (event->any.stage, device, sequence);
|
||||
clutter_stage_maybe_lost_implicit_grab (stage, device, sequence);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_clutter_stage_queue_event (event->any.stage, event, TRUE);
|
||||
_clutter_stage_queue_event (stage, event, TRUE);
|
||||
}
|
||||
|
||||
if (event->type == CLUTTER_TOUCH_END ||
|
||||
event->type == CLUTTER_TOUCH_CANCEL ||
|
||||
event->type == CLUTTER_DEVICE_REMOVED)
|
||||
{
|
||||
_clutter_stage_process_queued_events (event->any.stage);
|
||||
maybe_remove_device_for_event (event->any.stage, event, TRUE);
|
||||
_clutter_stage_process_queued_events (stage);
|
||||
maybe_remove_device_for_event (stage, event, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -891,7 +891,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
* @event: a #ClutterEvent.
|
||||
*
|
||||
* Does the actual work of processing an event that was queued earlier
|
||||
* out of clutter_do_event().
|
||||
* out of clutter_stage_handle_event().
|
||||
*/
|
||||
void
|
||||
_clutter_process_event (ClutterEvent *event)
|
||||
|
@ -90,7 +90,8 @@ typedef enum
|
||||
#define CLUTTER_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 50)
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_do_event (ClutterEvent *event);
|
||||
void clutter_stage_handle_event (ClutterStage *stage,
|
||||
ClutterEvent *event);
|
||||
|
||||
/* Debug utility functions */
|
||||
CLUTTER_EXPORT
|
||||
|
@ -1090,6 +1090,7 @@ static gboolean
|
||||
dispatch_clutter_event (MetaBackend *backend)
|
||||
{
|
||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||
ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||
ClutterEvent *event;
|
||||
|
||||
event = clutter_event_get ();
|
||||
@ -1098,8 +1099,7 @@ dispatch_clutter_event (MetaBackend *backend)
|
||||
g_warn_if_fail (!priv->in_init ||
|
||||
event->type == CLUTTER_DEVICE_ADDED);
|
||||
|
||||
event->any.stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
|
||||
clutter_do_event (event);
|
||||
clutter_stage_handle_event (stage, event);
|
||||
meta_backend_update_from_event (backend, event);
|
||||
clutter_event_free (event);
|
||||
return TRUE;
|
||||
|
@ -101,7 +101,8 @@ meta_x11_handle_event (MetaBackend *backend,
|
||||
while (spin > 0 && (event = clutter_event_get ()))
|
||||
{
|
||||
/* forward the event into clutter for emission etc. */
|
||||
clutter_do_event (event);
|
||||
clutter_stage_handle_event (CLUTTER_STAGE (meta_backend_get_stage (backend)),
|
||||
event);
|
||||
meta_backend_update_from_event (backend, event);
|
||||
clutter_event_free (event);
|
||||
--spin;
|
||||
|
Loading…
Reference in New Issue
Block a user