Loading ...
Sorry, an error occurred while loading the content.

Re: Patch - Win32 GVIM (SW_INVALIDATE)

Expand Messages
  • Walter Briscoe
    In message of Thu, 2 Oct 2003 17:57:26 in , Michael Wookey (AU)
    Message 1 of 32 , Oct 2, 2003
    • 0 Attachment
      In message <34611C909B4FD611BB2000508BA8EEEA02D09299@...
      m.au> of Thu, 2 Oct 2003 17:57:26 in , "Michael Wookey (AU)"
      <michael.wookey@...> writes
      >
      >Hi,
      >
      >I have a small patch for GVIM (Win32) that improves display
      >performance. On my laptop (WinXP with nVidia graphics), half/full page
      >scrolling in GVIM is quite slow due to the refresh required for the
      >GVIM window. I tracked this down to src/gui_w
      >48.c:gui_mch_delete_lines(). A comment in this function states:
      >
      >     /* The SW_INVALIDATE is required when part of the window is
      >covered or
      >      * off-screen.  How do we avoid it when it's not needed? */
      >
      >It is this invalidation of the window region which is the problem. The
      >solution is to only use the SW_INVALIDATE flag when the GVIM window is
      >obscured. To determine if a window is obscured, refer to Microsoft KB
      >Q75236.
      >
      >cheers
      >
      >--- gui_w48.c.orig      Thu Oct 02 16:48:00 2003
      >+++ gui_w48.c   Thu Oct 02 17:33:44 2003
      [snip]
      >[ A MIME text / plain part was included here. ]
      I take it that this is your first patch. We all start somewhere ;-) I
      find "quite slow" needlessly qualitative where I want to see
      quantitative data. I tested on a 4514 line file with 45 lines displayed
      per screen by holding down the "Page Dn" button with gvim in full screen
      mode. My laptop runs Win2K with an "ATI RAGE MOBILITY-M1 AGP2X
      (English)" display adapter. My base system is gvim 6.2 with no patches
      applied. I timed by doing 1 and 2 and ... and estimated 16 seconds
      before and after applying the patch. The patch gave a diagnostic with
      Visual C++ 6.0 and the command line 'nmake /f Make_ivc.mak cfg="Vim -
      Win32 Debug gvim OLE"'. I changed "UINT flags = NULL" to "UINT flags =
      0". Bram has a patch form relative to the parent directory which makes
      him more comfortable. I have recast the change so. At the moment, my
      opinion is that the patch should NOT be applied. I hope:
      1) somebody will tell me a better way of timing a test;
      2) somebody will supply a scenario with numbers justifying the
      application of the patch.

      *** src/gui_w48.c.0 Sun May 25 16:26:06 2003
      --- src/gui_w48.c Thu Oct 2 09:21:21 2003
      ***************
      *** 2360,2375 ****
      int num_lines)
      {
      RECT rc;

      rc.left = FILL_X(gui.scroll_region_left);
      rc.right = FILL_X(gui.scroll_region_right + 1);
      rc.top = FILL_Y(row);
      rc.bottom = FILL_Y(gui.scroll_region_bot + 1);
      /* The SW_INVALIDATE is required when part of the window is covered or
      ! * off-screen. How do we avoid it when it's not needed? */
      ! ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height,
      ! &rc, &rc, NULL, NULL, SW_INVALIDATE);

      UpdateWindow(s_textArea);
      /* This seems to be required to avoid the cursor disappearing when
      * scrolling such that the cursor ends up in the top-left character on
      --- 2360,2393 ----
      int num_lines)
      {
      RECT rc;
      + RECT rcVim, rcOther, rcDest;
      + HWND hPrevWnd, hNextWnd;
      + UINT flags = 0;

      rc.left = FILL_X(gui.scroll_region_left);
      rc.right = FILL_X(gui.scroll_region_right + 1);
      rc.top = FILL_Y(row);
      rc.bottom = FILL_Y(gui.scroll_region_bot + 1);
      /* The SW_INVALIDATE is required when part of the window is covered or
      ! * off-screen. Refer to MS KB Q75236. */
      !
      ! GetWindowRect(s_hwnd, &rcVim);

      + for (hPrevWnd = s_hwnd ;
      + hNextWnd = GetWindow(hPrevWnd, GW_HWNDPREV) ;
      + hPrevWnd = hNextWnd)
      + {
      + GetWindowRect(hNextWnd, &rcOther);
      + if (IsWindowVisible(hNextWnd) &&
      + IntersectRect(&rcDest, &rcVim, &rcOther))
      + {
      + flags = SW_INVALIDATE;
      + break;
      + }
      + }
      +
      + ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height,
      + &rc, &rc, NULL, NULL, flags);
      UpdateWindow(s_textArea);
      /* This seems to be required to avoid the cursor disappearing when
      * scrolling such that the cursor ends up in the top-left character on

      BTW. It seems wasteful of bandwidth to send your message in both text
      and html. Are you able to eliminate the html?
      --
      Walter Briscoe
    • Michael Wookey
      ... Helmut s patch works correctly with overlapping windows. It is simply slow. When gvim is obscured by the task bar, it will leave text trails while
      Message 32 of 32 , Oct 9, 2003
      • 0 Attachment
        Bram Moolenaar wrote:

        > Also check what happens if part of the Vim window extends to below the
        > screen and then scroll up the text (with commands, scrollbar or mouse
        > scroll wheel).

        Helmut's patch works correctly with overlapping windows. It is simply slow. When
        gvim is obscured by the task bar, it will leave "text trails" while scrolling,
        but redraw correctly when scrolling stops.

        cheers
      Your message has been successfully submitted and would be delivered to recipients shortly.