resurrecting VC5.0 build by disabling multiple monitor code when _MSC_VER is less than 1200

This commit is contained in:
dveditz%netscape.com 2000-03-30 01:00:28 +00:00
Родитель 96f49bfacb
Коммит 4e80826107
2 изменённых файлов: 52 добавлений и 18 удалений

Просмотреть файл

@ -40,10 +40,14 @@
#endif
#if _MSC_VER >= 1200
typedef HMONITOR (*MonitorFromRectProc)(LPCRECT inRect, DWORD inFlag);
typedef BOOL (*EnumDisplayMonitorsProc)(HDC, LPCRECT, MONITORENUMPROC, LPARAM);
BOOL CALLBACK CountMonitors ( HMONITOR, HDC, LPRECT, LPARAM ioCount ) ;
#else
typedef void* HMONITOR;
#endif
class ScreenListItem
@ -148,6 +152,7 @@ nsScreenManagerWin :: ScreenForRect ( PRInt32 inLeft, PRInt32 inTop, PRInt32 inW
RECT globalWindowBounds = { inLeft, inTop, inLeft + inWidth, inTop + inHeight };
void* genScreen = nsnull;
#if _MSC_VER >= 1200
if ( mHasMultiMonitorAPIs ) {
MonitorFromRectProc proc = (MonitorFromRectProc)mMonitorFromRectProc;
HMONITOR screen = (*proc)( &globalWindowBounds, MONITOR_DEFAULTTOPRIMARY );
@ -156,6 +161,7 @@ printf("*** found screen %x\n", screen);
//XXX find the DC for this screen??
}
#endif
*outScreen = CreateNewScreenObject ( ::GetDC(nsnull), genScreen ); // addrefs
@ -179,6 +185,7 @@ nsScreenManagerWin :: GetPrimaryScreen(nsIScreen** aPrimaryScreen)
} // GetPrimaryScreen
#if _MSC_VER >= 1200
//
// CountMonitors
//
@ -195,6 +202,7 @@ CountMonitors ( HMONITOR, HDC, LPRECT, LPARAM ioParam )
return TRUE; // continue the enumeration
} // CountMonitors
#endif
//
@ -207,18 +215,20 @@ nsScreenManagerWin :: GetNumberOfScreens(PRUint32 *aNumberOfScreens)
{
if ( mNumberOfScreens )
*aNumberOfScreens = mNumberOfScreens;
else {
if ( mHasMultiMonitorAPIs ) {
#if _MSC_VER >= 1200
else if ( mHasMultiMonitorAPIs ) {
// use a rect that spans a HUGE area to pick up all screens
// using a null RECT didn't appear reliable, MS docs to the contrary
RECT largeArea = { -32767, -32767, 32767, 32767 };
PRUint32 count = 0;
EnumDisplayMonitorsProc proc = (EnumDisplayMonitorsProc)mEnumDisplayMonitorsProc;
BOOL result = (*proc)(nsnull, &largeArea, (MONITORENUMPROC)CountMonitors, (LPARAM)&count);
*aNumberOfScreens = mNumberOfScreens = count;
} // if there can be > 1 screen
else
*aNumberOfScreens = mNumberOfScreens = 1;
}
} // if there can be > 1 screen
#endif
else
*aNumberOfScreens = mNumberOfScreens = 1;
printf("****** number of sceens %ld\n", mNumberOfScreens);
return NS_OK;

Просмотреть файл

@ -40,7 +40,9 @@
#endif
#if _MSC_VER >= 1200
typedef BOOL (*GetMonitorInfoProc)(HMONITOR inMon, LPMONITORINFO ioInfo);
#endif
nsScreenWin :: nsScreenWin ( HDC inContext, void* inScreen )
@ -52,6 +54,7 @@ nsScreenWin :: nsScreenWin ( HDC inContext, void* inScreen )
NS_ASSERTION ( inContext, "Passing null device to nsScreenWin" );
NS_ASSERTION ( ::GetDeviceCaps(inContext, TECHNOLOGY) == DT_RASDISPLAY, "Not a display screen");
#if _MSC_VER >= 1200
// figure out if we can call the multiple monitor APIs that are only
// available on Win98/2000.
HMODULE lib = GetModuleHandle("user32.dll");
@ -61,6 +64,7 @@ nsScreenWin :: nsScreenWin ( HDC inContext, void* inScreen )
mHasMultiMonitorAPIs = PR_TRUE;
}
printf("has multiple monitor apis is %ld\n", mHasMultiMonitorAPIs);
#endif
// nothing else to do. I guess we could cache a bunch of information
// here, but we want to ask the device at runtime in case anything
@ -81,16 +85,21 @@ NS_IMPL_ISUPPORTS(nsScreenWin, NS_GET_IID(nsIScreen))
NS_IMETHODIMP
nsScreenWin :: GetWidth(PRInt32 *aWidth)
{
BOOL success = FALSE;
#if _MSC_VER >= 1200
if ( mScreen && mHasMultiMonitorAPIs ) {
GetMonitorInfoProc proc = (GetMonitorInfoProc)mGetMonitorInfoProc;
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
BOOL success = (*proc)( (HMONITOR)mScreen, &info );
success = (*proc)( (HMONITOR)mScreen, &info );
if ( success )
*aWidth = info.rcMonitor.right - info.rcMonitor.left;
}
else
#endif
if (!success)
*aWidth = ::GetDeviceCaps(mContext, HORZRES);
return NS_OK;
} // GetWidth
@ -99,15 +108,18 @@ nsScreenWin :: GetWidth(PRInt32 *aWidth)
NS_IMETHODIMP
nsScreenWin :: GetHeight(PRInt32 *aHeight)
{
BOOL success = FALSE;
#if _MSC_VER >= 1200
if ( mScreen && mHasMultiMonitorAPIs ) {
GetMonitorInfoProc proc = (GetMonitorInfoProc)mGetMonitorInfoProc;
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
BOOL success = (*proc)( (HMONITOR)mScreen, &info );
success = (*proc)( (HMONITOR)mScreen, &info );
if ( success )
*aHeight = info.rcMonitor.bottom - info.rcMonitor.top;
}
else
#endif
if (!success)
*aHeight = ::GetDeviceCaps(mContext, VERTRES);
return NS_OK;
@ -135,15 +147,18 @@ nsScreenWin :: GetColorDepth(PRInt32 *aColorDepth)
NS_IMETHODIMP
nsScreenWin :: GetAvailWidth(PRInt32 *aAvailWidth)
{
BOOL success = FALSE;
#if _MSC_VER >= 1200
if ( mScreen && mHasMultiMonitorAPIs ) {
GetMonitorInfoProc proc = (GetMonitorInfoProc)mGetMonitorInfoProc;
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
BOOL success = (*proc)( (HMONITOR)mScreen, &info );
success = (*proc)( (HMONITOR)mScreen, &info );
if ( success )
*aAvailWidth = info.rcWork.right - info.rcWork.left;
}
else {
#endif
if (!success) {
RECT workArea;
::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
*aAvailWidth = workArea.right - workArea.left;
@ -156,15 +171,18 @@ nsScreenWin :: GetAvailWidth(PRInt32 *aAvailWidth)
NS_IMETHODIMP
nsScreenWin :: GetAvailHeight(PRInt32 *aAvailHeight)
{
BOOL success = FALSE;
#if _MSC_VER >= 1200
if ( mScreen && mHasMultiMonitorAPIs ) {
GetMonitorInfoProc proc = (GetMonitorInfoProc)mGetMonitorInfoProc;
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
BOOL success = (*proc)( (HMONITOR)mScreen, &info );
success = (*proc)( (HMONITOR)mScreen, &info );
if ( success )
*aAvailHeight = info.rcWork.bottom - info.rcWork.top;
}
else {
#endif
if (!success) {
RECT workArea;
::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
*aAvailHeight = workArea.bottom - workArea.top;
@ -177,15 +195,18 @@ nsScreenWin :: GetAvailHeight(PRInt32 *aAvailHeight)
NS_IMETHODIMP
nsScreenWin :: GetAvailLeft(PRInt32 *aAvailLeft)
{
BOOL success = FALSE;
#if _MSC_VER >= 1200
if ( mScreen && mHasMultiMonitorAPIs ) {
GetMonitorInfoProc proc = (GetMonitorInfoProc)mGetMonitorInfoProc;
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
BOOL success = (*proc)( (HMONITOR)mScreen, &info );
success = (*proc)( (HMONITOR)mScreen, &info );
if ( success )
*aAvailLeft = info.rcWork.left;
}
else {
#endif
if (!success) {
RECT workArea;
::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
*aAvailLeft = workArea.left;
@ -198,15 +219,18 @@ nsScreenWin :: GetAvailLeft(PRInt32 *aAvailLeft)
NS_IMETHODIMP
nsScreenWin :: GetAvailTop(PRInt32 *aAvailTop)
{
BOOL success = FALSE;
#if _MSC_VER >= 1200
if ( mScreen && mHasMultiMonitorAPIs ) {
GetMonitorInfoProc proc = (GetMonitorInfoProc)mGetMonitorInfoProc;
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
BOOL success = (*proc)( (HMONITOR)mScreen, &info );
success = (*proc)( (HMONITOR)mScreen, &info );
if ( success )
*aAvailTop = info.rcWork.top;
}
else {
#endif
if (!success) {
RECT workArea;
::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
*aAvailTop = workArea.top;