diff options
Diffstat (limited to 'src/os_win32.c')
-rw-r--r-- | src/os_win32.c | 66 |
1 files changed, 11 insertions, 55 deletions
diff --git a/src/os_win32.c b/src/os_win32.c index af2622caeb..5d544b2413 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -243,27 +243,6 @@ static char_u *exe_path = NULL; static BOOL win8_or_later = FALSE; -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) -// Dynamic loading for portability -typedef struct _DYN_CONSOLE_SCREEN_BUFFER_INFOEX -{ - ULONG cbSize; - COORD dwSize; - COORD dwCursorPosition; - WORD wAttributes; - SMALL_RECT srWindow; - COORD dwMaximumWindowSize; - WORD wPopupAttributes; - BOOL bFullscreenSupported; - COLORREF ColorTable[16]; -} DYN_CONSOLE_SCREEN_BUFFER_INFOEX, *PDYN_CONSOLE_SCREEN_BUFFER_INFOEX; -typedef BOOL (WINAPI *PfnGetConsoleScreenBufferInfoEx)(HANDLE, PDYN_CONSOLE_SCREEN_BUFFER_INFOEX); -static PfnGetConsoleScreenBufferInfoEx pGetConsoleScreenBufferInfoEx; -typedef BOOL (WINAPI *PfnSetConsoleScreenBufferInfoEx)(HANDLE, PDYN_CONSOLE_SCREEN_BUFFER_INFOEX); -static PfnSetConsoleScreenBufferInfoEx pSetConsoleScreenBufferInfoEx; -static BOOL has_csbiex = FALSE; -#endif - /* * Get version number including build number */ @@ -7882,30 +7861,13 @@ vtp_flag_init(void) static void vtp_init(void) { - HMODULE hKerneldll; - DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + CONSOLE_SCREEN_BUFFER_INFOEX csbi; # ifdef FEAT_TERMGUICOLORS COLORREF fg; # endif - // Use functions supported from Vista - hKerneldll = GetModuleHandle("kernel32.dll"); - if (hKerneldll != NULL) - { - pGetConsoleScreenBufferInfoEx = - (PfnGetConsoleScreenBufferInfoEx)GetProcAddress( - hKerneldll, "GetConsoleScreenBufferInfoEx"); - pSetConsoleScreenBufferInfoEx = - (PfnSetConsoleScreenBufferInfoEx)GetProcAddress( - hKerneldll, "SetConsoleScreenBufferInfoEx"); - if (pGetConsoleScreenBufferInfoEx != NULL - && pSetConsoleScreenBufferInfoEx != NULL) - has_csbiex = TRUE; - } - csbi.cbSize = sizeof(csbi); - if (has_csbiex) - pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + GetConsoleScreenBufferInfoEx(g_hConOut, &csbi); save_console_bg_rgb = (guicolor_T)csbi.ColorTable[g_color_index_bg]; save_console_fg_rgb = (guicolor_T)csbi.ColorTable[g_color_index_fg]; store_console_bg_rgb = save_console_bg_rgb; @@ -8134,7 +8096,7 @@ ctermtoxterm( set_console_color_rgb(void) { # ifdef FEAT_TERMGUICOLORS - DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + CONSOLE_SCREEN_BUFFER_INFOEX csbi; guicolor_T fg, bg; int ctermfg, ctermbg; @@ -8154,8 +8116,7 @@ set_console_color_rgb(void) bg = (GetRValue(bg) << 16) | (GetGValue(bg) << 8) | GetBValue(bg); csbi.cbSize = sizeof(csbi); - if (has_csbiex) - pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + GetConsoleScreenBufferInfoEx(g_hConOut, &csbi); csbi.cbSize = sizeof(csbi); csbi.srWindow.Right += 1; @@ -8164,8 +8125,7 @@ set_console_color_rgb(void) store_console_fg_rgb = csbi.ColorTable[g_color_index_fg]; csbi.ColorTable[g_color_index_bg] = (COLORREF)bg; csbi.ColorTable[g_color_index_fg] = (COLORREF)fg; - if (has_csbiex) - pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + SetConsoleScreenBufferInfoEx(g_hConOut, &csbi); # endif } @@ -8231,22 +8191,20 @@ get_default_console_color( reset_console_color_rgb(void) { # ifdef FEAT_TERMGUICOLORS - DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + CONSOLE_SCREEN_BUFFER_INFOEX csbi; if (USE_WT) return; csbi.cbSize = sizeof(csbi); - if (has_csbiex) - pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + GetConsoleScreenBufferInfoEx(g_hConOut, &csbi); csbi.cbSize = sizeof(csbi); csbi.srWindow.Right += 1; csbi.srWindow.Bottom += 1; csbi.ColorTable[g_color_index_bg] = (COLORREF)store_console_bg_rgb; csbi.ColorTable[g_color_index_fg] = (COLORREF)store_console_fg_rgb; - if (has_csbiex) - pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + SetConsoleScreenBufferInfoEx(g_hConOut, &csbi); # endif } @@ -8257,19 +8215,17 @@ reset_console_color_rgb(void) restore_console_color_rgb(void) { # ifdef FEAT_TERMGUICOLORS - DYN_CONSOLE_SCREEN_BUFFER_INFOEX csbi; + CONSOLE_SCREEN_BUFFER_INFOEX csbi; csbi.cbSize = sizeof(csbi); - if (has_csbiex) - pGetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + GetConsoleScreenBufferInfoEx(g_hConOut, &csbi); csbi.cbSize = sizeof(csbi); csbi.srWindow.Right += 1; csbi.srWindow.Bottom += 1; csbi.ColorTable[g_color_index_bg] = (COLORREF)save_console_bg_rgb; csbi.ColorTable[g_color_index_fg] = (COLORREF)save_console_fg_rgb; - if (has_csbiex) - pSetConsoleScreenBufferInfoEx(g_hConOut, &csbi); + SetConsoleScreenBufferInfoEx(g_hConOut, &csbi); # endif } |