clutter: Drop ClutterStage field from ClutterEvent

Avoid setting in ClutterEvents the stage they will end up
delivered through. This is now handled explicitly where it
matters.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
Carlos Garnacho 2023-08-02 21:00:33 +02:00
parent 1f9e787b83
commit c341bf5af9
3 changed files with 2 additions and 61 deletions

View File

@ -530,43 +530,6 @@ clutter_event_set_source (ClutterEvent *event,
{ {
} }
/**
* clutter_event_get_stage:
* @event: a #ClutterEvent
*
* Retrieves the source #ClutterStage the event originated for, or
* %NULL if the event has no stage.
*
* Return value: (transfer none): a #ClutterStage
*/
ClutterStage *
clutter_event_get_stage (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, NULL);
return event->any.stage;
}
/**
* clutter_event_set_stage:
* @event: a #ClutterEvent
* @stage: (allow-none): a #ClutterStage, or %NULL
*
* Sets the source #ClutterStage of the event.
*/
void
clutter_event_set_stage (ClutterEvent *event,
ClutterStage *stage)
{
g_return_if_fail (event != NULL);
g_return_if_fail (stage == NULL || CLUTTER_IS_STAGE (stage));
if (event->any.stage == stage)
return;
event->any.stage = stage;
}
/** /**
* clutter_event_get_flags: * clutter_event_get_flags:
* @event: a #ClutterEvent * @event: a #ClutterEvent
@ -1685,7 +1648,8 @@ _clutter_event_process_filters (ClutterEvent *event,
next = l->next; next = l->next;
if (event_filter->stage && event_filter->stage != event->any.stage) if (event_filter->stage &&
event_filter->stage != CLUTTER_STAGE (clutter_actor_get_stage (event_actor)))
continue; continue;
if (event_filter->func (event, event_actor, event_filter->user_data) == CLUTTER_EVENT_STOP) if (event_filter->func (event, event_actor, event_filter->user_data) == CLUTTER_EVENT_STOP)

View File

@ -123,7 +123,6 @@ struct _ClutterAnyEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
}; };
/** /**
@ -147,7 +146,6 @@ struct _ClutterKeyEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
ClutterModifierType modifier_state; ClutterModifierType modifier_state;
guint keyval; guint keyval;
@ -183,7 +181,6 @@ struct _ClutterButtonEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
gfloat x; gfloat x;
gfloat y; gfloat y;
@ -211,7 +208,6 @@ struct _ClutterProximityEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
ClutterInputDevice *device; ClutterInputDevice *device;
}; };
@ -235,7 +231,6 @@ struct _ClutterCrossingEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
gfloat x; gfloat x;
gfloat y; gfloat y;
@ -266,7 +261,6 @@ struct _ClutterMotionEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
gfloat x; gfloat x;
gfloat y; gfloat y;
@ -307,7 +301,6 @@ struct _ClutterScrollEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
gfloat x; gfloat x;
gfloat y; gfloat y;
@ -354,7 +347,6 @@ struct _ClutterTouchEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
gfloat x; gfloat x;
gfloat y; gfloat y;
@ -398,7 +390,6 @@ struct _ClutterTouchpadPinchEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
ClutterTouchpadGesturePhase phase; ClutterTouchpadGesturePhase phase;
gfloat x; gfloat x;
@ -439,7 +430,6 @@ struct _ClutterTouchpadSwipeEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
ClutterTouchpadGesturePhase phase; ClutterTouchpadGesturePhase phase;
guint n_fingers; guint n_fingers;
@ -479,7 +469,6 @@ struct _ClutterTouchpadHoldEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
ClutterTouchpadGesturePhase phase; ClutterTouchpadGesturePhase phase;
uint32_t n_fingers; uint32_t n_fingers;
@ -492,7 +481,6 @@ struct _ClutterPadButtonEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
guint32 button; guint32 button;
guint32 group; guint32 group;
@ -505,7 +493,6 @@ struct _ClutterPadStripEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
ClutterInputDevice *device; ClutterInputDevice *device;
ClutterInputDevicePadSource strip_source; ClutterInputDevicePadSource strip_source;
@ -520,7 +507,6 @@ struct _ClutterPadRingEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
ClutterInputDevice *device; ClutterInputDevice *device;
ClutterInputDevicePadSource ring_source; ClutterInputDevicePadSource ring_source;
@ -535,7 +521,6 @@ struct _ClutterDeviceEvent
ClutterEventType type; ClutterEventType type;
guint32 time; guint32 time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
ClutterInputDevice *device; ClutterInputDevice *device;
}; };
@ -545,7 +530,6 @@ struct _ClutterIMEvent
ClutterEventType type; ClutterEventType type;
uint32_t time; uint32_t time;
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage;
char *text; char *text;
int32_t offset; int32_t offset;
@ -679,11 +663,6 @@ void clutter_event_set_source (ClutterEvent
CLUTTER_DEPRECATED CLUTTER_DEPRECATED
ClutterActor * clutter_event_get_source (const ClutterEvent *event); ClutterActor * clutter_event_get_source (const ClutterEvent *event);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_event_set_stage (ClutterEvent *event,
ClutterStage *stage);
CLUTTER_EXPORT
ClutterStage * clutter_event_get_stage (const ClutterEvent *event);
CLUTTER_EXPORT
ClutterInputDeviceType clutter_event_get_device_type (const ClutterEvent *event); ClutterInputDeviceType clutter_event_get_device_type (const ClutterEvent *event);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_event_set_coords (ClutterEvent *event, void clutter_event_set_coords (ClutterEvent *event,

View File

@ -781,8 +781,6 @@ clutter_stage_handle_event (ClutterStage *stage,
g_return_if_fail (CLUTTER_IS_STAGE (stage)); g_return_if_fail (CLUTTER_IS_STAGE (stage));
g_return_if_fail (event != NULL); g_return_if_fail (event != NULL);
clutter_event_set_stage (event, stage);
/* stages in destruction do not process events */ /* stages in destruction do not process events */
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage)) if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return; return;