[gtk+/wip/matthiasc/emoji-picker: 8/11] Fix a problem with modal popovers
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/emoji-picker: 8/11] Fix a problem with modal popovers
- Date: Mon, 7 Aug 2017 13:02:48 +0000 (UTC)
commit e0390a636b31a91be5a07dbc3bfae5a940d61fa1
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Aug 6 14:07:33 2017 -0400
Fix a problem with modal popovers
When a modal popover is dismissed, we transfer the
focus back to where it came from when the popover
appeared. Unfortunately, we use gtk_widget_grab_focus()
to do so, which messes up the selection in case of
an entry. Do an ugly workaround for now, and special-case
GtkEntry in the popover code.
gtk/gtkpopover.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 4760372..4e7002a 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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]