[gtk+] textview: Perform tougher handle visibility checks after hiding the popover



commit c11906fcdbe12bab387ae74830703bcd919249a2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 12 12:45:03 2015 +0200

    textview: Perform tougher handle visibility checks after hiding the popover
    
    The handles might fall outside the visible area, and shouldn't be shown
    then. Just call gtk_text_view_update_handles() which will perform these
    checks, and keep the handle conveniently hidden.
    
    This was leading to unexpectedly visible handles (and in the
    wrong/previous position, the handle code doesn't relocate the widget
    it's about to hide) when "select all" was selected in the popover on
    a textview needing scrollbars.
    and extending the selection beyond the view above and/or below.

 gtk/gtktextview.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 7edb925..29d0648 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -9202,14 +9202,12 @@ show_or_hide_handles (GtkWidget   *popover,
   handle = text_view->priv->text_handle;
   mode = _gtk_text_handle_get_mode (handle);
 
-  if (mode == GTK_TEXT_HANDLE_MODE_CURSOR)
-    {
-      _gtk_text_handle_set_visible (handle, GTK_TEXT_HANDLE_POSITION_CURSOR, !visible);
-    }
-  else if (mode == GTK_TEXT_HANDLE_MODE_SELECTION)
+  if (!visible)
+    gtk_text_view_update_handles (text_view, mode);
+  else
     {
-      _gtk_text_handle_set_visible (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_START, !visible);
-      _gtk_text_handle_set_visible (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_END, !visible);
+      _gtk_text_handle_set_visible (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_START, FALSE);
+      _gtk_text_handle_set_visible (handle, GTK_TEXT_HANDLE_POSITION_SELECTION_END, FALSE);
     }
 }
 


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