[gtk+/touch-text-selection] entry: If a recompute is pending, wait before updating handles



commit 1b5615df7501538f59ad4a7cda0df399f9d5971b
Author: Carlos Garnacho <carlos lanedo com>
Date:   Wed Aug 29 16:04:54 2012 +0200

    entry: If a recompute is pending, wait before updating handles
    
    This avoids redundant window visibility and position changes

 gtk/gtkentry.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 9f1412a..a745a62 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3933,9 +3933,14 @@ _gtk_entry_update_handles (GtkEntry          *entry,
   gint strong_x, height;
   gint cursor, bound;
 
-  height = gdk_window_get_height (priv->text_area);
   _gtk_text_handle_set_mode (priv->text_handle, mode);
 
+  /* Wait for recomputation before repositioning */
+  if (priv->recompute_idle != 0)
+    return;
+
+  height = gdk_window_get_height (priv->text_area);
+
   gtk_entry_get_cursor_locations (entry, CURSOR_STANDARD, &strong_x, NULL);
   cursor = strong_x - priv->scroll_offset;
 
@@ -5736,10 +5741,17 @@ recompute_idle_func (gpointer data)
 
   if (gtk_widget_has_screen (GTK_WIDGET (entry)))
     {
+      GtkTextHandleMode handle_mode;
+
       gtk_entry_adjust_scroll (entry);
       gtk_widget_queue_draw (GTK_WIDGET (entry));
 
       update_im_cursor_location (entry);
+
+      handle_mode = _gtk_text_handle_get_mode (priv->text_handle);
+
+      if (handle_mode != GTK_TEXT_HANDLE_MODE_NONE)
+        _gtk_entry_update_handles (entry, handle_mode);
     }
 
   return FALSE;



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