[gtk+/touch-selections: 2/8] Ensure the insertion handle stays on fake events (eg from IM)



commit e36bb5a20aad069314b34b31a221dcfc5725790a
Author: Carlos Garnacho <carlos lanedo com>
Date:   Wed Nov 21 16:49:37 2012 +0100

    Ensure the insertion handle stays on fake events (eg from IM)
    
    Don't set handles mode to none if the event has send_event set.
    For consistency with GtkEntry, also make GtkTextView keep the
    handle mode on buffer changes.

 gtk/gtkentry.c    |    6 ++++--
 gtk/gtktextview.c |   10 +++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 184277c..8d315c0 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4487,8 +4487,10 @@ gtk_entry_key_press (GtkWidget   *widget,
 
   gtk_entry_reset_blink_time (entry);
   gtk_entry_pend_cursor_blink (entry);
-  _gtk_text_handle_set_mode (priv->text_handle,
-                             GTK_TEXT_HANDLE_MODE_NONE);
+
+  if (!event->send_event)
+    _gtk_text_handle_set_mode (priv->text_handle,
+                               GTK_TEXT_HANDLE_MODE_NONE);
 
   if (priv->editable)
     {
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index d1b4c80..158b299 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4755,8 +4755,9 @@ gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
   gtk_text_view_reset_blink_time (text_view);
   gtk_text_view_pend_cursor_blink (text_view);
 
-  _gtk_text_handle_set_mode (priv->text_handle,
-                             GTK_TEXT_HANDLE_MODE_NONE);
+  if (!event->send_event)
+    _gtk_text_handle_set_mode (priv->text_handle,
+                               GTK_TEXT_HANDLE_MODE_NONE);
 
   return retval;
 }
@@ -6356,7 +6357,10 @@ gtk_text_view_buffer_changed_handler (GtkTextBuffer *buffer,
                                       gpointer       data)
 {
   GtkTextView *text_view = data;
-  gtk_text_view_update_handles (text_view, GTK_TEXT_HANDLE_MODE_NONE);
+  GtkTextViewPrivate *priv = text_view->priv;
+
+  gtk_text_view_update_handles (text_view,
+                                _gtk_text_handle_get_mode (priv->text_handle));
 }
 
 static void



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