diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-01-31 20:51:47 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-01-31 20:51:47 +0100 |
commit | a338adcf222b6a24e26ea5ae6a2ad27f914acb38 (patch) | |
tree | 0ffe28d0a3a60c2c1444a991514505c448d4335b /src/gui.c | |
parent | 37badc898b8d167e11553b6d05908ffd35928a6e (diff) | |
download | vim-git-a338adcf222b6a24e26ea5ae6a2ad27f914acb38.tar.gz |
patch 8.0.1449: slow redrawing with DirectXv8.0.1449
Problem: Slow redrawing with DirectX.
Solution: Avoid calling gui_mch_flush() unnecessarily, especially when
updating the cursor. (Ken Takata, closes #2560)
Diffstat (limited to 'src/gui.c')
-rw-r--r-- | src/gui.c | 48 |
1 files changed, 36 insertions, 12 deletions
@@ -55,6 +55,7 @@ enum { static void gui_attempt_start(void); static int can_update_cursor = TRUE; /* can display the cursor */ +static int disable_flush = 0; /* If > 0, gui_mch_flush() is disabled. */ /* * The Athena scrollbars can move the thumb to after the end of the scrollbar, @@ -1976,7 +1977,7 @@ gui_write( gui.dragged_sb = SBAR_NONE; #endif - gui_mch_flush(); /* In case vim decides to take a nap */ + gui_may_flush(); /* In case vim decides to take a nap */ } /* @@ -2004,6 +2005,34 @@ gui_can_update_cursor(void) * after scrolling. */ } +/* + * Disable issuing gui_mch_flush(). + */ + void +gui_disable_flush(void) +{ + ++disable_flush; +} + +/* + * Enable issuing gui_mch_flush(). + */ + void +gui_enable_flush(void) +{ + --disable_flush; +} + +/* + * Issue gui_mch_flush() if it is not disabled. + */ + void +gui_may_flush(void) +{ + if (disable_flush == 0) + gui_mch_flush(); +} + static void gui_outstr(char_u *s, int len) { @@ -3682,7 +3711,6 @@ gui_update_tabline(void) /* Updating the tabline uses direct GUI commands, flush * outstanding instructions first. (esp. clear screen) */ out_flush(); - gui_mch_flush(); if (!showit != !shown) gui_mch_show_tabline(showit); @@ -4122,8 +4150,7 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging) setcursor(); } # endif - out_flush(); - gui_update_cursor(FALSE, TRUE); + out_flush_cursor(FALSE, TRUE); #else add_to_input_buf(bytes, byte_count); add_long_to_buf((long_u)value, bytes); @@ -4486,7 +4513,9 @@ gui_do_scroll(void) * disappear when losing focus after a scrollbar drag. */ if (wp->w_redr_type < type) wp->w_redr_type = type; + mch_disable_flush(); updateWindow(wp); /* update window, status line, and cmdline */ + mch_enable_flush(); } #ifdef FEAT_INS_EXPAND @@ -4797,8 +4826,7 @@ gui_focus_change(int in_focus) */ #if 1 gui.in_focus = in_focus; - out_flush(); /* make sure output has been written */ - gui_update_cursor(TRUE, FALSE); + out_flush_cursor(TRUE, FALSE); # ifdef FEAT_XIM xim_set_focus(in_focus); @@ -5157,9 +5185,7 @@ gui_update_screen(void) curwin->w_valid &= ~VALID_CROW; } # endif - out_flush(); /* make sure output has been written */ - gui_update_cursor(TRUE, FALSE); - gui_mch_flush(); + out_flush_cursor(TRUE, FALSE); } #endif @@ -5516,9 +5542,7 @@ gui_handle_drop( maketitle(); #endif setcursor(); - out_flush(); - gui_update_cursor(FALSE, FALSE); - gui_mch_flush(); + out_flush_cursor(FALSE, FALSE); } entered = FALSE; |