diff options
author | Tor Lillqvist <tlillqvist@novell.com> | 2011-01-24 03:09:02 +0200 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@novell.com> | 2011-01-24 03:09:02 +0200 |
commit | e46003644b7a109f6e7a856b5730ff28cb01e206 (patch) | |
tree | a0add0298c8233db7cbeb9cdbe67084488780564 /vcl/win/source/app | |
parent | 6cd6af5b9daea7a95359b1b16f0cc8f98a572cb6 (diff) |
Kill Win9x and NT4 code
Diffstat (limited to 'vcl/win/source/app')
-rw-r--r-- | vcl/win/source/app/salinfo.cxx | 132 | ||||
-rw-r--r-- | vcl/win/source/app/salinst.cxx | 139 |
2 files changed, 94 insertions, 177 deletions
diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index 943344c189a1..2280fd6e0ddf 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 cee88a2726d2..d69337bf356d 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; |