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



commit c1c4cc649f8755c657d5572de8dd0940469344a2
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 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);


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