[Libreoffice-commits] .: vcl/win

Jesús Corrius jcorrius at kemper.freedesktop.org
Mon Jun 20 02:12:51 PDT 2011


 vcl/win/source/window/salframe.cxx |  125 +++++++++++++------------------------
 1 file changed, 45 insertions(+), 80 deletions(-)

New commits:
commit abe917218da8bc103ad23d2b38b801077d3334c0
Author: Jesús Corrius <jesus at softcatala.org>
Date:   Sat Jun 18 18:36:57 2011 +0200

    Remove obsolete Win95/NT code

diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 3dbeeac..9f72bb6 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 );
     }
 }
 


More information about the Libreoffice-commits mailing list