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:25 +0100
commitadb7b7fb60db4bcdf7c380ca4f2c64ff788d1557 (patch)
treecae0642281b601c4a24b1e77dd3795df68724079
parent2b8e30a8ed4e09a57dd04a2a65b0f007f4eb819f (diff)
downloadgtk+-adb7b7fb60db4bcdf7c380ca4f2c64ff788d1557.tar.gz
Entry,TextView: Deselect text on ::focus-out665-entry-textview-deselect-text-on-focus-out-4
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 634229978b..256cb0509a 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4233,7 +4233,7 @@ gtk_entry_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_editable_select_region (GTK_EDITABLE (entry), priv->current_pos, priv->current_pos);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 357a7cb3b7..13d24e07dd 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4592,7 +4592,7 @@ gtk_text_view_state_flags_changed (GtkWidget *widget,
GtkTextViewPrivate *priv = text_view->priv;
GtkStateFlags state;
- if (!gtk_widget_is_sensitive (widget))
+ if (!gtk_widget_is_focus (widget))
{
/* Clear any selection */
gtk_text_view_unselect (text_view);