summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Boles <dboles.src@gmail.com>2018-03-31 13:38:19 +0100
committerDaniel Boles <dboles.src@gmail.com>2018-09-22 17:30:05 +0100
commitc1c4cc649f8755c657d5572de8dd0940469344a2 (patch)
tree22f390ae7c27a26d4b0696112eeb2edf08f02bde
parent36656ea13a735377e59376276727edf63b0e035b (diff)
downloadgtk+-665-entry-textview-deselect-text-on-focus-out-3.tar.gz
Entry,TextView: Deselect text on ::focus-out665-entry-textview-deselect-text-on-focus-out-3
We don't differentiate between foreground and backdropped selections, which confuses/infuriates users, particularly in the FileChooser entry. There's no design desire to introduce that differentiation in the theme. The preferred fix is instead to clear the selection on focussing out. This patch does that by changing the existing code that clears the selection when the state changes and the widget is no longer :sensitive to instead clear the selection if it's not the focus within its toplevel https://gitlab.gnome.org/GNOME/gtk/issues/665#note_110313
-rw-r--r--gtk/gtkentry.c2
-rw-r--r--gtk/gtktextview.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 35995d84bb..e581594e2a 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -5128,7 +5128,7 @@ gtk_entry_state_flags_changed (GtkWidget *widget,
update_cursors (widget);
}
- if (!gtk_widget_is_sensitive (widget))
+ if (!gtk_widget_is_focus (widget))
{
/* Clear any selection */
gtk_editable_select_region (GTK_EDITABLE (entry), priv->current_pos, priv->current_pos);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 4c32a7b55c..9bcc15a819 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4950,7 +4950,7 @@ gtk_text_view_state_flags_changed (GtkWidget *widget,
priv->mouse_cursor_obscured = FALSE;
}
- if (!gtk_widget_is_sensitive (widget))
+ if (!gtk_widget_is_focus (widget))
{
/* Clear any selection */
gtk_text_view_unselect (text_view);