update focus indicators in popovers

https://gitlab.gnome.org/GNOME/gtk/-/issues/4383
This commit is contained in:
Caolán McNamara 2021-11-05 13:07:35 +00:00
parent 9c1a41052b
commit 155b791d43
3 changed files with 18 additions and 7 deletions

View File

@ -776,6 +776,7 @@ gtk_popover_key_pressed (GtkWidget *widget,
GdkModifierType state)
{
GtkPopover *popover = GTK_POPOVER (widget);
GtkWindow *root;
if (keyval == GDK_KEY_Escape)
{
@ -783,6 +784,8 @@ gtk_popover_key_pressed (GtkWidget *widget,
return TRUE;
}
root = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (popover)));
_gtk_window_update_focus_visible (root, keyval, state, TRUE);
update_mnemonics_visible (popover, keyval, state, TRUE);
return FALSE;
@ -795,7 +798,10 @@ gtk_popover_key_released (GtkWidget *widget,
GdkModifierType state)
{
GtkPopover *popover = GTK_POPOVER (widget);
GtkWindow *root;
root = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (popover)));
_gtk_window_update_focus_visible (root, keyval, state, FALSE);
update_mnemonics_visible (popover, keyval, state, FALSE);
return FALSE;

View File

@ -4815,11 +4815,11 @@ update_mnemonics_visible (GtkWindow *window,
}
}
static void
update_focus_visible (GtkWindow *window,
guint keyval,
GdkModifierType state,
gboolean visible)
void
_gtk_window_update_focus_visible (GtkWindow *window,
guint keyval,
GdkModifierType state,
gboolean visible)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
@ -4854,7 +4854,7 @@ gtk_window_key_pressed (GtkWidget *widget,
{
GtkWindow *window = GTK_WINDOW (widget);
update_focus_visible (window, keyval, state, TRUE);
_gtk_window_update_focus_visible (window, keyval, state, TRUE);
update_mnemonics_visible (window, keyval, state, TRUE);
return FALSE;
@ -4869,7 +4869,7 @@ gtk_window_key_released (GtkWidget *widget,
{
GtkWindow *window = GTK_WINDOW (widget);
update_focus_visible (window, keyval, state, FALSE);
_gtk_window_update_focus_visible (window, keyval, state, FALSE);
update_mnemonics_visible (window, keyval, state, FALSE);
return FALSE;

View File

@ -47,6 +47,11 @@ gboolean _gtk_window_group_widget_is_blocked_for_device (GtkWindowGroup *
void _gtk_window_unset_focus_and_default (GtkWindow *window,
GtkWidget *widget);
void _gtk_window_update_focus_visible (GtkWindow *window,
guint keyval,
GdkModifierType state,
gboolean visible);
void _gtk_window_set_allocation (GtkWindow *window,
int width,
int height,