Changeset 10091 for trunk/src/user32/win32wbasepos.cpp
- Timestamp:
- May 15, 2003, 2:40:20 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbasepos.cpp
r9866 r10091 1 /* $Id: win32wbasepos.cpp,v 1.3 0 2003-02-27 14:22:45sandervl Exp $ */1 /* $Id: win32wbasepos.cpp,v 1.31 2003-05-15 12:40:20 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (nonclient/position methods) … … 371 371 return swpFlags; 372 372 } 373 /*********************************************************************** 374 * WIN_FixCoordinates 375 * 376 * Fix the coordinates - Helper for WIN_CreateWindowEx. 377 * returns default show mode in sw. 378 * Note: the feature presented as undocumented *is* in the MSDN since 1993. 379 */ 380 void Win32BaseWindow::FixCoordinates( CREATESTRUCTA *cs, INT *sw) 381 { 382 if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16 || 383 cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16) 384 { 385 if (cs->style & (WS_CHILD | WS_POPUP)) 386 { 387 if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16) cs->x = cs->y = 0; 388 if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16) cs->cx = cs->cy = 0; 389 } 390 else /* overlapped window */ 391 { 392 STARTUPINFOA info; 393 394 GetStartupInfoA( &info ); 395 396 if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16) 397 { 398 /* Never believe Microsoft's documentation... CreateWindowEx doc says 399 * that if an overlapped window is created with WS_VISIBLE style bit 400 * set and the x parameter is set to CW_USEDEFAULT, the system ignores 401 * the y parameter. However, disassembling NT implementation (WIN32K.SYS) 402 * reveals that 403 * 404 * 1) not only it checks for CW_USEDEFAULT but also for CW_USEDEFAULT16 405 * 2) it does not ignore the y parameter as the docs claim; instead, it 406 * uses it as second parameter to ShowWindow() unless y is either 407 * CW_USEDEFAULT or CW_USEDEFAULT16. 408 * 409 * The fact that we didn't do 2) caused bogus windows pop up when wine 410 * was running apps that were using this obscure feature. Example - 411 * calc.exe that comes with Win98 (only Win98, it's different from 412 * the one that comes with Win95 and NT) 413 */ 414 if (cs->y != CW_USEDEFAULT && cs->y != CW_USEDEFAULT16) *sw = cs->y; 415 cs->x = (info.dwFlags & STARTF_USEPOSITION) ? info.dwX : 0; 416 cs->y = (info.dwFlags & STARTF_USEPOSITION) ? info.dwY : 0; 417 } 418 419 if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16) 420 { 421 if (info.dwFlags & STARTF_USESIZE) 422 { 423 cs->cx = info.dwXSize; 424 cs->cy = info.dwYSize; 425 } 426 else /* if no other hint from the app, pick 3/4 of the screen real estate */ 427 { 428 RECT r; 429 SystemParametersInfoA( SPI_GETWORKAREA, 0, &r, 0); 430 cs->cx = (((r.right - r.left) * 3) / 4) - cs->x; 431 cs->cy = (((r.bottom - r.top) * 3) / 4) - cs->y; 432 } 433 } 434 } 435 } 436 else 437 { 438 /* neither x nor cx are default. Check the y values . 439 * In the trace we see Outlook and Outlook Express using 440 * cy set to CW_USEDEFAULT when opening the address book. 441 */ 442 if (cs->cy == CW_USEDEFAULT || cs->cy == CW_USEDEFAULT16) { 443 RECT r; 444 dprintf(("Strange use of CW_USEDEFAULT in nHeight\n")); 445 SystemParametersInfoA( SPI_GETWORKAREA, 0, &r, 0); 446 cs->cy = (((r.bottom - r.top) * 3) / 4) - cs->y; 447 } 448 } 449 } 373 450 //****************************************************************************** 374 451 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.