[gtk/665-entry-textview-deselect-text-on-focus-out-4] Entry, TextView: Deselect text on ::focus-out



commit adb7b7fb60db4bcdf7c380ca4f2c64ff788d1557
Author: Daniel Boles <dboles src gmail com>
Date:   Sat Mar 31 13:38:19 2018 +0100

    Entry,TextView: Deselect text on ::focus-out
    
    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

 gtk/gtkentry.c    | 2 +-
 gtk/gtktextview.c | 2 +-
 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]