Mercurial > vim
changeset 15798:028c9fdb8469 v8.1.0906
patch 8.1.0906: using clumsy way to get console window handle
commit https://github.com/vim/vim/commit/e1ed53f3f95786c744d4b6c85bda4f476f67cc91
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 12 23:12:37 2019 +0100
patch 8.1.0906: using clumsy way to get console window handle
Problem: Using clumsy way to get console window handle.
Solution: Use GetConsoleWindow(). (Ken Takata, closes https://github.com/vim/vim/issues/3940)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 12 Feb 2019 23:15:07 +0100 |
parents | 1aa273169f87 |
children | 998dbbd92ee7 |
files | src/os_mswin.c src/version.c |
diffstat | 2 files changed, 3 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -1043,11 +1043,6 @@ extern HWND g_hWnd; /* This is in os_win static void GetConsoleHwnd(void) { -# define MY_BUFSIZE 1024 // Buffer size for console window titles. - - char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated WindowTitle. - char pszOldWindowTitle[MY_BUFSIZE]; // Contains original WindowTitle. - /* Skip if it's already set. */ if (s_hwnd != 0) return; @@ -1061,17 +1056,7 @@ GetConsoleHwnd(void) } # endif - GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE); - - wsprintf(pszNewWindowTitle, "%s/%d/%d", - pszOldWindowTitle, - GetTickCount(), - GetCurrentProcessId()); - SetConsoleTitle(pszNewWindowTitle); - Sleep(40); - s_hwnd = FindWindow(NULL, pszNewWindowTitle); - - SetConsoleTitle(pszOldWindowTitle); + s_hwnd = GetConsoleWindow(); } /*