diff options
author | Jesús Corrius <jesus@softcatala.org> | 2011-06-18 18:36:57 +0200 |
---|---|---|
committer | Jesús Corrius <jesus@softcatala.org> | 2011-06-18 18:36:57 +0200 |
commit | 03db851b12a77326926ecfdf0543aa2da2205c52 (patch) | |
tree | 984b0ecdfcc9e2fe60dcd04a7eeeee04c8e89b70 /vcl/win | |
parent | fef6942ac3d6d9ebf8acfa4576308c923ee05544 (diff) |
Remove obsolete Win95/NT code
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 125 |
1 files changed, 45 insertions, 80 deletions
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 9ed173ee6170..ed428e473aae 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -232,9 +232,6 @@ static void ImplSaveFrameState( WinSalFrame* pFrame ) // if pParentRect is set, the workarea of the monitor that contains pParentRect is returned void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) { - static int winVerChecked = 0; - static int winVerOk = 0; - // check if we or our parent is fullscreen, then the taskbar should be ignored bool bIgnoreTaskbar = false; WinSalFrame* pFrame = GetWindowPtr( hWnd ); @@ -254,96 +251,64 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) } } - if( !winVerChecked ) + // calculates the work area taking multiple monitors into account + static int nMonitors = GetSystemMetrics( SM_CMONITORS ); + if( nMonitors == 1 ) { - winVerChecked = 1; - winVerOk = 1; - - // multi monitor calls not available on Win95/NT - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) - { - if ( aSalShlData.maVersionInfo.dwMajorVersion <= 4 ) - winVerOk = 0; // NT - } - else if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) + if( bIgnoreTaskbar ) { - if ( aSalShlData.maVersionInfo.dwMajorVersion == 4 && aSalShlData.maVersionInfo.dwMinorVersion == 0 ) - winVerOk = 0; // Win95 + pRect->left = pRect->top = 0; + pRect->right = GetSystemMetrics( SM_CXSCREEN ); + pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); } + else + SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); } - - // calculates the work area taking multiple monitors into account - if( winVerOk ) + else { - static int nMonitors = GetSystemMetrics( SM_CMONITORS ); - if( nMonitors == 1 ) + if( pParentRect != NULL ) { - if( bIgnoreTaskbar ) - { - pRect->left = pRect->top = 0; - pRect->right = GetSystemMetrics( SM_CXSCREEN ); - pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); - } + // return the size of the monitor where pParentRect lives + HMONITOR hMonitor; + MONITORINFO mi; + + // get the nearest monitor to the passed rect. + hMonitor = MonitorFromRect(pParentRect, MONITOR_DEFAULTTONEAREST); + + // get the work area or entire monitor rect. + mi.cbSize = sizeof(mi); + GetMonitorInfo(hMonitor, &mi); + if( !bIgnoreTaskbar ) + *pRect = mi.rcWork; else - SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); + *pRect = mi.rcMonitor; } else { - if( pParentRect != NULL ) + // return the union of all monitors + pRect->left = GetSystemMetrics( SM_XVIRTUALSCREEN ); + pRect->top = GetSystemMetrics( SM_YVIRTUALSCREEN ); + pRect->right = pRect->left + GetSystemMetrics( SM_CXVIRTUALSCREEN ); + pRect->bottom = pRect->top + GetSystemMetrics( SM_CYVIRTUALSCREEN ); + + // virtualscreen does not take taskbar into account, so use the corresponding + // diffs between screen and workarea from the default screen + // however, this is still not perfect: the taskbar might not be on the primary screen + if( !bIgnoreTaskbar ) { - // return the size of the monitor where pParentRect lives - HMONITOR hMonitor; - MONITORINFO mi; - - // get the nearest monitor to the passed rect. - hMonitor = MonitorFromRect(pParentRect, MONITOR_DEFAULTTONEAREST); - - // get the work area or entire monitor rect. - mi.cbSize = sizeof(mi); - GetMonitorInfo(hMonitor, &mi); - if( !bIgnoreTaskbar ) - *pRect = mi.rcWork; - else - *pRect = mi.rcMonitor; + RECT wRect, scrRect; + SystemParametersInfo( SPI_GETWORKAREA, 0, &wRect, 0 ); + scrRect.left = 0; + scrRect.top = 0; + scrRect.right = GetSystemMetrics( SM_CXSCREEN ); + scrRect.bottom = GetSystemMetrics( SM_CYSCREEN ); + + pRect->left += wRect.left; + pRect->top += wRect.top; + pRect->right -= scrRect.right - wRect.right; + pRect->bottom -= scrRect.bottom - wRect.bottom; } - else - { - // return the union of all monitors - pRect->left = GetSystemMetrics( SM_XVIRTUALSCREEN ); - pRect->top = GetSystemMetrics( SM_YVIRTUALSCREEN ); - pRect->right = pRect->left + GetSystemMetrics( SM_CXVIRTUALSCREEN ); - pRect->bottom = pRect->top + GetSystemMetrics( SM_CYVIRTUALSCREEN ); - - // virtualscreen does not take taskbar into account, so use the corresponding - // diffs between screen and workarea from the default screen - // however, this is still not perfect: the taskbar might not be on the primary screen - if( !bIgnoreTaskbar ) - { - RECT wRect, scrRect; - SystemParametersInfo( SPI_GETWORKAREA, 0, &wRect, 0 ); - scrRect.left = 0; - scrRect.top = 0; - scrRect.right = GetSystemMetrics( SM_CXSCREEN ); - scrRect.bottom = GetSystemMetrics( SM_CYSCREEN ); - - pRect->left += wRect.left; - pRect->top += wRect.top; - pRect->right -= scrRect.right - wRect.right; - pRect->bottom -= scrRect.bottom - wRect.bottom; - } - } - } - } - else - { - if( bIgnoreTaskbar ) - { - pRect->left = pRect->top = 0; - pRect->right = GetSystemMetrics( SM_CXSCREEN ); - pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); } - else - SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); } } |