[gtk+/gtk-3-22] Fix a problem with focus handling in modal popovers
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] Fix a problem with focus handling in modal popovers
- Date: Fri, 11 Aug 2017 19:44:39 +0000 (UTC)
commit 340c520bd04e0000f731573f020546fc142bd474
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Aug 11 12:03:54 2017 -0400
Fix a problem with focus handling in modal popovers
When the popover is dismissed, we return the focus to
where it came from. However, by using gtk_widget_grab_focus,
we were messing up the selection if that widget happens to
be an entry. Special-case GtkEntry and use
gtk_entry_grab_focus_without_selecting to avoid this issue.
gtk/gtkpopover.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index e89ae37..005adc7 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -538,7 +538,12 @@ gtk_popover_apply_modality (GtkPopover *popover,
/* Let prev_focus_widget regain focus */
if (priv->prev_focus_widget &&
gtk_widget_is_drawable (priv->prev_focus_widget))
- gtk_widget_grab_focus (priv->prev_focus_widget);
+ {
+ if (GTK_IS_ENTRY (priv->prev_focus_widget))
+ gtk_entry_grab_focus_without_selecting (GTK_ENTRY (priv->prev_focus_widget));
+ else
+ gtk_widget_grab_focus (priv->prev_focus_widget);
+ }
else if (priv->window)
gtk_widget_grab_focus (GTK_WIDGET (priv->window));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]