Index: win/source/window/salframe.cxx =================================================================== RCS file: /cvs/gsl/vcl/win/source/window/salframe.cxx,v retrieving revision 1.118 diff -u -r1.118 salframe.cxx --- win/source/window/salframe.cxx 9 Sep 2005 14:08:44 -0000 1.118 +++ win/source/window/salframe.cxx 17 Nov 2005 10:49:03 -0000 @@ -857,6 +857,19 @@ } // ----------------------------------------------------------------------- +static BOOL CALLBACK CalcFullScreenSizeMonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) +{ + MONITORINFOEX **lpmicallback; + MONITORINFOEX *lpmithis; + lpmicallback = (MONITORINFOEX **)dwData; + lpmithis = *lpmicallback; + lpmithis->cbSize = sizeof(MONITORINFOEX); + if (GetMonitorInfo(hMonitor, lpmithis)) + { + *lpmicallback = lpmithis + sizeof(MONITORINFOEX); + } + return TRUE; +}; static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, int& rX, int& rY, int& rDX, int& rDY ) @@ -867,6 +880,10 @@ int nCaptionY; int nScreenDX; int nScreenDY; + int nScreenX; + int nScreenY; + int nMonitor; + int nMonitors; if ( pFrame->mbSizeBorder ) { @@ -893,11 +910,52 @@ else nCaptionY = 0; - nScreenDX = GetSystemMetrics( SM_CXSCREEN ); - nScreenDY = GetSystemMetrics( SM_CYSCREEN ); + // TODO: replace this FALSE with a check about whether to display on the primary screen + if ( FALSE ) + { + nScreenX = 0; + nScreenY = 0; + nScreenDX = GetSystemMetrics( SM_CXSCREEN ); + nScreenDY = GetSystemMetrics( SM_CYSCREEN ); + } + else + { + nMonitors = GetSystemMetrics(SM_CMONITORS); + BOOL bFoundMonitor; + MONITORINFOEX *lpmiarray = (MONITORINFOEX *)malloc(sizeof(MONITORINFOEX) * nMonitors); + if (lpmiarray != NULL) + { + MONITORINFOEX *lpmicurrent = lpmiarray; + POINT ptCunning; + // TODO: find a way to find the monitor number or check the monitor display name required + nMonitor = 1 ; // pFrame->mbFullScreen - 1; + bFoundMonitor = FALSE; + if (EnumDisplayMonitors(NULL, NULL, &CalcFullScreenSizeMonitorEnumProc, (LPARAM)(&lpmicurrent))) + { + nMonitors = (lpmicurrent - lpmiarray) / sizeof(MONITORINFOEX); + if (nMonitor < nMonitors) + { + MONITORINFOEX *mInfo = lpmiarray + nMonitor * sizeof(MONITORINFOEX); + nScreenX = mInfo->rcMonitor.left; + nScreenY = mInfo->rcMonitor.top; + nScreenDX = mInfo->rcMonitor.right - nScreenX; + nScreenDY = mInfo->rcMonitor.bottom - nScreenY; + bFoundMonitor = TRUE; + } + } + free(lpmiarray); + } + if (!bFoundMonitor) + { + nScreenX = 0; + nScreenY = 0; + nScreenDX = GetSystemMetrics( SM_CXSCREEN ); + nScreenDY = GetSystemMetrics( SM_CYSCREEN ); + } + } - rX = -nFrameX; - rY = -(nFrameY+nCaptionY); + rX = nScreenX-nFrameX; + rY = nScreenY-(nFrameY+nCaptionY); rDX = nScreenDX+(nFrameX*2); rDY = nScreenDY+(nFrameY*2)+nCaptionY; }