diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-08-11 12:03:54 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-08-12 18:48:14 -0400 |
commit | 46f7804f3aac1e4007a93e6247d1587705e56e90 (patch) | |
tree | 11dd6d5e3db1c062dc424b5e48ef419aa731afa9 /gtk/gtkpopover.c | |
parent | c6c1619646ce62a87a89d54c037c2168e0d9d0d3 (diff) | |
download | gtk+-46f7804f3aac1e4007a93e6247d1587705e56e90.tar.gz |
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.
Diffstat (limited to 'gtk/gtkpopover.c')
-rw-r--r-- | gtk/gtkpopover.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 47603727ce..4e7002ac2b 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -622,7 +622,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)); |