[gtk+/touch-text-selection] entry: switch handles correctly on rtl



commit 1c11f6ed1afdca39d332927b55e56d016b2ad568
Author: Carlos Garnacho <carlos lanedo com>
Date:   Sun Sep 2 23:38:14 2012 +0200

    entry: switch handles correctly on rtl
    
    MIN/MAX of pixel values don't cut it, so compare
    selection/cursor indexes.

 gtk/gtkentry.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index ed92815..2a119a3 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3950,13 +3950,26 @@ _gtk_entry_update_handles (GtkEntry          *entry,
 
   if (mode == GTK_TEXT_HANDLE_MODE_SELECTION)
     {
+      gint start, end;
+
       bound = _gtk_entry_get_selection_bound_location (entry) - priv->scroll_offset;
 
+      if (priv->selection_bound > priv->current_pos)
+        {
+          start = cursor;
+          end = bound;
+        }
+      else
+        {
+          start = bound;
+          end = cursor;
+        }
+
       /* Update start selection bound */
       _gtk_entry_move_handle (entry, GTK_TEXT_HANDLE_POSITION_SELECTION_START,
-                              MIN (cursor, bound), 0, height);
+                              start, 0, height);
       _gtk_entry_move_handle (entry, GTK_TEXT_HANDLE_POSITION_SELECTION_END,
-                              MAX (cursor, bound), 0, height);
+                              end, 0, height);
     }
   else
     _gtk_entry_move_handle (entry, GTK_TEXT_HANDLE_POSITION_CURSOR,



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