[Libreoffice-commits] .: vcl/win

Tor Lillqvist tml at kemper.freedesktop.org
Sun Jan 23 17:09:14 PST 2011


 vcl/win/inc/saldata.hxx        |    3 
 vcl/win/source/app/salinfo.cxx |  132 ++++++++++++++------------------------
 vcl/win/source/app/salinst.cxx |  139 ++++++++++++-----------------------------
 3 files changed, 94 insertions(+), 180 deletions(-)

New commits:
commit 29c5f1b76ce1650dc5d86388264e27a7f0106294
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Mon Jan 24 03:09:02 2011 +0200

    Kill Win9x and NT4 code

diff --git a/vcl/win/inc/saldata.hxx b/vcl/win/inc/saldata.hxx
index 616848e..51091a1 100644
--- a/vcl/win/inc/saldata.hxx
+++ b/vcl/win/inc/saldata.hxx
@@ -154,9 +154,6 @@ struct SalShlData
     UINT                    mnWheelScrollLines;     // WheelScrollLines
     UINT                    mnWheelScrollChars;     // WheelScrollChars
     UINT                    mnWheelMsgId;           // Wheel-Message-Id fuer W95
-    WORD                    mnVersion;              // System-Version (311 == 3.11)
-    WIN_BOOL                mbWNT;                  // kein W16/W95/W98 sondern ein NT
-    WIN_BOOL                mbW40;                  // Is System-Version >= 4.0
     WIN_BOOL                mbWXP;                  // Windows XP
     WIN_BOOL                mbWPrinter;             // true: use unicode printer functions
                                                     // false: use anis compat printer functions
diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx
index c95fca6..6538aa3 100644
--- a/vcl/win/source/app/salinfo.cxx
+++ b/vcl/win/source/app/salinfo.cxx
@@ -121,88 +121,8 @@ bool WinSalSystem::initMonitors()
     if( m_aMonitors.size() > 0 )
         return true;
     
-    bool winVerOk = true;
-
-    // multi monitor calls not available on Win95/NT
-    if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
-    {
-        if ( aSalShlData.maVersionInfo.dwMajorVersion <= 4 )
-            winVerOk = false;	// NT
-    }
-    else if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
-    {
-        if ( aSalShlData.maVersionInfo.dwMajorVersion == 4 && aSalShlData.maVersionInfo.dwMinorVersion == 0 )
-            winVerOk = false;	// Win95
-    }
-    if( winVerOk )
-    {
-        int nMonitors = GetSystemMetrics( SM_CMONITORS );
-        if( nMonitors == 1 )
-        {
-            int w = GetSystemMetrics( SM_CXSCREEN );
-            int h = GetSystemMetrics( SM_CYSCREEN );
-            m_aMonitors.push_back( DisplayMonitor( rtl::OUString(),
-                                                   rtl::OUString(),
-                                                   Rectangle( Point(), Size( w, h ) ),
-                                                   Rectangle( Point(), Size( w, h ) ),
-                                                   0 ) );
-            m_aDeviceNameToMonitor[ rtl::OUString() ] = 0;
-            m_nPrimary = 0;
-            RECT aWorkRect;
-            if( SystemParametersInfo( SPI_GETWORKAREA, 0, &aWorkRect, 0 ) )
-                m_aMonitors.back().m_aWorkArea =  Rectangle( aWorkRect.left, aWorkRect.top,
-                                                             aWorkRect.right, aWorkRect.bottom );
-        }
-        else
-        {
-            DISPLAY_DEVICEW aDev;
-            aDev.cb = sizeof( aDev );
-            DWORD nDevice = 0;
-            std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDeviceStringCount;
-            while( EnumDisplayDevicesW( NULL, nDevice++, &aDev, 0 ) )
-            {
-                if( (aDev.StateFlags & DISPLAY_DEVICE_ACTIVE)
-                    && !(aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ) // sort out non/disabled monitors
-                {
-                    aDev.DeviceName[31] = 0;
-                    aDev.DeviceString[127] = 0;
-                    rtl::OUString aDeviceName( reinterpret_cast<const sal_Unicode *>(aDev.DeviceName) );
-                    rtl::OUString aDeviceString( reinterpret_cast<const sal_Unicode *>(aDev.DeviceString) );
-                    if( aDeviceStringCount.find( aDeviceString ) == aDeviceStringCount.end() )
-                        aDeviceStringCount[ aDeviceString ] = 1;
-                    else
-                        aDeviceStringCount[ aDeviceString ]++;
-                    m_aDeviceNameToMonitor[ aDeviceName ] = m_aMonitors.size();
-                    m_aMonitors.push_back( DisplayMonitor( aDeviceString,
-                                                           aDeviceName,
-                                                           Rectangle(),
-                                                           Rectangle(),
-                                                           aDev.StateFlags ) );
-                }
-            }
-            HDC aDesktopRC = GetDC( NULL );
-            EnumDisplayMonitors( aDesktopRC, NULL, ImplEnumMonitorProc, reinterpret_cast<LPARAM>(this) );
-
-            // append monitor numbers to name strings
-            std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDevCount( aDeviceStringCount );
-            unsigned int nMonitors = m_aMonitors.size();
-            for( unsigned int i = 0; i < nMonitors; i++ )
-            {
-                const rtl::OUString& rDev( m_aMonitors[i].m_aName );
-                if( aDeviceStringCount[ rDev ] > 1 )
-                {
-                    int nInstance = aDeviceStringCount[ rDev ] - (-- aDevCount[ rDev ] );
-                    rtl::OUStringBuffer aBuf( rDev.getLength() + 8 );
-                    aBuf.append( rDev );
-                    aBuf.appendAscii( " (" );
-                    aBuf.append( sal_Int32( nInstance ) );
-                    aBuf.append( sal_Unicode(')') );
-                    m_aMonitors[ i ].m_aName = aBuf.makeStringAndClear();
-                }
-            }
-        }
-    }
-    else
+    int nMonitors = GetSystemMetrics( SM_CMONITORS );
+    if( nMonitors == 1 )
     {
         int w = GetSystemMetrics( SM_CXSCREEN );
         int h = GetSystemMetrics( SM_CYSCREEN );
@@ -218,6 +138,54 @@ bool WinSalSystem::initMonitors()
             m_aMonitors.back().m_aWorkArea =  Rectangle( aWorkRect.left, aWorkRect.top,
                                                          aWorkRect.right, aWorkRect.bottom );
     }
+    else
+    {
+        DISPLAY_DEVICEW aDev;
+        aDev.cb = sizeof( aDev );
+        DWORD nDevice = 0;
+        std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDeviceStringCount;
+        while( EnumDisplayDevicesW( NULL, nDevice++, &aDev, 0 ) )
+        {
+            if( (aDev.StateFlags & DISPLAY_DEVICE_ACTIVE)
+                && !(aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ) // sort out non/disabled monitors
+            {
+                aDev.DeviceName[31] = 0;
+                aDev.DeviceString[127] = 0;
+                rtl::OUString aDeviceName( reinterpret_cast<const sal_Unicode *>(aDev.DeviceName) );
+                rtl::OUString aDeviceString( reinterpret_cast<const sal_Unicode *>(aDev.DeviceString) );
+                if( aDeviceStringCount.find( aDeviceString ) == aDeviceStringCount.end() )
+                    aDeviceStringCount[ aDeviceString ] = 1;
+                else
+                    aDeviceStringCount[ aDeviceString ]++;
+                m_aDeviceNameToMonitor[ aDeviceName ] = m_aMonitors.size();
+                m_aMonitors.push_back( DisplayMonitor( aDeviceString,
+                                                       aDeviceName,
+                                                       Rectangle(),
+                                                       Rectangle(),
+                                                       aDev.StateFlags ) );
+            }
+        }
+        HDC aDesktopRC = GetDC( NULL );
+        EnumDisplayMonitors( aDesktopRC, NULL, ImplEnumMonitorProc, reinterpret_cast<LPARAM>(this) );
+
+        // append monitor numbers to name strings
+        std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDevCount( aDeviceStringCount );
+        unsigned int nMonitors = m_aMonitors.size();
+        for( unsigned int i = 0; i < nMonitors; i++ )
+        {
+            const rtl::OUString& rDev( m_aMonitors[i].m_aName );
+            if( aDeviceStringCount[ rDev ] > 1 )
+            {
+                int nInstance = aDeviceStringCount[ rDev ] - (-- aDevCount[ rDev ] );
+                rtl::OUStringBuffer aBuf( rDev.getLength() + 8 );
+                aBuf.append( rDev );
+                aBuf.appendAscii( " (" );
+                aBuf.append( sal_Int32( nInstance ) );
+                aBuf.append( sal_Unicode(')') );
+                m_aMonitors[ i ].m_aName = aBuf.makeStringAndClear();
+            }
+        }
+    }
     
     return m_aMonitors.size() > 0;
 }
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index 0f6b244..cb56054 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -512,27 +512,19 @@ SalInstance* CreateSalInstance()
     SalData* pSalData = GetSalData();
 
     // determine the windows version
-    aSalShlData.mbWNT        = 0;
     aSalShlData.mbWXP        = 0;
     aSalShlData.mbWPrinter   = 0;
     WORD nVer = (WORD)GetVersion();
-    aSalShlData.mnVersion = (((WORD)LOBYTE(nVer)) * 100) + HIBYTE(nVer);
-    if ( aSalShlData.mnVersion >= 400 )
-        aSalShlData.mbW40 = 1;
     rtl_zeroMemory( &aSalShlData.maVersionInfo, sizeof(aSalShlData.maVersionInfo) );
     aSalShlData.maVersionInfo.dwOSVersionInfoSize = sizeof( aSalShlData.maVersionInfo );
     if ( GetVersionEx( &aSalShlData.maVersionInfo ) )
     {
-        if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
-        {
-            aSalShlData.mbWNT = 1;
-            // Windows XP ?
-            if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 ||
-               ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) )
-                aSalShlData.mbWXP = 1;
-            if( aSalShlData.maVersionInfo.dwMajorVersion >= 5 )
-                aSalShlData.mbWPrinter = 1;
-        }
+        // Windows XP ?
+        if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 ||
+           ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) )
+            aSalShlData.mbWXP = 1;
+        if( aSalShlData.maVersionInfo.dwMajorVersion >= 5 )
+            aSalShlData.mbWPrinter = 1;
     }
 
     pSalData->mnAppThreadId = GetCurrentThreadId();
@@ -540,90 +532,47 @@ SalInstance* CreateSalInstance()
     // register frame class
     if ( !pSalData->mhPrevInst )
     {
-        if ( aSalShlData.mbWNT )
-        {
-            WNDCLASSEXW aWndClassEx;
-            aWndClassEx.cbSize          = sizeof( aWndClassEx );
-            aWndClassEx.style           = CS_OWNDC;
-            aWndClassEx.lpfnWndProc     = SalFrameWndProcW;
-            aWndClassEx.cbClsExtra      = 0;
-            aWndClassEx.cbWndExtra      = SAL_FRAME_WNDEXTRA;
-            aWndClassEx.hInstance       = pSalData->mhInst;
-            aWndClassEx.hCursor         = 0;
-            aWndClassEx.hbrBackground   = 0;
-            aWndClassEx.lpszMenuName    = 0;
-            aWndClassEx.lpszClassName   = SAL_FRAME_CLASSNAMEW;
-            ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm );
-            if ( !RegisterClassExW( &aWndClassEx ) )
-                return NULL;
-
-            aWndClassEx.hIcon           = 0;
-            aWndClassEx.hIconSm         = 0;
-            aWndClassEx.style          |= CS_SAVEBITS;
-            aWndClassEx.lpszClassName   = SAL_SUBFRAME_CLASSNAMEW;
-            if ( !RegisterClassExW( &aWndClassEx ) )
-                return NULL;
-
-            // shadow effect for popups on XP
-            if( aSalShlData.mbWXP )
-                aWndClassEx.style       |= CS_DROPSHADOW;
-            aWndClassEx.lpszClassName   = SAL_TMPSUBFRAME_CLASSNAMEW;
-            if ( !RegisterClassExW( &aWndClassEx ) )
-                return NULL;
-
-            aWndClassEx.style           = 0;
-            aWndClassEx.lpfnWndProc     = SalComWndProcW;
-            aWndClassEx.cbWndExtra      = 0;
-            aWndClassEx.lpszClassName   = SAL_COM_CLASSNAMEW;
-            if ( !RegisterClassExW( &aWndClassEx ) )
-                return NULL;
-        }
-        else
-        {
-            WNDCLASSEXA aWndClassEx;
-            aWndClassEx.cbSize          = sizeof( aWndClassEx );
-            aWndClassEx.style           = CS_OWNDC;
-            aWndClassEx.lpfnWndProc     = SalFrameWndProcA;
-            aWndClassEx.cbClsExtra      = 0;
-            aWndClassEx.cbWndExtra      = SAL_FRAME_WNDEXTRA;
-            aWndClassEx.hInstance       = pSalData->mhInst;
-            aWndClassEx.hCursor         = 0;
-            aWndClassEx.hbrBackground   = 0;
-            aWndClassEx.lpszMenuName    = 0;
-            aWndClassEx.lpszClassName   = SAL_FRAME_CLASSNAMEA;
-            ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm );
-            if ( !RegisterClassExA( &aWndClassEx ) )
-                return NULL;
-
-            aWndClassEx.hIcon           = 0;
-            aWndClassEx.hIconSm         = 0;
-            aWndClassEx.style          |= CS_SAVEBITS;
-            aWndClassEx.lpszClassName   = SAL_SUBFRAME_CLASSNAMEA;
-            if ( !RegisterClassExA( &aWndClassEx ) )
-                return NULL;
-
-            aWndClassEx.style           = 0;
-            aWndClassEx.lpfnWndProc     = SalComWndProcA;
-            aWndClassEx.cbWndExtra      = 0;
-            aWndClassEx.lpszClassName   = SAL_COM_CLASSNAMEA;
-            if ( !RegisterClassExA( &aWndClassEx ) )
-                return NULL;
-        }
+        WNDCLASSEXW aWndClassEx;
+        aWndClassEx.cbSize          = sizeof( aWndClassEx );
+        aWndClassEx.style           = CS_OWNDC;
+        aWndClassEx.lpfnWndProc     = SalFrameWndProcW;
+        aWndClassEx.cbClsExtra      = 0;
+        aWndClassEx.cbWndExtra      = SAL_FRAME_WNDEXTRA;
+        aWndClassEx.hInstance       = pSalData->mhInst;
+        aWndClassEx.hCursor         = 0;
+        aWndClassEx.hbrBackground   = 0;
+        aWndClassEx.lpszMenuName    = 0;
+        aWndClassEx.lpszClassName   = SAL_FRAME_CLASSNAMEW;
+        ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm );
+        if ( !RegisterClassExW( &aWndClassEx ) )
+            return NULL;
+
+        aWndClassEx.hIcon           = 0;
+        aWndClassEx.hIconSm         = 0;
+        aWndClassEx.style          |= CS_SAVEBITS;
+        aWndClassEx.lpszClassName   = SAL_SUBFRAME_CLASSNAMEW;
+        if ( !RegisterClassExW( &aWndClassEx ) )
+            return NULL;
+
+        // shadow effect for popups on XP
+        if( aSalShlData.mbWXP )
+            aWndClassEx.style       |= CS_DROPSHADOW;
+        aWndClassEx.lpszClassName   = SAL_TMPSUBFRAME_CLASSNAMEW;
+        if ( !RegisterClassExW( &aWndClassEx ) )
+            return NULL;
+
+        aWndClassEx.style           = 0;
+        aWndClassEx.lpfnWndProc     = SalComWndProcW;
+        aWndClassEx.cbWndExtra      = 0;
+        aWndClassEx.lpszClassName   = SAL_COM_CLASSNAMEW;
+        if ( !RegisterClassExW( &aWndClassEx ) )
+            return NULL;
     }
 
     HWND hComWnd;
-    if ( aSalShlData.mbWNT )
-    {
-        hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW,
-                                   L"", WS_POPUP, 0, 0, 0, 0, 0, 0,
-                                   pSalData->mhInst, NULL );
-    }
-    else
-    {
-        hComWnd = CreateWindowExA( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEA,
-                                   "", WS_POPUP, 0, 0, 0, 0, 0, 0,
-                                   pSalData->mhInst, NULL );
-    }
+    hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW,
+                               L"", WS_POPUP, 0, 0, 0, 0, 0, 0,
+                               pSalData->mhInst, NULL );
     if ( !hComWnd )
         return NULL;
 


More information about the Libreoffice-commits mailing list