[gtksourceview] vim: use timeout instead of idle for constrain callback



commit 91e8dfd1d361e42fa8e88880490843ca39e7fe22
Author: Christian Hergert <chergert redhat com>
Date:   Fri Nov 12 12:04:33 2021 -0800

    vim: use timeout instead of idle for constrain callback
    
    We tend to get in a accidental selection from mouse press/motion/release
    when using the GIdleSource. Instead we can wait for a small timeout and
    give ourselves more of a chance to avoid a visual mode transition.

 gtksourceview/vim/gtksourcevim.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/vim/gtksourcevim.c b/gtksourceview/vim/gtksourcevim.c
index f741f2e5..ea59b8c8 100644
--- a/gtksourceview/vim/gtksourcevim.c
+++ b/gtksourceview/vim/gtksourcevim.c
@@ -170,7 +170,12 @@ on_cursor_moved_cb (GtkSourceVim    *self,
         */
        if (self->constrain_insert_source == 0)
        {
-               self->constrain_insert_source = g_idle_add (constrain_insert_source, self);
+               self->constrain_insert_source =
+                       g_timeout_add_full (G_PRIORITY_LOW,
+                                           35,
+                                           constrain_insert_source,
+                                           g_object_ref (self),
+                                           g_object_unref);
        }
 }
 


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