[gtk+/touch-text-selection: 5/8] entry: Don't apply selection clamping on handle cursor mode



commit e299dfa4629b718e6119694cd977221ad4d9299e
Author: Carlos Garnacho <carlos lanedo com>
Date:   Fri Aug 24 14:41:09 2012 +0200

    entry: Don't apply selection clamping on handle cursor mode

 gtk/gtkentry.c |   36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index b73d595..7116ac8 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -6193,29 +6193,37 @@ gtk_entry_handle_dragged (GtkTextHandle         *handle,
 
   if (pos == GTK_TEXT_HANDLE_POSITION_CURSOR)
     {
-      gint max_pos;
-
       priv->cursor_handle_dragged = TRUE;
 
-      if (priv->select_words)
-        max_pos = gtk_entry_move_forward_word (entry, priv->selection_bound, TRUE);
-      else
-        max_pos = MAX (priv->selection_bound + 1, 0);
+      if (mode == GTK_TEXT_HANDLE_MODE_SELECTION)
+        {
+          gint max_pos;
 
-      cursor_pos = MAX (tmp_pos, max_pos);
+          if (priv->select_words)
+            max_pos = gtk_entry_move_forward_word (entry, priv->selection_bound, TRUE);
+          else
+            max_pos = MAX (priv->selection_bound + 1, 0);
+
+          cursor_pos = MAX (tmp_pos, max_pos);
+        }
+      else
+        cursor_pos = tmp_pos;
     }
   else
     {
-      gint min_pos;
-
       priv->selection_handle_dragged = TRUE;
 
-      if (priv->select_words)
-        min_pos = gtk_entry_move_backward_word (entry, priv->current_pos, TRUE);
-      else
-        min_pos = priv->current_pos - 1;
+      if (mode == GTK_TEXT_HANDLE_MODE_SELECTION)
+        {
+          gint min_pos;
 
-      selection_bound_pos = MIN (tmp_pos, min_pos);
+          if (priv->select_words)
+            min_pos = gtk_entry_move_backward_word (entry, priv->current_pos, TRUE);
+          else
+            min_pos = priv->current_pos - 1;
+
+          selection_bound_pos = MIN (tmp_pos, min_pos);
+        }
     }
 
   if (cursor_pos != priv->current_pos ||



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