forked from AuroraMiddleware/gtk
button: Add back visual feedback for keynav
We lost the visual feedback for activating a button via Space or Enter when the :active pseudo-state became managed. Bring it back with a style class. Fixes: #3813
This commit is contained in:
parent
8e9effcc1e
commit
00923615f4
@ -39,6 +39,8 @@
|
|||||||
* `GtkButton` has a single CSS node with name button. The node will get the
|
* `GtkButton` has a single CSS node with name button. The node will get the
|
||||||
* style classes .image-button or .text-button, if the content is just an
|
* style classes .image-button or .text-button, if the content is just an
|
||||||
* image or label, respectively. It may also receive the .flat style class.
|
* image or label, respectively. It may also receive the .flat style class.
|
||||||
|
* When activating a button via the keyboard, the button will temporarily
|
||||||
|
* gain the .keyboard-activating style class.
|
||||||
*
|
*
|
||||||
* Other style classes that are commonly used with `GtkButton` include
|
* Other style classes that are commonly used with `GtkButton` include
|
||||||
* .suggested-action and .destructive-action. In special cases, buttons
|
* .suggested-action and .destructive-action. In special cases, buttons
|
||||||
@ -780,6 +782,8 @@ gtk_real_button_activate (GtkButton *button)
|
|||||||
{
|
{
|
||||||
priv->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT, button_activate_timeout, button);
|
priv->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT, button_activate_timeout, button);
|
||||||
g_source_set_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
|
g_source_set_name_by_id (priv->activate_timeout, "[gtk] button_activate_timeout");
|
||||||
|
|
||||||
|
gtk_widget_add_css_class (GTK_WIDGET (button), "keyboard-activating");
|
||||||
priv->button_down = TRUE;
|
priv->button_down = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -790,6 +794,8 @@ gtk_button_finish_activate (GtkButton *button,
|
|||||||
{
|
{
|
||||||
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
||||||
|
|
||||||
|
gtk_widget_remove_css_class (GTK_WIDGET (button), "keyboard-activating");
|
||||||
|
|
||||||
g_source_remove (priv->activate_timeout);
|
g_source_remove (priv->activate_timeout);
|
||||||
priv->activate_timeout = 0;
|
priv->activate_timeout = 0;
|
||||||
|
|
||||||
|
@ -492,6 +492,7 @@ button {
|
|||||||
-gtk-icon-filter: brightness(1.2);
|
-gtk-icon-filter: brightness(1.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.keyboard-activating,
|
||||||
&:active,
|
&:active,
|
||||||
&:checked {
|
&:checked {
|
||||||
@include button(active);
|
@include button(active);
|
||||||
|
Loading…
Reference in New Issue
Block a user