[gtk+/touch-selection-fixes: 3/3] texthandle: add an extra style class to the cursor-mode handle



commit dedd17e8aab4a8a7f18c4df385b0f75f0e0898f6
Author: Carlos Garnacho <carlos lanedo com>
Date:   Wed Sep 19 13:59:43 2012 +0200

    texthandle: add an extra style class to the cursor-mode handle
    
    This way the handle can be themed differently when in cursor mode,
    to eg. have asimmetrical handles on selection, but have the sole
    cursor handle be simmetrical

 gtk/gtktexthandle.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index bc9ca98..fb5d12b 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -108,8 +108,13 @@ _gtk_text_handle_draw (GtkTextHandle         *handle,
                                GTK_STYLE_CLASS_CURSOR_HANDLE);
 
   if (pos == GTK_TEXT_HANDLE_POSITION_SELECTION_END)
-    gtk_style_context_add_class (priv->style_context,
-                                 GTK_STYLE_CLASS_BOTTOM);
+    {
+      gtk_style_context_add_class (priv->style_context,
+                                   GTK_STYLE_CLASS_BOTTOM);
+
+      if (priv->mode == GTK_TEXT_HANDLE_MODE_CURSOR)
+        gtk_style_context_add_class (priv->style_context, "insert-cursor");
+    }
   else
     gtk_style_context_add_class (priv->style_context,
                                  GTK_STYLE_CLASS_TOP);
@@ -574,6 +579,10 @@ _gtk_text_handle_set_mode (GtkTextHandle     *handle,
     }
 
   priv->mode = mode;
+
+  _gtk_text_handle_update_shape (handle,
+                                 priv->windows[GTK_TEXT_HANDLE_POSITION_CURSOR].window,
+                                 GTK_TEXT_HANDLE_POSITION_CURSOR);
 }
 
 GtkTextHandleMode



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