summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-28 12:40:42 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-29 14:55:11 +0200
commit0dd2e602e5c1b46e82abc6051677aeaab1d265b8 (patch)
tree7f7a1cbc9cb87c38c732d4691129bf81dc1d04ff /vcl
parent8b12c98ec7ec0b5ba20c28890ee63803fb9518d5 (diff)
Drop check for Windows versions we don't support
Since we dropped support of Vista and below in master toward 6.0, those checks are needless. Removing the code that only worked in older versions, and streamlining the resulting code. Also, use kernel32.dll version for Windows version, instead of deprecated GetVersionEx, and inconvenient VersionHelpers. Since both GetVersion(Ex) and VersionHelpers (based on VerifyVersionInfo) are subject to manifest-based behavior since Windows 8.1, this move will hopefully result in more reliable OS version detection. Change-Id: I3edd8fc1843e64b6a65bd3a126be6a085511f13c Reviewed-on: https://gerrit.libreoffice.org/42905 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/win/saldata.hxx3
-rw-r--r--vcl/opengl/win/WinDeviceInfo.cxx58
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx44
-rw-r--r--vcl/win/app/salinst.cxx175
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx24
-rw-r--r--vcl/win/window/salframe.cxx97
6 files changed, 180 insertions, 221 deletions
diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index db6771c8095e..5b0e638c3c00 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -134,9 +134,6 @@ struct SalShlData
HINSTANCE mhInst; // Instance of SAL-DLL
UINT mnWheelScrollLines; // WheelScrollLines
UINT mnWheelScrollChars; // WheelScrollChars
- BOOL mbWXP; // Windows XP
- BOOL mbWVista; // Windows Vista
- BOOL mbW7; // Windows 7
};
extern SalShlData aSalShlData;
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index 2ec963491327..d885389b0510 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -20,6 +20,7 @@
#include <setupapi.h>
#include <algorithm>
#include <cstdint>
+#include <memory>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
@@ -149,14 +150,14 @@ uint32_t ParseIDFromDeviceID(const OUString &key, const char *prefix, int length
// OS version in 16.16 major/minor form
// based on http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx
enum {
- kWindowsUnknown = 0,
- kWindowsXP = 0x00050001,
+ kWindowsUnknown = 0,
+ kWindowsXP = 0x00050001,
kWindowsServer2003 = 0x00050002,
- kWindowsVista = 0x00060000,
- kWindows7 = 0x00060001,
- kWindows8 = 0x00060002,
- kWindows8_1 = 0x00060003,
- kWindows10 = 0x000A0000 // Major 10 Minor 0
+ kWindowsVista = 0x00060000,
+ kWindows7 = 0x00060001,
+ kWindows8 = 0x00060002,
+ kWindows8_1 = 0x00060003,
+ kWindows10 = 0x000A0000 // Major 10 Minor 0
};
@@ -189,23 +190,38 @@ int32_t WindowsOSVersion()
{
static int32_t winVersion = kWindowsUnknown;
- OSVERSIONINFO vinfo;
-
if (winVersion == kWindowsUnknown)
{
- vinfo.dwOSVersionInfoSize = sizeof (vinfo);
-#pragma warning(push)
-#pragma warning(disable:4996)
- SAL_WNODEPRECATED_DECLARATIONS_PUSH
- if (!GetVersionEx(&vinfo))
- SAL_WNODEPRECATED_DECLARATIONS_POP
- {
-#pragma warning(pop)
- winVersion = kWindowsUnknown;
- }
- else
+ // GetVersion(Ex) and VersionHelpers (based on VerifyVersionInfo) API are
+ // subject to manifest-based behavior since Windows 8.1, so give wrong results.
+ // Another approach would be to use NetWkstaGetInfo, but that has some small
+ // reported delays (some milliseconds), and might get slower in domains with
+ // poor network connections.
+ // So go with a solution described at https://msdn.microsoft.com/en-us/library/ms724429
+ HINSTANCE hLibrary = LoadLibraryW(L"kernel32.dll");
+ if (hLibrary != nullptr)
{
- winVersion = int32_t(vinfo.dwMajorVersion << 16) + vinfo.dwMinorVersion;
+ wchar_t szPath[MAX_PATH];
+ DWORD dwCount = GetModuleFileNameW(hLibrary, szPath, SAL_N_ELEMENTS(szPath));
+ FreeLibrary(hLibrary);
+ if (dwCount != 0 && dwCount < SAL_N_ELEMENTS(szPath))
+ {
+ dwCount = GetFileVersionInfoSizeW(szPath, NULL);
+ if (dwCount != 0)
+ {
+ std::unique_ptr<char> ver(new char[dwCount]);
+ if (GetFileVersionInfoW(szPath, 0, dwCount, ver.get()) != FALSE)
+ {
+ void* pBlock = nullptr;
+ UINT dwBlockSz = 0;
+ if (VerQueryValueW(ver.get(), L"\\", &pBlock, &dwBlockSz) != FALSE && dwBlockSz >= sizeof(VS_FIXEDFILEINFO))
+ {
+ VS_FIXEDFILEINFO *vinfo = reinterpret_cast<VS_FIXEDFILEINFO *>(pBlock);
+ winVersion = int32_t(vinfo->dwProductVersionMS);
+ }
+ }
+ }
+ }
}
}
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index f9443f708bd2..146d810b632d 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -197,6 +197,28 @@ namespace
return getHexString(pBuffer, RTL_DIGEST_LENGTH_MD5);
}
+ OString getDeviceInfoString()
+ {
+#if defined( SAL_UNX ) && !defined( MACOSX ) && !defined( IOS )&& !defined( ANDROID )
+ const X11OpenGLDeviceInfo aInfo;
+ return aInfo.GetOS() +
+ aInfo.GetOSRelease() +
+ aInfo.GetRenderer() +
+ aInfo.GetVendor() +
+ aInfo.GetVersion();
+#elif defined( _WIN32 )
+ const WinOpenGLDeviceInfo aInfo;
+ return OUStringToOString(aInfo.GetAdapterVendorID(), RTL_TEXTENCODING_UTF8) +
+ OUStringToOString(aInfo.GetAdapterDeviceID(), RTL_TEXTENCODING_UTF8) +
+ OUStringToOString(aInfo.GetDriverVersion(), RTL_TEXTENCODING_UTF8) +
+ OString::number(aInfo.GetWindowsVersion());
+#else
+ return OString(reinterpret_cast<const char*>(glGetString(GL_VENDOR))) +
+ OString(reinterpret_cast<const char*>(glGetString(GL_RENDERER))) +
+ OString(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
+#endif
+ }
+
OString getStringDigest( const OUString& rVertexShaderName,
const OUString& rFragmentShaderName,
const OString& rPreamble )
@@ -206,27 +228,7 @@ namespace
OString aFragmentShaderSource = getShaderSource( rFragmentShaderName );
// get info about the graphic device
-#if defined( SAL_UNX ) && !defined( MACOSX ) && !defined( IOS )&& !defined( ANDROID )
- static const X11OpenGLDeviceInfo aInfo;
- static const OString aDeviceInfo (
- aInfo.GetOS() +
- aInfo.GetOSRelease() +
- aInfo.GetRenderer() +
- aInfo.GetVendor() +
- aInfo.GetVersion() );
-#elif defined( _WIN32 )
- static const WinOpenGLDeviceInfo aInfo;
- static const OString aDeviceInfo (
- OUStringToOString( aInfo.GetAdapterVendorID(), RTL_TEXTENCODING_UTF8 ) +
- OUStringToOString( aInfo.GetAdapterDeviceID(), RTL_TEXTENCODING_UTF8 ) +
- OUStringToOString( aInfo.GetDriverVersion(), RTL_TEXTENCODING_UTF8 ) +
- OString::number( aInfo.GetWindowsVersion() ) );
-#else
- static const OString aDeviceInfo (
- OString( reinterpret_cast<const char*>(glGetString(GL_VENDOR)) ) +
- OString( reinterpret_cast<const char*>(glGetString(GL_RENDERER)) ) +
- OString( reinterpret_cast<const char*>(glGetString(GL_VERSION)) ) );
-#endif
+ static const OString aDeviceInfo (getDeviceInfoString());
OString aMessage;
aMessage += rPreamble;
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index bc0c908d9af2..437e8b594c65 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -67,9 +67,6 @@
#include <gdiplus.h>
#include <shlobj.h>
-#ifdef _WIN32_WINNT_WINBLUE
-#include <VersionHelpers.h>
-#endif
#include "postwin.h"
#if defined _MSC_VER
@@ -359,35 +356,6 @@ SalInstance* CreateSalInstance()
{
SalData* pSalData = GetSalData();
- // determine the windows version
- aSalShlData.mbWXP = 0;
- aSalShlData.mbWVista = 0;
- aSalShlData.mbW7 = 0;
-// 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
- OSVERSIONINFO aVersionInfo;
- memset( &aVersionInfo, 0, sizeof(aVersionInfo) );
- aVersionInfo.dwOSVersionInfoSize = sizeof( aVersionInfo );
- if (GetVersionEx( &aVersionInfo ))
- {
- // Windows XP ?
- if (aVersionInfo.dwMajorVersion > 5 ||
- (aVersionInfo.dwMajorVersion == 5 && aVersionInfo.dwMinorVersion >= 1))
- aSalShlData.mbWXP = 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
-
pSalData->mnAppThreadId = GetCurrentThreadId();
// register frame class
@@ -414,8 +382,7 @@ SalInstance* CreateSalInstance()
return nullptr;
// shadow effect for popups on XP
- if( aSalShlData.mbWXP )
- aWndClassEx.style |= CS_DROPSHADOW;
+ aWndClassEx.style |= CS_DROPSHADOW;
aWndClassEx.lpszClassName = SAL_TMPSUBFRAME_CLASSNAMEW;
if ( !RegisterClassExW( &aWndClassEx ) )
return nullptr;
@@ -865,50 +832,47 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
if (osl::FileBase::E_None == rc)
{
- if ( aSalShlData.mbW7 )
- {
- IShellItem* pShellItem = nullptr;
+ IShellItem* pShellItem = nullptr;
- HRESULT hr = SHCreateItemFromParsingName(SAL_W(system_path.getStr()), nullptr, IID_PPV_ARGS(&pShellItem));
+ HRESULT hr = SHCreateItemFromParsingName(SAL_W(system_path.getStr()), nullptr, IID_PPV_ARGS(&pShellItem));
- if ( SUCCEEDED(hr) && pShellItem )
+ if ( SUCCEEDED(hr) && pShellItem )
+ {
+ OUString sApplicationName;
+
+ if ( rDocumentService == "com.sun.star.text.TextDocument" ||
+ rDocumentService == "com.sun.star.text.GlobalDocument" ||
+ rDocumentService == "com.sun.star.text.WebDocument" ||
+ rDocumentService == "com.sun.star.xforms.XMLFormDocument" )
+ sApplicationName = "Writer";
+ else if ( rDocumentService == "com.sun.star.sheet.SpreadsheetDocument" ||
+ rDocumentService == "com.sun.star.chart2.ChartDocument" )
+ sApplicationName = "Calc";
+ else if ( rDocumentService == "com.sun.star.presentation.PresentationDocument" )
+ sApplicationName = "Impress";
+ else if ( rDocumentService == "com.sun.star.drawing.DrawingDocument" )
+ sApplicationName = "Draw";
+ else if ( rDocumentService == "com.sun.star.formula.FormulaProperties" )
+ sApplicationName = "Math";
+ else if ( rDocumentService == "com.sun.star.sdb.DatabaseDocument" ||
+ rDocumentService == "com.sun.star.sdb.OfficeDatabaseDocument" ||
+ rDocumentService == "com.sun.star.sdb.RelationDesign" ||
+ rDocumentService == "com.sun.star.sdb.QueryDesign" ||
+ rDocumentService == "com.sun.star.sdb.TableDesign" ||
+ rDocumentService == "com.sun.star.sdb.DataSourceBrowser" )
+ sApplicationName = "Base";
+
+ if ( !sApplicationName.isEmpty() )
{
- OUString sApplicationName;
-
- if ( rDocumentService == "com.sun.star.text.TextDocument" ||
- rDocumentService == "com.sun.star.text.GlobalDocument" ||
- rDocumentService == "com.sun.star.text.WebDocument" ||
- rDocumentService == "com.sun.star.xforms.XMLFormDocument" )
- sApplicationName = "Writer";
- else if ( rDocumentService == "com.sun.star.sheet.SpreadsheetDocument" ||
- rDocumentService == "com.sun.star.chart2.ChartDocument" )
- sApplicationName = "Calc";
- else if ( rDocumentService == "com.sun.star.presentation.PresentationDocument" )
- sApplicationName = "Impress";
- else if ( rDocumentService == "com.sun.star.drawing.DrawingDocument" )
- sApplicationName = "Draw";
- else if ( rDocumentService == "com.sun.star.formula.FormulaProperties" )
- sApplicationName = "Math";
- else if ( rDocumentService == "com.sun.star.sdb.DatabaseDocument" ||
- rDocumentService == "com.sun.star.sdb.OfficeDatabaseDocument" ||
- rDocumentService == "com.sun.star.sdb.RelationDesign" ||
- rDocumentService == "com.sun.star.sdb.QueryDesign" ||
- rDocumentService == "com.sun.star.sdb.TableDesign" ||
- rDocumentService == "com.sun.star.sdb.DataSourceBrowser" )
- sApplicationName = "Base";
-
- if ( !sApplicationName.isEmpty() )
- {
- OUString sApplicationID("TheDocumentFoundation.LibreOffice.");
- sApplicationID += sApplicationName;
+ OUString sApplicationID("TheDocumentFoundation.LibreOffice.");
+ sApplicationID += sApplicationName;
- SHARDAPPIDINFO info;
- info.psi = pShellItem;
- info.pszAppID = SAL_W(sApplicationID.getStr());
+ SHARDAPPIDINFO info;
+ info.psi = pShellItem;
+ info.pszAppID = SAL_W(sApplicationID.getStr());
- SHAddToRecentDocs ( SHARD_APPIDINFO, &info );
- return;
- }
+ SHAddToRecentDocs ( SHARD_APPIDINFO, &info );
+ return;
}
}
// For whatever reason, we could not use the SHARD_APPIDINFO semantics
@@ -958,38 +922,43 @@ int WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POIN
OUString WinSalInstance::getOSVersion()
{
- SalData* pSalData = GetSalData();
- if ( !pSalData )
- return OUString("unknown");
-
- WORD nMajor = 0, nMinor = 0;
-#ifdef _WIN32_WINNT_WINBLUE
- // Trying to hide the real version info behind an
- // uber-lame non-forward-compatible, 'compatibility' API
- // seems unlikely to help OS designers, or API users.
- nMajor = 30;
- while( !IsWindowsVersionOrGreater( nMajor, 0, 0 ) && nMajor > 0)
- nMajor--;
- nMinor = 30;
- while( !IsWindowsVersionOrGreater( nMajor, nMinor, 0 ) && nMinor > 0)
- nMinor--;
-#else
- OSVERSIONINFO aVersionInfo;
- memset( &aVersionInfo, 0, sizeof( aVersionInfo ) );
- aVersionInfo.dwOSVersionInfoSize = sizeof( aVersionInfo );
- if ( GetVersionEx( &aVersionInfo ) )
+ // GetVersion(Ex) and VersionHelpers (based on VerifyVersionInfo) API are
+ // subject to manifest-based behavior since Windows 8.1, so give wrong results.
+ // Another approach would be to use NetWkstaGetInfo, but that has some small
+ // reported delays (some milliseconds), and might get slower in domains with
+ // poor network connections.
+ // So go with a solution described at https://msdn.microsoft.com/en-us/library/ms724429
+ HINSTANCE hLibrary = LoadLibraryW(L"kernel32.dll");
+ if (hLibrary != nullptr)
{
- nMajor = aVersionInfo.dwMajorVersion;
- nMinor = aVersionInfo.dwMinorVersion;
+ wchar_t szPath[MAX_PATH];
+ DWORD dwCount = GetModuleFileNameW(hLibrary, szPath, SAL_N_ELEMENTS(szPath));
+ FreeLibrary(hLibrary);
+ if (dwCount != 0 && dwCount < SAL_N_ELEMENTS(szPath))
+ {
+ dwCount = GetFileVersionInfoSizeW(szPath, NULL);
+ if (dwCount != 0)
+ {
+ std::unique_ptr<char> ver(new char[dwCount]);
+ if (GetFileVersionInfoW(szPath, 0, dwCount, ver.get()) != FALSE)
+ {
+ void* pBlock = nullptr;
+ UINT dwBlockSz = 0;
+ if (VerQueryValueW(ver.get(), L"\\", &pBlock, &dwBlockSz) != FALSE && dwBlockSz >= sizeof(VS_FIXEDFILEINFO))
+ {
+ VS_FIXEDFILEINFO *vinfo = reinterpret_cast<VS_FIXEDFILEINFO *>(pBlock);
+ OUStringBuffer aVer;
+ aVer.append("Windows ");
+ aVer.append((sal_Int32)HIWORD(vinfo->dwProductVersionMS));
+ aVer.append(".");
+ aVer.append((sal_Int32)LOWORD(vinfo->dwProductVersionMS));
+ return aVer.makeStringAndClear();
+ }
+ }
+ }
+ }
}
-#endif
- OUStringBuffer aVer;
- aVer.append( "Windows " );
- aVer.append( (sal_Int32)nMajor );
- aVer.append( "." );
- aVer.append( (sal_Int32)nMinor );
-
- return aVer.makeStringAndClear();
+ return "unknown";
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index b0ea1a9b275d..3cb1b341f418 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -1512,22 +1512,16 @@ void WinSalGraphics::updateSettingsNative( AllSettings& rSettings )
// don't draw frame around each and every toolbar
pSVData->maNWFData.mbDockingAreaAvoidTBFrames = true;
- // check if vista or newer runs
- // 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.mbWVista)
- {
- Color aMenuBarTextColor = aStyleSettings.GetPersonaMenuBarTextColor().get_value_or( aStyleSettings.GetMenuTextColor() );
- // in aero menuitem highlight text is drawn in the same color as normal
- aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() );
- aStyleSettings.SetMenuBarRolloverTextColor( aMenuBarTextColor );
- aStyleSettings.SetMenuBarHighlightTextColor( aMenuBarTextColor );
- pSVData->maNWFData.mnMenuFormatBorderX = 2;
- pSVData->maNWFData.mnMenuFormatBorderY = 2;
- pSVData->maNWFData.maMenuBarHighlightTextColor = aMenuBarTextColor;
- GetSalData()->mbThemeMenuSupport = true;
- }
+ Color aMenuBarTextColor = aStyleSettings.GetPersonaMenuBarTextColor().get_value_or( aStyleSettings.GetMenuTextColor() );
+ // in aero menuitem highlight text is drawn in the same color as normal
+ aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() );
+ aStyleSettings.SetMenuBarRolloverTextColor( aMenuBarTextColor );
+ aStyleSettings.SetMenuBarHighlightTextColor( aMenuBarTextColor );
+ pSVData->maNWFData.mnMenuFormatBorderX = 2;
+ pSVData->maNWFData.mnMenuFormatBorderY = 2;
+ pSVData->maNWFData.maMenuBarHighlightTextColor = aMenuBarTextColor;
+ GetSalData()->mbThemeMenuSupport = true;
rSettings.SetStyleSettings( aStyleSettings );
}
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 3cdb402e0ad6..411bb644bfd5 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -697,19 +697,7 @@ static UINT ImplSalGetWheelScrollChars()
UINT nScrChars = 0;
if( !SystemParametersInfo( SPI_GETWHEELSCROLLCHARS, 0, &nScrChars, 0 ) )
{
- // Depending on Windows version, use proper default or 1 (when
- // driver emulates hscroll)
- if (!aSalShlData.mbWVista)
- {
- // Windows 2000 & WinXP : emulating driver, use step size
- // of 1
- return 1;
- }
- else
- {
- // Longhorn or above: use proper default value of 3
- return 3;
- }
+ return 3;
}
// system settings successfully read
@@ -1159,7 +1147,7 @@ static void ImplSalShow( HWND hWnd, bool bVisible, bool bNoActivate )
if( aDogTag.isDeleted() )
return;
- if ( aSalShlData.mbWXP && pFrame->mbFloatWin && !(pFrame->mnStyle & SalFrameStyleFlags::NOSHADOW))
+ if (pFrame->mbFloatWin && !(pFrame->mnStyle & SalFrameStyleFlags::NOSHADOW))
{
// erase the window immediately to improve XP shadow effect
// otherwise the shadow may appears long time before the rest of the window
@@ -1839,39 +1827,36 @@ void WinSalFrame::SetScreenNumber( unsigned int nNewScreen )
void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
{
- if ( aSalShlData.mbW7 )
- {
- // http://msdn.microsoft.com/en-us/library/windows/desktop/dd378430(v=vs.85).aspx
- // A window's properties must be removed before the window is closed.
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/dd378430(v=vs.85).aspx
+ // A window's properties must be removed before the window is closed.
- typedef HRESULT ( WINAPI *SHGETPROPERTYSTOREFORWINDOW )( HWND, REFIID, void ** );
- SHGETPROPERTYSTOREFORWINDOW pSHGetPropertyStoreForWindow;
- pSHGetPropertyStoreForWindow = reinterpret_cast<SHGETPROPERTYSTOREFORWINDOW>(GetProcAddress(
- GetModuleHandleW (L"shell32.dll"), "SHGetPropertyStoreForWindow" ));
+ typedef HRESULT ( WINAPI *SHGETPROPERTYSTOREFORWINDOW )( HWND, REFIID, void ** );
+ SHGETPROPERTYSTOREFORWINDOW pSHGetPropertyStoreForWindow;
+ pSHGetPropertyStoreForWindow = reinterpret_cast<SHGETPROPERTYSTOREFORWINDOW>(GetProcAddress(
+ GetModuleHandleW (L"shell32.dll"), "SHGetPropertyStoreForWindow" ));
- if( pSHGetPropertyStoreForWindow )
+ if( pSHGetPropertyStoreForWindow )
+ {
+ IPropertyStore *pps;
+ HRESULT hr = pSHGetPropertyStoreForWindow ( mhWnd, IID_PPV_ARGS(&pps) );
+ if ( SUCCEEDED(hr) )
{
- IPropertyStore *pps;
- HRESULT hr = pSHGetPropertyStoreForWindow ( mhWnd, IID_PPV_ARGS(&pps) );
- if ( SUCCEEDED(hr) )
+ PROPVARIANT pv;
+ if ( !rApplicationID.isEmpty() )
{
- PROPVARIANT pv;
- if ( !rApplicationID.isEmpty() )
- {
- hr = InitPropVariantFromString( SAL_W(rApplicationID.getStr()), &pv );
- mbPropertiesStored = TRUE;
- }
- else
- // if rApplicationID we remove the property from the window, if present
- PropVariantInit( &pv );
+ hr = InitPropVariantFromString( SAL_W(rApplicationID.getStr()), &pv );
+ mbPropertiesStored = TRUE;
+ }
+ else
+ // if rApplicationID we remove the property from the window, if present
+ PropVariantInit( &pv );
- if ( SUCCEEDED(hr) )
- {
- hr = pps->SetValue( PKEY_AppUserModel_ID, pv );
- PropVariantClear( &pv );
- }
- pps->Release();
+ if ( SUCCEEDED(hr) )
+ {
+ hr = pps->SetValue( PKEY_AppUserModel_ID, pv );
+ PropVariantClear( &pv );
}
+ pps->Release();
}
}
}
@@ -2704,23 +2689,19 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) );
aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) );
aStyleSettings.SetDeactiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ) );
- if ( aSalShlData.mbWXP )
- {
- // only xp supports a different menu bar color
- long bFlatMenus = 0;
- SystemParametersInfo( SPI_GETFLATMENU, 0, &bFlatMenus, 0);
- if( bFlatMenus )
- {
- aStyleSettings.SetUseFlatMenus( TRUE );
- aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( COLOR_MENUBAR ) ) );
- aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) );
- aStyleSettings.SetMenuBarRolloverColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) );
- aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) );
-
- // flat borders for our controls etc. as well in this mode (ie, no 3d borders)
- // this is not active in the classic style appearance
- aStyleSettings.SetUseFlatBorders( TRUE );
- }
+ long bFlatMenus = 0;
+ SystemParametersInfo( SPI_GETFLATMENU, 0, &bFlatMenus, 0);
+ if( bFlatMenus )
+ {
+ aStyleSettings.SetUseFlatMenus( TRUE );
+ aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( COLOR_MENUBAR ) ) );
+ aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) );
+ aStyleSettings.SetMenuBarRolloverColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) );
+ aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) );
+
+ // flat borders for our controls etc. as well in this mode (ie, no 3d borders)
+ // this is not active in the classic style appearance
+ aStyleSettings.SetUseFlatBorders( TRUE );
}
aStyleSettings.SetCheckedColorSpecialCase( );