[gtk/wip/carlosg/for-master: 6/6] gtk/textview: Do not forcibly show text handles




commit 0ae93c8cdcd42ab14050a811a5c6ab28834e03b1
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 5 21:15:47 2020 +0100

    gtk/textview: Do not forcibly show text handles
    
    The gtk_text_view_set_handle_position() function called some lines above
    takes care of handle visibility already, also accounting for other
    conditions (e.g. whether the handle points to contents onscreen).
    Forcibly showing handles here misbehaves if the handle should stay hidden,
    and somewhat expensively as it involves creating and throwing a native
    surface every time.

 gtk/gtktextview.c | 3 ---
 1 file changed, 3 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 152238e2e2..dec6ec64da 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5217,7 +5217,6 @@ gtk_text_view_update_handles (GtkTextView *text_view)
                                              &cursor);
           gtk_text_handle_set_role (priv->text_handles[TEXT_HANDLE_CURSOR],
                                     GTK_TEXT_HANDLE_ROLE_CURSOR);
-          gtk_widget_show (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_CURSOR]));
         }
       else if (gtk_text_iter_compare (&cursor, &bound) != 0)
         {
@@ -5227,14 +5226,12 @@ gtk_text_view_update_handles (GtkTextView *text_view)
                                              &cursor);
           gtk_text_handle_set_role (priv->text_handles[TEXT_HANDLE_CURSOR],
                                     GTK_TEXT_HANDLE_ROLE_SELECTION_START);
-          gtk_widget_show (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_CURSOR]));
 
           gtk_text_view_set_handle_position (text_view,
                                              priv->text_handles[TEXT_HANDLE_SELECTION_BOUND],
                                              &bound);
           gtk_text_handle_set_role (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND],
                                     GTK_TEXT_HANDLE_ROLE_SELECTION_END);
-          gtk_widget_show (GTK_WIDGET (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]));
         }
       else
         {


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