[gtk+] Ensure the insertion handle stays on fake events (eg from IM)



commit 17d3775555888151780fa404242e734a8e7f6b21
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 6e34ab5..de85158 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4492,8 +4492,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 48b6441..494f100 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;
 }
@@ -6376,7 +6377,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]