]> granicus.if.org Git - vim/commitdiff
patch 7.4.1497 v7.4.1497
authorBram Moolenaar <Bram@vim.org>
Sat, 5 Mar 2016 21:40:52 +0000 (22:40 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 5 Mar 2016 21:40:52 +0000 (22:40 +0100)
Problem:    Cursor drawing problem with GTK 3.
Solution:   Handle blinking differently. (Kazunobu Kuriyama)

src/gui_gtk_x11.c
src/version.c

index d43191cc3d10190785e8e0e7bd1335f15fcc0446..3ee2957709a3071887fbd4b1a0ead33cdd387882 100644 (file)
@@ -617,9 +617,9 @@ visibility_event(GtkWidget *widget UNUSED,
  */
 #if GTK_CHECK_VERSION(3,0,0)
 static gboolean is_key_pressed = FALSE;
+static gboolean blink_mode = TRUE;
 
 static gboolean gui_gtk_is_blink_on(void);
-static gboolean gui_gtk_is_no_blink(void);
 static void gui_gtk_window_clear(GdkWindow *win);
 
     static void
@@ -649,7 +649,6 @@ gui_gtk3_should_draw_cursor(void)
     cond |= gui_gtk_is_blink_on();
     cond |= is_key_pressed;
     cond |= gui.in_focus == FALSE;
-    cond |= gui_gtk_is_no_blink();
     return  cond;
 }
 
@@ -681,7 +680,10 @@ draw_event(GtkWidget *widget,
            for (i = 0; i < list->num_rectangles; i++)
            {
                const cairo_rectangle_t rect = list->rectangles[i];
-               gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
+               if (blink_mode)
+                   gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
+               else
+                   gui_redraw(rect.x, rect.y, rect.width, rect.height);
            }
        }
        cairo_rectangle_list_destroy(list);
@@ -790,20 +792,33 @@ gui_gtk_is_blink_on(void)
 {
     return blink_state == BLINK_ON;
 }
-
-    static gboolean
-gui_gtk_is_no_blink(void)
-{
-    return blink_waittime == 0 || blink_ontime == 0 || blink_offtime == 0;
-}
 #endif
 
     void
 gui_mch_set_blinking(long waittime, long on, long off)
 {
+#if GTK_CHECK_VERSION(3,0,0)
+    if (waittime == 0 || on == 0 || off == 0)
+    {
+       blink_mode = FALSE;
+
+       blink_waittime = 700;
+       blink_ontime = 400;
+       blink_offtime = 250;
+    }
+    else
+    {
+       blink_mode = TRUE;
+
+       blink_waittime = waittime;
+       blink_ontime = on;
+       blink_offtime = off;
+    }
+#else
     blink_waittime = waittime;
     blink_ontime = on;
     blink_offtime = off;
+#endif
 }
 
 /*
index fa036f614117bf836a32045650b575c33766d47d..185161538ad61702d7a39aa8fb0926b9c0a04874 100644 (file)
@@ -743,6 +743,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1497,
 /**/
     1496,
 /**/