1
0
forked from aniani/vim

updated for version 7.4a.038

Problem:    When using MSVC 2012 there are various issues, including GUI size
            computations.
Solution:   Use SM_CXPADDEDBORDER. (Mike Williams)
This commit is contained in:
Bram Moolenaar
2013-07-21 17:53:58 +02:00
parent 5f919ee8eb
commit 9d48895e4c
4 changed files with 25 additions and 10 deletions

View File

@@ -1694,8 +1694,10 @@ gui_mch_set_shellsize(int width, int height,
} }
/* compute the size of the outside of the window */ /* compute the size of the outside of the window */
win_width = width + GetSystemMetrics(SM_CXFRAME) * 2; win_width = width + (GetSystemMetrics(SM_CXFRAME) +
win_height = height + GetSystemMetrics(SM_CYFRAME) * 2 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
win_height = height + (GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
+ GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYCAPTION)
#ifdef FEAT_MENU #ifdef FEAT_MENU
+ gui_mswin_get_menu_height(FALSE) + gui_mswin_get_menu_height(FALSE)
@@ -2546,13 +2548,15 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
get_work_area(&workarea_rect); get_work_area(&workarea_rect);
*screen_w = workarea_rect.right - workarea_rect.left *screen_w = workarea_rect.right - workarea_rect.left
- GetSystemMetrics(SM_CXFRAME) * 2; - (GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
/* FIXME: dirty trick: Because the gui_get_base_height() doesn't include /* 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 menubar for MSwin, we subtract it from the screen height, so that
* the window size can be made to fit on the screen. */ * the window size can be made to fit on the screen. */
*screen_h = workarea_rect.bottom - workarea_rect.top *screen_h = workarea_rect.bottom - workarea_rect.top
- GetSystemMetrics(SM_CYFRAME) * 2 - (GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
- GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYCAPTION)
#ifdef FEAT_MENU #ifdef FEAT_MENU
- gui_mswin_get_menu_height(FALSE) - gui_mswin_get_menu_height(FALSE)
@@ -3182,12 +3186,14 @@ gui_mch_dialog(
/* Use our own window for the size, unless it's very small. */ /* Use our own window for the size, unless it's very small. */
GetWindowRect(s_hwnd, &rect); GetWindowRect(s_hwnd, &rect);
maxDialogWidth = rect.right - rect.left maxDialogWidth = rect.right - rect.left
- GetSystemMetrics(SM_CXFRAME) * 2; - (GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
if (maxDialogWidth < DLG_MIN_MAX_WIDTH) if (maxDialogWidth < DLG_MIN_MAX_WIDTH)
maxDialogWidth = DLG_MIN_MAX_WIDTH; maxDialogWidth = DLG_MIN_MAX_WIDTH;
maxDialogHeight = rect.bottom - rect.top maxDialogHeight = rect.bottom - rect.top
- GetSystemMetrics(SM_CXFRAME) * 2; - (GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
if (maxDialogHeight < DLG_MIN_MAX_HEIGHT) if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
maxDialogHeight = DLG_MIN_MAX_HEIGHT; maxDialogHeight = DLG_MIN_MAX_HEIGHT;
} }

View File

@@ -2909,9 +2909,11 @@ gui_mswin_get_valid_dimensions(
int base_width, base_height; int base_width, base_height;
base_width = gui_get_base_width() base_width = gui_get_base_width()
+ GetSystemMetrics(SM_CXFRAME) * 2; + (GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
base_height = gui_get_base_height() base_height = gui_get_base_height()
+ GetSystemMetrics(SM_CYFRAME) * 2 + (GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
+ GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYCAPTION)
#ifdef FEAT_MENU #ifdef FEAT_MENU
+ gui_mswin_get_menu_height(FALSE) + gui_mswin_get_menu_height(FALSE)
@@ -3274,9 +3276,11 @@ gui_mch_newfont()
GetWindowRect(s_hwnd, &rect); GetWindowRect(s_hwnd, &rect);
gui_resize_shell(rect.right - rect.left gui_resize_shell(rect.right - rect.left
- GetSystemMetrics(SM_CXFRAME) * 2, - (GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2,
rect.bottom - rect.top rect.bottom - rect.top
- GetSystemMetrics(SM_CYFRAME) * 2 - (GetSystemMetrics(SM_CYFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
- GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYCAPTION)
#ifdef FEAT_MENU #ifdef FEAT_MENU
- gui_mswin_get_menu_height(FALSE) - gui_mswin_get_menu_height(FALSE)

View File

@@ -102,6 +102,9 @@
#endif #endif
#ifndef PROTO #ifndef PROTO
# include <windows.h> # include <windows.h>
# ifndef SM_CXPADDEDBORDER
# define SM_CXPADDEDBORDER 92
# endif
#endif #endif
/* /*

View File

@@ -727,6 +727,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
38,
/**/ /**/
37, 37,
/**/ /**/