Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi all,

This patch removes an obsolete Win95/NT conditional code branch in vcl
in the multiple monitors support.

The diff looks a bit more complicated than it really is because of the
required changes in the indentation.

Thanks for reviewing! :)

-- 
Jesús Corrius <jesus@softcatala.org>
Document Foundation founding member
Mobile: +34 661 11 38 26
Skype: jcorrius | Twitter: @jcorrius
From abe917218da8bc103ad23d2b38b801077d3334c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jes=C3=BAs=20Corrius?= <jesus@softcatala.org>
Date: Sat, 18 Jun 2011 18:36:57 +0200
Subject: [PATCH] Remove obsolete Win95/NT code

---
 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 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 );
     }
 }
 
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.