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

Patch - Win32 GVIM (SW_INVALIDATE)

Expand Messages
  • Michael Wookey (AU)
    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
    Message 1 of 32 , Oct 2, 2003
    • 0 Attachment
      Patch - Win32 GVIM (SW_INVALIDATE)

      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_w48.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
      @@ -2360,16 +2360,34 @@
            int           num_lines)
        {
            RECT      rc;
      +    RECT       rcVim, rcOther, rcDest;
      +    HWND       hPrevWnd, hNextWnd;
      +    UINT       flags = NULL;

            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);
      +     * 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

       

    • 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.