st: Drop explicit Clutter grab in StButton
Nowadays, Clutter knows what an implicit grab is, which gives us already the feel that we are after with buttons (e.g. press and drag on the button will not enter other actors meanwhile). ClutterGrab was only added to provide that feel meanwhile, and it's also slightly more intense (e.g. altering keyboard focus, or triggering leave events on all parents of the button) which may trigger side effects. An example is the IBus candidates popup, where the pagination buttons may indirectly trigger dismissing of the entire popup when interacted, by stealing the keyboard focus to the client/actor doing IM. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2497 Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2244 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2924>
This commit is contained in:
parent
3a393738ea
commit
52182e6493
@ -78,7 +78,6 @@ struct _StButtonPrivate
|
|||||||
|
|
||||||
ClutterInputDevice *device;
|
ClutterInputDevice *device;
|
||||||
ClutterEventSequence *press_sequence;
|
ClutterEventSequence *press_sequence;
|
||||||
ClutterGrab *grab;
|
|
||||||
|
|
||||||
guint button_mask : 3;
|
guint button_mask : 3;
|
||||||
guint is_toggle : 1;
|
guint is_toggle : 1;
|
||||||
@ -195,13 +194,6 @@ st_button_button_press (ClutterActor *actor,
|
|||||||
|
|
||||||
if (priv->button_mask & mask)
|
if (priv->button_mask & mask)
|
||||||
{
|
{
|
||||||
ClutterActor *stage;
|
|
||||||
|
|
||||||
stage = clutter_actor_get_stage (actor);
|
|
||||||
|
|
||||||
if (priv->grabbed == 0)
|
|
||||||
priv->grab = clutter_stage_grab (CLUTTER_STAGE (stage), actor);
|
|
||||||
|
|
||||||
priv->grabbed |= mask;
|
priv->grabbed |= mask;
|
||||||
st_button_press (button, device, mask, NULL);
|
st_button_press (button, device, mask, NULL);
|
||||||
|
|
||||||
@ -234,11 +226,6 @@ st_button_button_release (ClutterActor *actor,
|
|||||||
st_button_release (button, device, mask, is_click ? button_nr : 0, NULL);
|
st_button_release (button, device, mask, is_click ? button_nr : 0, NULL);
|
||||||
|
|
||||||
priv->grabbed &= ~mask;
|
priv->grabbed &= ~mask;
|
||||||
if (priv->grab && priv->grabbed == 0)
|
|
||||||
{
|
|
||||||
clutter_grab_dismiss (priv->grab);
|
|
||||||
g_clear_pointer (&priv->grab, clutter_grab_unref);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -266,7 +253,8 @@ st_button_touch_event (ClutterActor *actor,
|
|||||||
sequence = clutter_event_get_event_sequence (event);
|
sequence = clutter_event_get_event_sequence (event);
|
||||||
event_type = clutter_event_type (event);
|
event_type = clutter_event_type (event);
|
||||||
|
|
||||||
if (event_type == CLUTTER_TOUCH_BEGIN && !priv->grab && !priv->press_sequence)
|
if (event_type == CLUTTER_TOUCH_BEGIN &&
|
||||||
|
priv->grabbed == 0 && !priv->press_sequence)
|
||||||
{
|
{
|
||||||
st_button_press (button, device, 0, sequence);
|
st_button_press (button, device, 0, sequence);
|
||||||
return CLUTTER_EVENT_STOP;
|
return CLUTTER_EVENT_STOP;
|
||||||
@ -923,12 +911,6 @@ st_button_fake_release (StButton *button)
|
|||||||
|
|
||||||
priv = st_button_get_instance_private (button);
|
priv = st_button_get_instance_private (button);
|
||||||
|
|
||||||
if (priv->grab)
|
|
||||||
{
|
|
||||||
clutter_grab_dismiss (priv->grab);
|
|
||||||
g_clear_pointer (&priv->grab, clutter_grab_unref);
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->grabbed = 0;
|
priv->grabbed = 0;
|
||||||
|
|
||||||
if (priv->pressed || priv->press_sequence)
|
if (priv->pressed || priv->press_sequence)
|
||||||
|
Loading…
Reference in New Issue
Block a user