Merge branch 'update_focus_indicators_in_popovers' into 'main'

update focus indicators in popovers

See merge request GNOME/gtk!4124
This commit is contained in:
Matthias Clasen 2021-12-01 01:21:32 +00:00
commit f1612e36ee
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

@ -4895,11 +4895,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);
@ -4934,7 +4934,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;
@ -4949,7 +4949,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

@ -34,6 +34,11 @@ void _gtk_window_group_remove_grab (GtkWindowGroup *window_group,
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,