diff options
-rw-r--r-- | avmedia/source/win/player.cxx | 26 | ||||
-rw-r--r-- | fpicker/source/win32/filepicker/FPentry.cxx | 3 | ||||
-rw-r--r-- | fpicker/source/win32/misc/WinImplHelper.cxx | 30 | ||||
-rw-r--r-- | fpicker/source/win32/misc/WinImplHelper.hxx | 2 | ||||
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx | 32 | ||||
-rw-r--r-- | shell/inc/utilities.hxx | 6 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx | 84 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx | 23 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/propsheets/propsheets.cxx | 37 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx | 28 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/util/utilities.cxx | 26 | ||||
-rw-r--r-- | vcl/inc/win/saldata.hxx | 3 | ||||
-rw-r--r-- | vcl/opengl/win/WinDeviceInfo.cxx | 58 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLHelper.cxx | 44 | ||||
-rw-r--r-- | vcl/win/app/salinst.cxx | 175 | ||||
-rw-r--r-- | vcl/win/gdi/salnativewidgets-luna.cxx | 24 | ||||
-rw-r--r-- | vcl/win/window/salframe.cxx | 97 |
17 files changed, 196 insertions, 502 deletions
diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx index c0579c225dde..4ba72ca9a368 100644 --- a/avmedia/source/win/player.cxx +++ b/avmedia/source/win/player.cxx @@ -26,9 +26,6 @@ #include <control.h> #include <uuids.h> #include <evcode.h> -#ifdef _WIN32_WINNT_WINBLUE -#include <VersionHelpers.h> -#endif #if defined _MSC_VER #pragma warning(pop) #endif @@ -69,22 +66,6 @@ LRESULT CALLBACK MediaPlayerWndProc_2( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM } -bool isWindowsVistaOrHigher() -{ -// the Win32 SDK 8.1 deprecates GetVersionEx() -#ifdef _WIN32_WINNT_WINBLUE - return IsWindowsVistaOrGreater(); -#else - // POST: return true if we are at least on Windows Vista - OSVERSIONINFO osvi; - ZeroMemory(&osvi, sizeof(osvi)); - osvi.dwOSVersionInfoSize = sizeof(osvi); - GetVersionEx(&osvi); - return osvi.dwMajorVersion >= 6; -#endif -} - - Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : Player_BASE(m_aMutex), mxMgr( rxMgr ), @@ -166,13 +147,6 @@ bool Player::create( const OUString& rURL ) // Don't use the overlay mixer on Windows Vista // It disables the desktop composition as soon as RenderFile is called // also causes some other problems: video rendering is not reliable - if( !isWindowsVistaOrHigher() && SUCCEEDED( CoCreateInstance( CLSID_OverlayMixer, nullptr, CLSCTX_INPROC_SERVER, IID_IBaseFilter, reinterpret_cast<void**>(&mpOMF) ) ) ) - { - mpGB->AddFilter( mpOMF, L"com_sun_star_media_OverlayMixerFilter" ); - - if( !SUCCEEDED( mpOMF->QueryInterface( IID_IDDrawExclModeVideo, reinterpret_cast<void**>(&mpEV) ) ) ) - mpEV = nullptr; - } if( SUCCEEDED( hR = mpGB->RenderFile( reinterpret_cast<LPCWSTR>(rURL.getStr()), nullptr ) ) && SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaControl, reinterpret_cast<void**>(&mpMC) ) ) && diff --git a/fpicker/source/win32/filepicker/FPentry.cxx b/fpicker/source/win32/filepicker/FPentry.cxx index 5eaf4d00c023..f5ce7ba45e12 100644 --- a/fpicker/source/win32/filepicker/FPentry.cxx +++ b/fpicker/source/win32/filepicker/FPentry.cxx @@ -44,9 +44,6 @@ static Reference< XInterface > SAL_CALL createInstance( { Reference< XInterface > xDlg; - if (!IsWindowsVistaOrNewer()) - std::abort(); // not supported - xDlg.set(static_cast<XFilePicker2*>( new ::fpicker::win32::vista::VistaFilePicker(rServiceManager))); diff --git a/fpicker/source/win32/misc/WinImplHelper.cxx b/fpicker/source/win32/misc/WinImplHelper.cxx index d31dd622a8df..09de0484e134 100644 --- a/fpicker/source/win32/misc/WinImplHelper.cxx +++ b/fpicker/source/win32/misc/WinImplHelper.cxx @@ -24,10 +24,6 @@ #include <rtl/ustrbuf.hxx> #include <com/sun/star/uno/Sequence.hxx> -#ifdef _WIN32_WINNT_WINBLUE -#include <VersionHelpers.h> -#endif - using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; @@ -52,32 +48,6 @@ const sal_Unicode AMPERSAND_SIGN = L'&'; // Windows ME VER_PLATFORM_WIN32_WINDOWS 4 90 -// determine if we are running under Vista or newer OS - -bool SAL_CALL IsWindowsVistaOrNewer() -{ -// the Win32 SDK 8.1 deprecates GetVersionEx() -#ifdef _WIN32_WINNT_WINBLUE - return IsWindowsVistaOrGreater(); -#else - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - - if(!GetVersionEx(&osvi)) - return false; - - bool bRet = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId) && - (osvi.dwMajorVersion >= 6); - - bRet = bRet && - (osvi.dwMinorVersion >= - sal::static_int_cast< unsigned int >(0)); - - return bRet; -#endif -} - - void Replace( const OUString& aLabel, sal_Unicode OldChar, sal_Unicode NewChar, OUStringBuffer& aBuffer ) { OSL_ASSERT( aLabel.getLength( ) ); diff --git a/fpicker/source/win32/misc/WinImplHelper.hxx b/fpicker/source/win32/misc/WinImplHelper.hxx index 9102dbfd4dd3..eee2900dc08c 100644 --- a/fpicker/source/win32/misc/WinImplHelper.hxx +++ b/fpicker/source/win32/misc/WinImplHelper.hxx @@ -37,8 +37,6 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> -bool SAL_CALL IsWindowsVistaOrNewer(); - // converts a soffice label to a windows label // the following rules for character replacements // will be done: diff --git a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx index ad736270b2d2..7534c4cfc50e 100644 --- a/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx +++ b/setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx @@ -29,37 +29,9 @@ extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle ) { std::wstring sOfficeMenuFolder = GetMsiPropertyW( handle, L"OfficeMenuFolder" ); std::wstring sDesktopFile = sOfficeMenuFolder + L"Desktop.ini"; - std::wstring sIconFile = GetMsiPropertyW( handle, L"INSTALLLOCATION" ) + L"program\\soffice.exe"; -// the Win32 SDK 8.1 deprecates GetVersionEx() -#ifdef _WIN32_WINNT_WINBLUE - bool const bIsVistaOrLater = IsWindowsVistaOrGreater(); -#else - OSVERSIONINFOW osverinfo; - osverinfo.dwOSVersionInfoSize = sizeof(osverinfo); - GetVersionExW( &osverinfo ); - bool const bIsVistaOrLater = (osverinfo.dwMajorVersion >= 6); -#endif - - if (!bIsVistaOrLater) - { - WritePrivateProfileStringW( - L".ShellClassInfo", - L"IconFile", - sIconFile.c_str(), - sDesktopFile.c_str() ); - - WritePrivateProfileStringW( - L".ShellClassInfo", - L"IconIndex", - L"0", - sDesktopFile.c_str() ); - } - // else - // { - // // at the moment there exists no Vista Icon, so we use the default folder icon. - // // add the icon into desktop/util/verinfo.rc - // } + // at the moment there exists no Vista Icon, so we use the default folder icon. + // add the icon into desktop/util/verinfo.rc // The value '0' is to avoid a message like "You Are Deleting a System Folder" warning when deleting or moving the folder. WritePrivateProfileStringW( diff --git a/shell/inc/utilities.hxx b/shell/inc/utilities.hxx index eb6c289d5023..22f785d3ce62 100644 --- a/shell/inc/utilities.hxx +++ b/shell/inc/utilities.hxx @@ -64,12 +64,6 @@ std::wstring UTF8ToWString(const std::string& String); std::wstring GetResString(int ResId); -/** Returns whether we are running - on Windows XP or not -*/ -bool is_windows_xp_or_above(); - - /** helper function to judge if the string is only has spaces. @returns <TRUE>if the provided string contains only but at least one space diff --git a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx index 8d659582c642..bc3561db7710 100644 --- a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx +++ b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.cxx @@ -50,10 +50,7 @@ list_view_builder_ptr create_list_view_builder( HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2) { - if (is_windows_xp_or_above()) - return list_view_builder_ptr(new winxp_list_view_builder(hwnd_lv, col1, col2)); - else - return list_view_builder_ptr(new list_view_builder(hwnd_lv, col1, col2)); + return list_view_builder_ptr(new list_view_builder(hwnd_lv, col1, col2)); } @@ -64,7 +61,9 @@ list_view_builder::list_view_builder( row_index_(-1), hwnd_list_view_(hwnd_list_view), column1_title_(column1_title), - column2_title_(column2_title) + column2_title_(column2_title), + group_count_(-1), + row_count_(0) { } @@ -121,73 +120,11 @@ void list_view_builder::setup_list_view() header = GetResString(IDS_PROPERTY_VALUE); lvc.pszText = const_cast<wchar_t*>(header.c_str()); ListView_InsertColumnW(hwnd_list_view_, 1, &lvc); + ListView_EnableGroupView(hwnd_list_view_, TRUE); } -void list_view_builder::insert_group(const std::wstring& /*title*/) -{ - insert_item(L"", L"", false); -} - - -void list_view_builder::insert_item(const std::wstring& title, const std::wstring& value, bool is_editable) -{ - LVITEMW lvi; - - lvi.iItem = ++row_index_; - lvi.iSubItem = 0; - lvi.mask = LVIF_TEXT; - lvi.state = 0; - lvi.cchTextMax = static_cast<int>(title.size() + 1); - lvi.stateMask = 0; - lvi.pszText = const_cast<wchar_t*>(title.c_str()); - - if (title.length() > 0) - { - lvi.mask |= LVIF_IMAGE; - - if (is_editable) - lvi.iImage = 4; - else - lvi.iImage = 3; - } - - ListView_InsertItemW(hwnd_list_view_, &lvi); - - lvi.mask = LVIF_TEXT; - lvi.iSubItem = 1; - lvi.pszText = const_cast<wchar_t*>(value.c_str()); - - ListView_SetItemW(hwnd_list_view_, &lvi); -} - - -HWND list_view_builder::get_list_view() const -{ - return hwnd_list_view_; -} - - -winxp_list_view_builder::winxp_list_view_builder( - HWND hwnd_list_view, - const std::wstring& column1_title, - const std::wstring& column2_title) : - list_view_builder(hwnd_list_view, column1_title, column2_title), - group_count_(-1), - row_count_(0) -{ -} - - -void winxp_list_view_builder::setup_list_view() -{ - list_view_builder::setup_list_view(); - - ListView_EnableGroupView(get_list_view(), TRUE); -} - - -void winxp_list_view_builder::insert_group(const std::wstring& name) +void list_view_builder::insert_group(const std::wstring& name) { LVGROUP lvg; @@ -205,8 +142,7 @@ void winxp_list_view_builder::insert_group(const std::wstring& name) } -void winxp_list_view_builder::insert_item( - const std::wstring& title, const std::wstring& value, bool is_editable) +void list_view_builder::insert_item(const std::wstring& title, const std::wstring& value, bool is_editable) { LVITEMW lvi; @@ -239,4 +175,10 @@ void winxp_list_view_builder::insert_item( row_count_++; } + +HWND list_view_builder::get_list_view() const +{ + return hwnd_list_view_; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx index 1555c1fec3ed..7c8b86104bb8 100644 --- a/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx +++ b/shell/source/win32/shlxthandler/propsheets/listviewbuilder.hxx @@ -62,32 +62,11 @@ protected: virtual void insert_item(const std::wstring& title, const std::wstring& value, bool is_editable); HWND get_list_view() const; - int get_current_row() const; - - int row_index_; - private: + int row_index_; HWND hwnd_list_view_; std::wstring column1_title_; std::wstring column2_title_; - - friend list_view_builder_ptr create_list_view_builder(HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2); -}; - - -class winxp_list_view_builder : public list_view_builder -{ -protected: - winxp_list_view_builder( - HWND hwnd_list_view, - const std::wstring& column1_title, - const std::wstring& column2_title); - - virtual void setup_list_view() override; - virtual void insert_group(const std::wstring& name) override; - virtual void insert_item(const std::wstring& title, const std::wstring& value, bool is_editable) override; - -private: int group_count_; int row_count_; diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx index 4c9fff083d14..99933f6169f1 100644 --- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx +++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx @@ -29,9 +29,6 @@ #pragma warning(push, 1) #endif #include <shellapi.h> -#ifdef _WIN32_WINNT_WINBLUE -#include <VersionHelpers.h> -#endif #if defined _MSC_VER #pragma warning(pop) #endif @@ -170,19 +167,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize( HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) { -// the Win32 SDK 8.1 deprecates GetVersionEx() -#ifdef _WIN32_WINNT_WINBLUE - bool bIsVistaOrLater = IsWindowsVistaOrGreater(); -#else - // Get OS version (we don't need the summary page on Windows Vista or later) - OSVERSIONINFOW sInfoOS; - - ZeroMemory( &sInfoOS, sizeof(sInfoOS) ); - sInfoOS.dwOSVersionInfoSize = sizeof( sInfoOS ); - GetVersionExW( &sInfoOS ); - bool bIsVistaOrLater = (sInfoOS.dwMajorVersion >= 6); -#endif - std::wstring proppage_header; PROPSHEETPAGE psp; @@ -197,27 +181,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddP HPROPSHEETPAGE hPage = nullptr; - if ( !bIsVistaOrLater ) - { - proppage_header = GetResString(IDS_PROPPAGE_SUMMARY_TITLE); - - psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_SUMMARY); - psp.pszTitle = proppage_header.c_str(); - psp.pfnDlgProc = reinterpret_cast<DLGPROC>(CPropertySheet::PropPageSummaryProc); - - hPage = CreatePropertySheetPage(&psp); - - // keep this instance alive, will be released when the - // page is about to be destroyed in the callback function - if (hPage) - { - if (lpfnAddPage(hPage, lParam)) - AddRef(); - else - DestroyPropertySheetPage(hPage); - } - } - // add the statistics property page proppage_header = GetResString(IDS_PROPPAGE_STATISTICS_TITLE); diff --git a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx index 360f89cacab0..56d58e919aea 100644 --- a/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx +++ b/shell/source/win32/shlxthandler/thumbviewer/thumbviewer.cxx @@ -40,9 +40,6 @@ #pragma warning(push, 1) #endif #include <shellapi.h> -#ifdef _WIN32_WINNT_WINBLUE -#include <VersionHelpers.h> -#endif #if defined _MSC_VER #pragma warning(pop) #endif @@ -67,28 +64,6 @@ namespace internal return zipfile->HasContent("META-INF/documentsignatures.xml"); } - bool IsWindowsXP() - { -// the Win32 SDK 8.1 deprecates GetVersionEx() -#ifdef _WIN32_WINNT_WINBLUE - return IsWindowsXPOrGreater(); -#else - OSVERSIONINFOW osvi; - ZeroMemory(&osvi, sizeof(osvi)); - osvi.dwOSVersionInfoSize = sizeof(osvi); - GetVersionExW(&osvi); - - return ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && - ((osvi.dwMajorVersion >= 5) && (osvi.dwMinorVersion >= 1))); -#endif - } - - /* Calculate where to position the signet image. - On Windows ME we need to shift the signet a - little bit to the left because Windows ME - puts an overlay icon to the lower right - corner of a thumbnail image so that our signet - we be hidden. */ Gdiplus::Point CalcSignetPosition( const Gdiplus::Rect& canvas, const Gdiplus::Rect& thumbnail_border, const Gdiplus::Rect& signet) { @@ -108,9 +83,6 @@ namespace internal y = thumbnail_border.GetBottom() - signet.GetBottom() + min(signet.GetBottom() / 2, voffset); } - if (!IsWindowsXP()) - x -= 15; - return Gdiplus::Point(x,y); } } diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx index 9468b33a71c4..29395b6d36e0 100644 --- a/shell/source/win32/shlxthandler/util/utilities.cxx +++ b/shell/source/win32/shlxthandler/util/utilities.cxx @@ -24,10 +24,6 @@ #include "config.hxx" #include "utilities.hxx" -#ifdef _WIN32_WINNT_WINBLUE -#include <VersionHelpers.h> -#endif - // constants @@ -94,28 +90,6 @@ std::wstring GetResString(int ResId) } -bool is_windows_xp_or_above() -{ -// the Win32 SDK 8.1 deprecates GetVersionEx() -#ifdef _WIN32_WINNT_WINBLUE - return IsWindowsXPOrGreater(); -#else - OSVERSIONINFOW osvi; - ZeroMemory(&osvi, sizeof(osvi)); - osvi.dwOSVersionInfoSize = sizeof(osvi); - GetVersionExW(&osvi); - - // LLA: check for windows xp or above (Vista) - if (osvi.dwMajorVersion > 5 || - (5 == osvi.dwMajorVersion && osvi.dwMinorVersion >= 1)) - { - return true; - } - return false; -#endif -} - - /** helper function to judge if the string is only has spaces. @returns <TRUE>if the provided string contains only but at least one space 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( ); |