diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-02-04 08:52:33 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-02-04 08:52:33 (GMT) |
commit | de445d487d5a80ad9c8a49d28f8db7d6a24b463e (patch) | |
tree | 782d114e8acacf526b660528a7be468dd31ce666 /win | |
parent | 0688248a16db42960dd4cd62e44565a1d940fe92 (diff) | |
parent | 6c6084d66c4ec111a3e3c9f4af5518d929313fef (diff) | |
download | tk-de445d487d5a80ad9c8a49d28f8db7d6a24b463e.zip tk-de445d487d5a80ad9c8a49d28f8db7d6a24b463e.tar.gz tk-de445d487d5a80ad9c8a49d28f8db7d6a24b463e.tar.bz2 |
Fix [http://core.tcl.tk/tcl/info/651e828a52|651e828a52]: Wrong Windows version reported for Windows 8.1.
Remove some dead code (since Win95/98/ME is no longer supported)
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinColor.c | 11 | ||||
-rw-r--r-- | win/tkWinDialog.c | 10 | ||||
-rw-r--r-- | win/tkWinX.c | 30 |
3 files changed, 23 insertions, 28 deletions
diff --git a/win/tkWinColor.c b/win/tkWinColor.c index fee3ee2..5eaeeb3 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -97,7 +97,6 @@ FindSystemColor( { int l, u, r, i; int index; - int version = LOBYTE(LOWORD(GetVersion())); /* * Perform a binary search on the sorted array of colors. @@ -120,15 +119,7 @@ FindSystemColor( return 0; } - index = sysColors[i].index; - if (version < 4) { - if (index == COLOR_3DDKSHADOW) { - index = COLOR_BTNSHADOW; - } else if (index == COLOR_3DLIGHT) { - index = COLOR_BTNHIGHLIGHT; - } - } - *indexPtr = index; + *indexPtr = index = sysColors[i].index; colorPtr->pixel = GetSysColor(index); /* diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 277cd9f..baebfc9 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -46,10 +46,6 @@ #endif #endif /* BFFM_VALIDATEFAILED */ -#ifndef OPENFILENAME_SIZE_VERSION_400 -#define OPENFILENAME_SIZE_VERSION_400 76 -#endif - typedef struct ThreadSpecificData { int debugFlag; /* Flags whether we should output debugging * information while displaying a builtin @@ -680,11 +676,7 @@ GetFileName( hWnd = Tk_GetHWND(Tk_WindowId(tkwin)); ZeroMemory(&ofn, sizeof(OPENFILENAME)); - if (LOBYTE(LOWORD(GetVersion())) < 5) { - ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - } else { - ofn.lStructSize = sizeof(OPENFILENAME); - } + ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hWnd; ofn.hInstance = TkWinGetHInstance(ofn.hwndOwner); ofn.lpstrFile = file; diff --git a/win/tkWinX.c b/win/tkWinX.c index 86010e9..3857691 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -120,19 +120,31 @@ TkGetServerInfo( Tk_Window tkwin) /* Token for window; this selects a particular * display and server. */ { + static char buffer[32]; /* Empty string means not initialized yet. */ OSVERSIONINFOW os; - os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); - GetVersionExW(&os); - Tcl_SetObjResult(interp, Tcl_ObjPrintf("Windows %d.%d %d %s", - (int) os.dwMajorVersion, (int) os.dwMinorVersion, - (int) os.dwBuildNumber, + if (!buffer[0]) { + HANDLE handle = LoadLibraryW(L"NTDLL"); + int(*getversion)(void *) = (int(*)(void *))GetProcAddress(handle, "RtlGetVersion"); + os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + if (!getversion || getversion(&os)) { + GetVersionExW(&os); + } + if (handle) { + FreeLibrary(handle); + } + /* Write the first character last, preventing multi-thread issues. */ + sprintf(buffer+1, "indows %d.%d %d %s", (int)os.dwMajorVersion, + (int)os.dwMinorVersion, (int)os.dwBuildNumber, #ifdef _WIN64 - "Win64" + "Win64" #else - "Win32" + "Win32" #endif - )); + ); + buffer[0] = 'W'; + } + Tcl_AppendResult(interp, buffer, NULL); } /* @@ -313,7 +325,7 @@ TkWinXCleanup( * The return value is one of: * VER_PLATFORM_WIN32s Win32s on Windows 3.1 (not supported) * VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95, 98, ME (not supported) - * VER_PLATFORM_WIN32_NT Win32 on Windows NT, 2000, XP + * VER_PLATFORM_WIN32_NT Win32 on Windows XP, Vista, Windows 7, Windows 8 * VER_PLATFORM_WIN32_CE Win32 on Windows CE * * Side effects: |