To: [email protected]
Subject: Patch 7.4a.038
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4a.038
Problem:    When using MSVC 2012 there are various issues, including GUI size
           computations.
Solution:   Use SM_CXPADDEDBORDER. (Mike Williams)
Files:      src/gui_w32.c, src/gui_w48.c, src/os_win32.h


*** ../vim-7.4a.037/src/gui_w32.c       2013-07-21 17:46:38.000000000 +0200
--- src/gui_w32.c       2013-07-21 17:51:37.000000000 +0200
***************
*** 1694,1701 ****
     }

     /* compute the size of the outside of the window */
!     win_width = width + GetSystemMetrics(SM_CXFRAME) * 2;
!     win_height = height + GetSystemMetrics(SM_CYFRAME) * 2
                       + GetSystemMetrics(SM_CYCAPTION)
 #ifdef FEAT_MENU
                       + gui_mswin_get_menu_height(FALSE)
--- 1694,1703 ----
     }

     /* compute the size of the outside of the window */
!     win_width = width + (GetSystemMetrics(SM_CXFRAME) +
!                          GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
!     win_height = height + (GetSystemMetrics(SM_CYFRAME) +
!                            GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
                       + GetSystemMetrics(SM_CYCAPTION)
 #ifdef FEAT_MENU
                       + gui_mswin_get_menu_height(FALSE)
***************
*** 2546,2558 ****
     get_work_area(&workarea_rect);

     *screen_w = workarea_rect.right - workarea_rect.left
!               - GetSystemMetrics(SM_CXFRAME) * 2;

     /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include
      * the menubar for MSwin, we subtract it from the screen height, so that
      * the window size can be made to fit on the screen. */
     *screen_h = workarea_rect.bottom - workarea_rect.top
!               - GetSystemMetrics(SM_CYFRAME) * 2
               - GetSystemMetrics(SM_CYCAPTION)
 #ifdef FEAT_MENU
               - gui_mswin_get_menu_height(FALSE)
--- 2548,2562 ----
     get_work_area(&workarea_rect);

     *screen_w = workarea_rect.right - workarea_rect.left
!               - (GetSystemMetrics(SM_CXFRAME) +
!                    GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;

     /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include
      * the menubar for MSwin, we subtract it from the screen height, so that
      * the window size can be made to fit on the screen. */
     *screen_h = workarea_rect.bottom - workarea_rect.top
!               - (GetSystemMetrics(SM_CYFRAME) +
!                    GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
               - GetSystemMetrics(SM_CYCAPTION)
 #ifdef FEAT_MENU
               - gui_mswin_get_menu_height(FALSE)
***************
*** 3182,3193 ****
       /* Use our own window for the size, unless it's very small. */
       GetWindowRect(s_hwnd, &rect);
       maxDialogWidth = rect.right - rect.left
!                                          - GetSystemMetrics(SM_CXFRAME) * 2;
       if (maxDialogWidth < DLG_MIN_MAX_WIDTH)
           maxDialogWidth = DLG_MIN_MAX_WIDTH;

       maxDialogHeight = rect.bottom - rect.top
!                                          - GetSystemMetrics(SM_CXFRAME) * 2;
       if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
           maxDialogHeight = DLG_MIN_MAX_HEIGHT;
     }
--- 3186,3199 ----
       /* Use our own window for the size, unless it's very small. */
       GetWindowRect(s_hwnd, &rect);
       maxDialogWidth = rect.right - rect.left
!                                  - (GetSystemMetrics(SM_CXFRAME) +
!                                       GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
       if (maxDialogWidth < DLG_MIN_MAX_WIDTH)
           maxDialogWidth = DLG_MIN_MAX_WIDTH;

       maxDialogHeight = rect.bottom - rect.top
!                                  - (GetSystemMetrics(SM_CXFRAME) +
!                                       GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
       if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
           maxDialogHeight = DLG_MIN_MAX_HEIGHT;
     }
*** ../vim-7.4a.037/src/gui_w48.c       2013-07-21 17:46:38.000000000 +0200
--- src/gui_w48.c       2013-07-21 17:51:37.000000000 +0200
***************
*** 2909,2917 ****
     int           base_width, base_height;

     base_width = gui_get_base_width()
!       + GetSystemMetrics(SM_CXFRAME) * 2;
     base_height = gui_get_base_height()
!       + GetSystemMetrics(SM_CYFRAME) * 2
       + GetSystemMetrics(SM_CYCAPTION)
 #ifdef FEAT_MENU
       + gui_mswin_get_menu_height(FALSE)
--- 2909,2919 ----
     int           base_width, base_height;

     base_width = gui_get_base_width()
!       + (GetSystemMetrics(SM_CXFRAME) +
!            GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
     base_height = gui_get_base_height()
!       + (GetSystemMetrics(SM_CYFRAME) +
!            GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
       + GetSystemMetrics(SM_CYCAPTION)
 #ifdef FEAT_MENU
       + gui_mswin_get_menu_height(FALSE)
***************
*** 3274,3282 ****

     GetWindowRect(s_hwnd, &rect);
     gui_resize_shell(rect.right - rect.left
!                       - GetSystemMetrics(SM_CXFRAME) * 2,
                    rect.bottom - rect.top
!                       - GetSystemMetrics(SM_CYFRAME) * 2
                       - GetSystemMetrics(SM_CYCAPTION)
 #ifdef FEAT_MENU
                       - gui_mswin_get_menu_height(FALSE)
--- 3276,3286 ----

     GetWindowRect(s_hwnd, &rect);
     gui_resize_shell(rect.right - rect.left
!                       - (GetSystemMetrics(SM_CXFRAME) +
!                            GetSystemMetrics(SM_CXPADDEDBORDER)) * 2,
                    rect.bottom - rect.top
!                       - (GetSystemMetrics(SM_CYFRAME) +
!                            GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
                       - GetSystemMetrics(SM_CYCAPTION)
 #ifdef FEAT_MENU
                       - gui_mswin_get_menu_height(FALSE)
*** ../vim-7.4a.037/src/os_win32.h      2013-06-29 15:38:50.000000000 +0200
--- src/os_win32.h      2013-07-21 17:53:13.000000000 +0200
***************
*** 102,107 ****
--- 102,110 ----
 #endif
 #ifndef PROTO
 # include <windows.h>
+ # ifndef SM_CXPADDEDBORDER
+ #  define SM_CXPADDEDBORDER     92
+ # endif
 #endif

 /*
*** ../vim-7.4a.037/src/version.c       2013-07-21 17:46:38.000000000 +0200
--- src/version.c       2013-07-21 17:52:14.000000000 +0200
***************
*** 729,730 ****
--- 729,732 ----
 {   /* Add new patch number below this line */
+ /**/
+     38,
 /**/

--
hundred-and-one symptoms of being an internet addict:
5. You find yourself brainstorming for new subjects to search.

/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
\\\            help me help AIDS victims -- http://ICCF-Holland.org    ///