Author: gadamopoulos Date: Tue Oct 5 16:41:38 2010 New Revision: 49001
URL: http://svn.reactos.org/svn/reactos?rev=49001&view=rev Log: [win32k] - Don't place new windows with default position at the top left corner of the screen See issue #5484 for more details.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Tue Oct 5 16:41:38 2010 @@ -1600,10 +1600,11 @@ /* default positioning for overlapped windows */ if(!(Cs->style & (WS_POPUP | WS_CHILD))) { - RECTL WorkArea; + PMONITOR pMonitor; PRTL_USER_PROCESS_PARAMETERS ProcessParams;
- UserSystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0); + pMonitor = IntGetPrimaryMonitor(); + ASSERT(pMonitor);
ProcessParams = PsGetCurrentProcess()->Peb->ProcessParameters;
@@ -1618,8 +1619,17 @@ } else { - Cs->x = WorkArea.left; - Cs->y = WorkArea.top; + Cs->x = pMonitor->cWndStack * (UserGetSystemMetrics(SM_CXSIZE) + UserGetSystemMetrics(SM_CXFRAME)); + Cs->y = pMonitor->cWndStack * (UserGetSystemMetrics(SM_CYSIZE) + UserGetSystemMetrics(SM_CYFRAME)); + if (Cs->x > ((pMonitor->rcWork.right - pMonitor->rcWork.left) / 4) || + Cs->y > ((pMonitor->rcWork.bottom - pMonitor->rcWork.top) / 4)) + { + /* reset counter and position */ + Cs->x = 0; + Cs->y = 0; + pMonitor->cWndStack = 0; + } + pMonitor->cWndStack++; } }
@@ -1632,8 +1642,8 @@ } else { - Cs->cx = (WorkArea.right - WorkArea.left) * 3 / 4 - Cs->x; - Cs->cy = (WorkArea.bottom - WorkArea.top) * 3 / 4 - Cs->y; + Cs->cx = (pMonitor->rcWork.right - pMonitor->rcWork.left) * 3 / 4; + Cs->cy = (pMonitor->rcWork.bottom - pMonitor->rcWork.top) * 3 / 4; } } /* neither x nor cx are default. Check the y values . @@ -1643,7 +1653,7 @@ else if (IS_DEFAULT(Cs->cy)) { DPRINT("Strange use of CW_USEDEFAULT in nHeight\n"); - Cs->cy = (WorkArea.bottom - WorkArea.top) * 3 / 4 - Cs->y; + Cs->cy = (pMonitor->rcWork.bottom - pMonitor->rcWork.top) * 3 / 4; } } else