[gtk: 1/2] update focus indicators in popovers
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] update focus indicators in popovers
- Date: Wed, 1 Dec 2021 01:21:35 +0000 (UTC)
commit 155b791d4369578de147a7833f3c155194ef1907
Author: Caolán McNamara <caolanm redhat com>
Date: Fri Nov 5 13:07:35 2021 +0000
update focus indicators in popovers
https://gitlab.gnome.org/GNOME/gtk/-/issues/4383
gtk/gtkpopover.c | 6 ++++++
gtk/gtkwindow.c | 14 +++++++-------
gtk/gtkwindowprivate.h | 5 +++++
3 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 244fedcd7a..2ef0500171 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -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;
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 6ae7cef9fb..999d0f58d4 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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;
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index a9546272ec..27b824690c 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]