From 4398cc83945de8165e3713fdfa76499c2b3a55fa Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 20 Jan 2015 13:28:02 +0100 Subject: vcl: remove dependency of SalShlData on GetVersionEx() 4500afcc1be7774b3c35ab69a20e36165ca5445a was incomplete in that the result of GetVersionEx() is actually stored and other functions do manual checks on it. Change-Id: I1f66a13e98e6bfc40bc35fa5382c2f6257f905d6 --- vcl/inc/win/saldata.hxx | 2 +- vcl/win/source/app/salinst.cxx | 24 +++++++++++++++--------- vcl/win/source/gdi/salnativewidgets-luna.cxx | 2 +- vcl/win/source/window/salframe.cxx | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx index 8151c143d08a..d61e26df9d2e 100644 --- a/vcl/inc/win/saldata.hxx +++ b/vcl/inc/win/saldata.hxx @@ -137,8 +137,8 @@ struct SalShlData UINT mnWheelScrollChars; // WheelScrollChars UINT mnWheelMsgId; // Wheel-Message-Id fuer W95 BOOL mbWXP; // Windows XP + BOOL mbWVista; // Windows Vista BOOL mbW7; // Windows 7 - OSVERSIONINFO maVersionInfo; }; extern SalShlData aSalShlData; diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 396b2544588c..fe24ffaa325a 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -448,24 +448,30 @@ SalInstance* CreateSalInstance() // determine the windows version aSalShlData.mbWXP = 0; + aSalShlData.mbWVista = 0; aSalShlData.mbW7 = 0; - memset( &aSalShlData.maVersionInfo, 0, sizeof(aSalShlData.maVersionInfo) ); - aSalShlData.maVersionInfo.dwOSVersionInfoSize = sizeof( aSalShlData.maVersionInfo ); // the Win32 SDK 8.1 deprecates GetVersionEx() #ifdef _WIN32_WINNT_WINBLUE aSalShlData.mbWXP = IsWindowsXPOrGreater() ? 1 : 0; + aSalShlData.mbWVista = IsWindowsVistaOrGreater() ? 1 : 0; aSalShlData.mbW7 = IsWindows7OrGreater() ? 1 : 0; #else - if ( GetVersionEx( &aSalShlData.maVersionInfo ) ) + OSVERSIONINFO aVersionInfo; + memset( &aVersionInfo, 0, sizeof(aVersionInfo) ); + aVersionInfo.dwOSVersionInfoSize = sizeof( aVersionInfo ); + if (GetVersionEx( &aVersionInfo )) { // Windows XP ? - if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 || - ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) ) + if (aVersionInfo.dwMajorVersion > 5 || + (aVersionInfo.dwMajorVersion == 5 && aVersionInfo.dwMinorVersion >= 1)) aSalShlData.mbWXP = 1; - // Windows 7 ? - if ( aSalShlData.maVersionInfo.dwMajorVersion > 6 || - ( aSalShlData.maVersionInfo.dwMajorVersion == 6 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) ) - aSalShlData.mbW7 = 1; + // Windows Vista ? + if (aVersionInfo.dwMajorVersion >= 6) + aSalShlData.mbWVista = 1; + // Windows 7 ? + if (aVersionInfo.dwMajorVersion > 6 || + (aVersionInfo.dwMajorVersion == 6 && aVersionInfo.dwMinorVersion >= 1)) + aSalShlData.mbW7 = 1; } #endif diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index a8d21ff6f1fb..179bc4e7b4c2 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -1538,7 +1538,7 @@ void WinSalGraphics::updateSettingsNative( AllSettings& rSettings ) // in Aero theme (and similar ?) the menu text color does not change // for selected items; also on WinXP and earlier menus are not themed // FIXME get the color directly from the theme, not from the settings - if( aSalShlData.maVersionInfo.dwMajorVersion >= 6 ) + if (aSalShlData.mbWVista) { Color aMenuBarTextColor = aStyleSettings.GetPersonaMenuBarTextColor().get_value_or( aStyleSettings.GetMenuTextColor() ); // in aero menuitem highlight text is drawn in the same color as normal diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index eb8f548f97ac..13c273a4af47 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -699,7 +699,7 @@ static UINT ImplSalGetWheelScrollChars() { // Depending on Windows version, use proper default or 1 (when // driver emulates hscroll) - if( aSalShlData.maVersionInfo.dwMajorVersion < 6 ) + if (!aSalShlData.mbWVista) { // Windows 2000 & WinXP : emulating driver, use step size // of 1 -- cgit