st/button: Notify :pressed changes

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/846
This commit is contained in:
Florian Müllner 2019-11-22 18:53:26 +01:00
parent c48330a986
commit 9790b0ee5d

View File

@ -139,13 +139,17 @@ st_button_press (StButton *button,
ClutterEventSequence *sequence)
{
StButtonPrivate *priv = st_button_get_instance_private (button);
gboolean active_changed = priv->pressed == 0 || sequence;
if (priv->pressed == 0 || sequence)
if (active_changed)
st_widget_add_style_pseudo_class (ST_WIDGET (button), "active");
priv->pressed |= mask;
priv->press_sequence = sequence;
priv->device = device;
if (active_changed)
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_PRESSED]);
}
static void
@ -171,6 +175,7 @@ st_button_release (StButton *button,
priv->press_sequence = NULL;
priv->device = NULL;
st_widget_remove_style_pseudo_class (ST_WIDGET (button), "active");
g_object_notify_by_pspec (G_OBJECT (button), props[PROP_PRESSED]);
if (clicked_button || sequence)
{