Skip to content

Commit 0ecbe33

Browse files
committed
patch 7.4.1497
Problem: Cursor drawing problem with GTK 3. Solution: Handle blinking differently. (Kazunobu Kuriyama)
1 parent a96909c commit 0ecbe33

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

src/gui_gtk_x11.c

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,9 @@ visibility_event(GtkWidget *widget UNUSED,
617617
*/
618618
#if GTK_CHECK_VERSION(3,0,0)
619619
static gboolean is_key_pressed = FALSE;
620+
static gboolean blink_mode = TRUE;
620621

621622
static gboolean gui_gtk_is_blink_on(void);
622-
static gboolean gui_gtk_is_no_blink(void);
623623
static void gui_gtk_window_clear(GdkWindow *win);
624624

625625
static void
@@ -649,7 +649,6 @@ gui_gtk3_should_draw_cursor(void)
649649
cond |= gui_gtk_is_blink_on();
650650
cond |= is_key_pressed;
651651
cond |= gui.in_focus == FALSE;
652-
cond |= gui_gtk_is_no_blink();
653652
return cond;
654653
}
655654

@@ -681,7 +680,10 @@ draw_event(GtkWidget *widget,
681680
for (i = 0; i < list->num_rectangles; i++)
682681
{
683682
const cairo_rectangle_t rect = list->rectangles[i];
684-
gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
683+
if (blink_mode)
684+
gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
685+
else
686+
gui_redraw(rect.x, rect.y, rect.width, rect.height);
685687
}
686688
}
687689
cairo_rectangle_list_destroy(list);
@@ -790,20 +792,33 @@ gui_gtk_is_blink_on(void)
790792
{
791793
return blink_state == BLINK_ON;
792794
}
793-
794-
static gboolean
795-
gui_gtk_is_no_blink(void)
796-
{
797-
return blink_waittime == 0 || blink_ontime == 0 || blink_offtime == 0;
798-
}
799795
#endif
800796

801797
void
802798
gui_mch_set_blinking(long waittime, long on, long off)
803799
{
800+
#if GTK_CHECK_VERSION(3,0,0)
801+
if (waittime == 0 || on == 0 || off == 0)
802+
{
803+
blink_mode = FALSE;
804+
805+
blink_waittime = 700;
806+
blink_ontime = 400;
807+
blink_offtime = 250;
808+
}
809+
else
810+
{
811+
blink_mode = TRUE;
812+
813+
blink_waittime = waittime;
814+
blink_ontime = on;
815+
blink_offtime = off;
816+
}
817+
#else
804818
blink_waittime = waittime;
805819
blink_ontime = on;
806820
blink_offtime = off;
821+
#endif
807822
}
808823

809824
/*

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ static char *(features[]) =
743743

744744
static int included_patches[] =
745745
{ /* Add new patch number below this line */
746+
/**/
747+
1497,
746748
/**/
747749
1496,
748750
/**/

0 commit comments

Comments
 (0)