Changeset 5685 for trunk/src/user32/pmwindow.cpp
- Timestamp:
- May 11, 2001, 10:39:46 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/pmwindow.cpp
r5655 r5685 1 /* $Id: pmwindow.cpp,v 1.12 4 2001-05-04 17:02:51sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.125 2001-05-11 08:39:44 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 34 34 #include "oslibgdi.h" 35 35 #include "oslibmsg.h" 36 #define INCLUDED_BY_DC 36 37 #include "dc.h" 37 38 #include <thread.h> … … 59 60 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 60 61 MRESULT EXPENTRY Win32FrameWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 61 MRESULT ProcessPMMessage(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, Win32BaseWindow *win32wnd,62 MSG *pWinMsg, TEB *teb, BOOL isFrame);63 62 64 63 //****************************************************************************** … … 105 104 (PSZ)WIN32_STDCLASS, /* Window class name */ 106 105 (PFNWP)Win32WindowProc, /* Address of window procedure */ 107 #ifdef ODIN_HITTEST108 106 0, 109 #else110 CS_HITTEST,111 #endif112 107 NROF_WIN32WNDBYTES)) 113 108 { … … 129 124 (PSZ)WIN32_STDFRAMECLASS, /* Window class name */ 130 125 (PFNWP)Win32FrameWindowProc, /* Address of window procedure */ 131 #ifdef ODIN_HITTEST132 126 CS_FRAME, 133 #else134 CS_HITTEST | CS_FRAME,135 #endif136 127 FrameClassInfo.cbWindowData+NROF_WIN32WNDBYTES)) 137 128 { … … 166 157 MSG winMsg, *pWinMsg; 167 158 MRESULT rc = 0; 159 POSTMSG_PACKET *postmsg; 160 OSLIBPOINT point, ClientPoint; 168 161 169 162 //Restore our FS selector … … 175 168 176 169 if(!teb || (msg != WM_CREATE && win32wnd == NULL)) { 177 dprintf((" Invalid win32wnd pointer for window %x msg %x", hwnd, msg));170 dprintf(("OS2: Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 178 171 goto RunDefWndProc; 179 172 } … … 205 198 } 206 199 //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END 207 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, FALSE); 208 RestoreOS2TIB(); 209 return rc; 210 211 RunDefWndProc: 212 RestoreOS2TIB(); 213 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 214 } 215 //****************************************************************************** 216 //****************************************************************************** 217 MRESULT ProcessPMMessage(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, Win32BaseWindow *win32wnd, MSG *pWinMsg, TEB *teb, BOOL isFrame) 218 { 219 POSTMSG_PACKET *postmsg; 220 OSLIBPOINT point, ClientPoint; 221 MRESULT rc = 0; 222 223 if(msg == WIN32APP_POSTMSG) { 200 201 if(msg == WIN32APP_POSTMSG) { 224 202 //probably win32 app user message 225 203 if((ULONG)mp1 == WIN32MSG_MAGICA) { … … 230 208 return (MRESULT)win32wnd->DispatchMsgW(pWinMsg); 231 209 } 232 }233 else234 if(msg == WIN32APP_SETFOCUSMSG) {210 } 211 else 212 if(msg == WIN32APP_SETFOCUSMSG) { 235 213 //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing; 236 214 //must delay this function call … … 240 218 teb->o.odin.hwndFocus = 0; 241 219 WinFocusChange(HWND_DESKTOP, hwnd, mp2 ? FC_NOLOSEACTIVE : 0); 242 }243 244 switch( msg )245 {220 } 221 222 switch( msg ) 223 { 246 224 //OS/2 msgs 247 225 case WM_CREATE: … … 280 258 case WM_ENABLE: 281 259 dprintf(("OS2: WM_ENABLE %x", hwnd)); 282 win32wnd->MsgEnable(SHORT1FROMMP(mp1));283 260 break; 284 261 285 262 case WM_SHOW: 286 263 dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1)); 287 win32wnd->MsgShow((ULONG)mp1); 288 break; 289 290 case WM_ADJUSTWINDOWPOS: 291 { 292 PSWP pswp = (PSWP)mp1; 293 SWP swpOld; 294 WINDOWPOS wp,wpOld; 295 HWND hParent = NULLHANDLE, hwndAfter; 296 297 dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 298 299 if(pswp->fl & SWP_NOADJUST) { 300 //ignore weird messages (TODO: why are they sent?) 301 break; 302 } 303 //CB: show dialog in front of owner 304 if (win32wnd->IsModalDialogOwner()) 305 { 306 dprintf(("win32wnd->IsModalDialogOwner %x", win32wnd->getWindowHandle())); 307 pswp->fl |= SWP_ZORDER; 308 pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog(); 309 if (pswp->fl & SWP_ACTIVATE) 310 { 311 pswp->fl &= ~SWP_ACTIVATE; 312 WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE); 313 } 314 } 315 316 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 317 goto RunDefWndProc; 318 319 if(!win32wnd->CanReceiveSizeMsgs()) 320 break; 321 322 WinQueryWindowPos(hwnd, &swpOld); 323 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 324 if (win32wnd->isChild()) { 325 if(win32wnd->getParent()) { 326 hParent = win32wnd->getParent()->getOS2WindowHandle(); 327 } 328 else goto RunDefWndProc; 329 } 330 } 331 hwndAfter = pswp->hwndInsertBehind; 332 if(win32wnd->getParent()) { 333 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 334 win32wnd->getParent()->getClientRectPtr()->left, 335 win32wnd->getParent()->getClientRectPtr()->top, 336 hwnd); 337 } 338 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 339 340 wp.hwnd = win32wnd->getWindowHandle(); 341 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 342 { 343 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 344 if(wndAfter) { 345 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 346 } 347 else wp.hwndInsertAfter = HWND_TOP_W; 348 } 349 350 wpOld = wp; 351 win32wnd->MsgPosChanging((LPARAM)&wp); 352 353 if ((wp.hwndInsertAfter != wpOld.hwndInsertAfter) || 354 (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags)) 355 { 356 ULONG flags = pswp->fl; //make a backup copy; OSLibMapWINDOWPOStoSWP will modify it 357 358 dprintf(("OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct")); 359 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 360 361 if(win32wnd->getParent()) { 362 OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, win32wnd->getParent()->getWindowHeight(), 363 win32wnd->getParent()->getClientRectPtr()->left, 364 win32wnd->getParent()->getClientRectPtr()->top, 365 hwnd); 366 } 367 else OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 368 369 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 370 371 //OSLibMapWINDOWPOStoSWP can add flags, but we must not let it remove flags! 372 if(pswp->fl & SWP_SIZE) 373 flags |= SWP_SIZE; 374 375 if(pswp->fl & SWP_MOVE) 376 flags |= SWP_MOVE; 377 378 pswp->fl = flags; //restore flags 379 380 pswp->fl |= SWP_NOADJUST; 381 pswp->hwndInsertBehind = hwndAfter; 382 pswp->hwnd = hwnd; 383 384 return (MRESULT)0xf; 385 } 386 return (MRESULT)0; 387 } 388 389 case WM_WINDOWPOSCHANGED: 390 { 391 PSWP pswp = (PSWP)mp1,pswpOld = pswp+1; 392 SWP swpOld = *(pswp + 1); 393 WINDOWPOS wp; 394 HWND hParent = NULLHANDLE; 395 RECTL rect; 396 397 dprintf(("OS2: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 398 399 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 400 { 401 if(pswp->fl & SWP_ACTIVATE) 402 { 403 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 404 if(!(WinQueryWindowULong(hwnd, OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE)) 405 { 406 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 407 } 408 } 409 else 410 if(pswp->fl & SWP_DEACTIVATE) 411 { 412 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 413 if(WinQueryWindowULong(hwnd, OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE) 414 { 415 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd); 416 } 417 } 418 goto RunDefWndProc; 419 } 420 421 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) 422 { 423 if(win32wnd->isChild()) 424 { 425 if(win32wnd->getParent()) { 426 hParent = win32wnd->getParent()->getOS2WindowHandle(); 427 } 428 else goto PosChangedEnd; //parent has just been destroyed 429 } 430 } 431 432 433 if(win32wnd->getParent()) { 434 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 435 win32wnd->getParent()->getClientRectPtr()->left, 436 win32wnd->getParent()->getClientRectPtr()->top, 437 hwnd); 438 } 439 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 440 441 wp.hwnd = win32wnd->getWindowHandle(); 442 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 443 { 444 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 445 if(wndAfter) { 446 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 447 } 448 else wp.hwndInsertAfter = HWND_TOP_W; 449 } 450 451 #ifndef USE_CALCVALIDRECT 452 if((pswp->fl & (SWP_MOVE | SWP_SIZE))) 453 { 454 //CB: todo: use result for WM_CALCVALIDRECTS 455 //Get old client rectangle (for invalidation of frame window parts later on) 456 //Use new window height to calculate the client area 457 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&rect); 458 459 //Note: Also updates the new window rectangle 460 win32wnd->MsgFormatFrame(&wp); 461 462 if(win32wnd->isOwnDC()) { 463 dprintf(("Mark owndc of %x as dirty", win32wnd->getWindowHandle())); 464 win32wnd->invalidateOwnDC(); //mark DC as dirty. origin & visible region must be reinitialized 465 } 466 if(win32wnd->CanReceiveSizeMsgs()) 467 win32wnd->MsgPosChanged((LPARAM)&wp); 468 469 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy))) 470 { 471 //redraw the frame (to prevent unnecessary client updates) 472 BOOL redrawAll = FALSE; 473 474 if (win32wnd->getWindowClass()) 475 { 476 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 477 478 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx)) 479 redrawAll = TRUE; 480 else 481 if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy)) 482 redrawAll = TRUE; 483 } 484 else redrawAll = TRUE; 485 486 if(win32wnd->IsMixMaxStateChanging()) { 487 dprintf(("WM_CALCVALIDRECT: window changed min/max/restore state, invalidate entire window")); 488 redrawAll = TRUE; 489 } 490 491 if (redrawAll) 492 { 493 //CB: redraw all children for now 494 // -> problems with update region if we don't do it 495 // todo: rewrite whole handling 496 WinInvalidateRect(hwnd,NULL,TRUE); 497 } 498 else 499 { 500 HPS hps = WinGetPS(hwnd); 501 RECTL frame,client,arcl[4]; 502 503 WinQueryWindowRect(hwnd,&frame); 504 505 //top 506 arcl[0].xLeft = 0; 507 arcl[0].xRight = frame.xRight; 508 arcl[0].yBottom = rect.yTop; 509 arcl[0].yTop = frame.yTop; 510 //right 511 arcl[1].xLeft = rect.xRight; 512 arcl[1].xRight = frame.xRight; 513 arcl[1].yBottom = 0; 514 arcl[1].yTop = frame.yTop; 515 //left 516 arcl[2].xLeft = 0; 517 arcl[2].xRight = rect.xLeft; 518 arcl[2].yBottom = 0; 519 arcl[2].yTop = frame.yTop; 520 //bottom 521 arcl[3].xLeft = 0; 522 arcl[3].xRight = frame.xRight; 523 arcl[3].yBottom = 0; 524 arcl[3].yTop = rect.yBottom; 525 526 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl); 527 528 WinInvalidateRegion(hwnd,hrgn,FALSE); 529 GpiDestroyRegion(hps,hrgn); 530 WinReleasePS(hps); 531 } 532 } 533 } 534 else 535 { 536 #endif //USE_CALCVALIDRECT 537 if(win32wnd->CanReceiveSizeMsgs()) 538 win32wnd->MsgPosChanged((LPARAM)&wp); 539 #ifndef USE_CALCVALIDRECT 540 } 541 #endif 542 543 if(pswp->fl & SWP_ACTIVATE) 544 { 545 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 546 if(!(WinQueryWindowULong(hwnd, OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE)) 547 { 548 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 549 } 550 } 551 else 552 if(pswp->fl & SWP_DEACTIVATE) 553 { 554 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 555 if(WinQueryWindowULong(hwnd, OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE) 556 { 557 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd); 558 } 559 } 560 561 PosChangedEnd: 562 return (MRESULT)FALSE; 563 } 264 break; 564 265 565 266 case WM_ACTIVATE: … … 568 269 569 270 dprintf(("OS2: WM_ACTIVATE %x %x %x", hwnd, mp1, mp2)); 570 571 271 WinSetWindowULong(hwnd, OFFSET_WIN32FLAGS, SHORT1FROMMP(mp1) ? (flags | WINDOWFLAG_ACTIVE):(flags & ~WINDOWFLAG_ACTIVE)); 572 272 if(win32wnd->IsWindowCreated()) 573 273 { 574 274 win32wnd->MsgActivate((LOWORD(pWinMsg->wParam) == WA_ACTIVE_W) ? 1 : 0, HIWORD(pWinMsg->wParam), pWinMsg->lParam, (HWND)mp2); 575 576 //CB: show owner behind the dialog 577 if(win32wnd->IsModalDialog()) 578 { 579 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 580 581 if(topOwner) WinSetWindowPos(topOwner->getOS2WindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 582 } 583 } 584 return 0; 275 } 276 break; 585 277 } 586 278 587 279 case WM_SIZE: 588 280 { 589 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2))); 281 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp1))); 282 win32wnd->SetVisibleRegionChanged(TRUE); 590 283 goto RunDefWndProc; 591 284 } 592 285 593 case WM_CALCVALIDRECTS:594 #ifdef USE_CALCVALIDRECT595 {596 PRECTL oldRect = (PRECTL)mp1, newRect = oldRect+1;597 PSWP pswp = (PSWP)mp2;598 SWP swpOld;599 WINDOWPOS wp;600 RECTL newClientRect, oldClientRect;601 ULONG nccalcret;602 // UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP;603 UINT res = 0;604 605 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle()));606 607 //Get old position info608 WinQueryWindowPos(hwnd, &swpOld);609 610 if(win32wnd->getParent()) {611 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(),612 win32wnd->getParent()->getClientRectPtr()->left,613 win32wnd->getParent()->getClientRectPtr()->top,614 hwnd);615 }616 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd);617 618 wp.hwnd = win32wnd->getWindowHandle();619 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))620 {621 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);622 if(wndAfter) {623 wp.hwndInsertAfter = wndAfter->getWindowHandle();624 }625 else wp.hwndInsertAfter = HWND_TOP_W;626 }627 628 //Get old client rectangle629 mapWin32ToOS2Rect(oldRect->yTop - oldRect->yBottom, win32wnd->getClientRectPtr(), (PRECTLOS2)&oldClientRect);630 631 //Note: Also updates the new window rectangle632 nccalcret = win32wnd->MsgFormatFrame(&wp);633 634 //Get new client rectangle635 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&newClientRect);636 637 if(nccalcret == 0) {638 res = CVR_ALIGNTOP | CVR_ALIGNLEFT;639 }640 else {641 if(nccalcret & WVR_ALIGNTOP_W) {642 res |= CVR_ALIGNTOP;643 }644 else645 if(nccalcret & WVR_ALIGNBOTTOM_W) {646 res |= CVR_ALIGNBOTTOM;647 }648 649 if(nccalcret & WVR_ALIGNLEFT_W) {650 res |= CVR_ALIGNLEFT;651 }652 else653 if(nccalcret & WVR_ALIGNRIGHT_W) {654 res |= CVR_ALIGNRIGHT;655 }656 657 if(nccalcret & WVR_REDRAW_W) {//WVR_REDRAW_W = (WVR_HREDRAW | WVR_VREDRAW)658 res |= CVR_REDRAW;659 }660 else661 if(nccalcret & WVR_VALIDRECTS_W) {662 //TODO:663 //res = 0;664 }665 }666 if(win32wnd->IsMixMaxStateChanging()) {667 dprintf(("WM_CALCVALIDRECT: window changed min/max/restore state, invalidate entire window"));668 res |= CVR_REDRAW;669 }670 if(res == (CVR_ALIGNTOP|CVR_ALIGNLEFT)) {671 oldRect->xRight -= oldClientRect.xLeft;672 oldRect->yBottom += oldClientRect.yBottom;673 newRect->xRight -= newClientRect.xLeft;674 newRect->yBottom += newClientRect.yBottom;675 }676 677 #if 0678 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy)))679 {680 //redraw the frame (to prevent unnecessary client updates)681 BOOL redrawAll = FALSE;682 683 if (win32wnd->getWindowClass())684 {685 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W);686 687 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx))688 redrawAll = TRUE;689 else690 if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy))691 redrawAll = TRUE;692 }693 else redrawAll = TRUE;694 695 if (redrawAll)696 {697 //CB: redraw all children for now698 // -> problems with update region if we don't do it699 // todo: rewrite whole handling700 WinInvalidateRect(hwnd,NULL,TRUE);701 }702 else703 {704 HPS hps = WinGetPS(hwnd);705 RECTL frame,client,arcl[4];706 707 WinQueryWindowRect(hwnd,&frame);708 709 //top710 arcl[0].xLeft = 0;711 arcl[0].xRight = frame.xRight;712 arcl[0].yBottom = rect.yTop;713 arcl[0].yTop = frame.yTop;714 //right715 arcl[1].xLeft = rect.xRight;716 arcl[1].xRight = frame.xRight;717 arcl[1].yBottom = 0;718 arcl[1].yTop = frame.yTop;719 //left720 arcl[2].xLeft = 0;721 arcl[2].xRight = rect.xLeft;722 arcl[2].yBottom = 0;723 arcl[2].yTop = frame.yTop;724 //bottom725 arcl[3].xLeft = 0;726 arcl[3].xRight = frame.xRight;727 arcl[3].yBottom = 0;728 arcl[3].yTop = rect.yBottom;729 730 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl);731 732 WinInvalidateRegion(hwnd,hrgn,FALSE);733 GpiDestroyRegion(hps,hrgn);734 WinReleasePS(hps);735 }736 }737 738 }739 #endif740 741 return (MRESULT)res;742 }743 #else744 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle()));745 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP);746 #endif747 286 748 287 case WM_VRNENABLED: … … 750 289 if(!win32wnd->isComingToTop() && ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == WS_EX_TOPMOST_W)) 751 290 { 752 HWND hwndrelated; 753 Win32BaseWindow *topwindow; 754 755 win32wnd->setComingToTop(TRUE); 756 757 hwndrelated = WinQueryWindow(hwnd, QW_PREV); 758 dprintf(("WM_VRNENABLED hwndrelated = %x (hwnd=%x)", hwndrelated, hwnd)); 759 topwindow = Win32BaseWindow::GetWindowFromOS2Handle(hwndrelated); 760 if(topwindow == NULL || ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == 0)) { 761 //put window at the top of z order 762 WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 763 } 764 765 win32wnd->setComingToTop(FALSE); 766 break; 767 } 768 //Restore window origin of window with CS_OWNDC style 769 //(fixes paint offset problems in Opera windows) 770 if(win32wnd->isOwnDC()) { 771 dprintfOrigin(win32wnd->getOwnDC()); 772 selectClientArea(win32wnd, win32wnd->getOwnDC()); 291 HWND hwndrelated; 292 Win32BaseWindow *topwindow; 293 294 win32wnd->setComingToTop(TRUE); 295 296 hwndrelated = WinQueryWindow(hwnd, QW_PREV); 297 dprintf(("WM_VRNENABLED hwndrelated = %x (hwnd=%x)", hwndrelated, hwnd)); 298 topwindow = Win32BaseWindow::GetWindowFromOS2Handle(hwndrelated); 299 if(topwindow == NULL || ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == 0)) { 300 //put window at the top of z order 301 WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 302 } 303 304 win32wnd->setComingToTop(FALSE); 305 break; 773 306 } 774 307 goto RunDefWndProc; … … 776 309 case WM_VRNDISABLED: 777 310 dprintf(("OS2: WM_VRNDISABLED %x %x %x", win32wnd->getWindowHandle(), mp1, mp2)); 778 if(win32wnd->isOwnDC()) {779 dprintfOrigin(win32wnd->getOwnDC());780 }781 311 goto RunDefWndProc; 782 312 … … 808 338 } 809 339 810 #if 0811 //is sent to both windows gaining and loosing the focus812 case WM_FOCUSCHANGE:813 {814 HWND hwndFocus = (HWND)mp1;815 HWND hwndLoseFocus, hwndGainFocus;816 USHORT usSetFocus = SHORT1FROMMP(mp2);817 USHORT fsFocusChange = SHORT2FROMMP(mp2);818 819 rc = 0;820 dprintf(("OS2: WM_FOCUSCHANGE (start) %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange));821 if(usSetFocus) {822 hwndGainFocus = hwnd;823 hwndLoseFocus = hwndFocus;824 }825 else {826 hwndGainFocus = hwndFocus;827 hwndLoseFocus = hwnd;828 }829 830 if(usSetFocus)831 {832 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndLoseFocus);833 if(!(fsFocusChange & FC_NOSETACTIVE))834 {835 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent()))836 {837 if(winfocus)838 WinSendMsg(winfocus->GetTopParent()->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);839 else840 WinSendMsg(hwndLoseFocus, WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);841 }842 }843 //SvL: Check if window is still valid844 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);845 if(win32wnd == NULL)846 return (MRESULT)rc;847 848 if(!(fsFocusChange & FC_NOSETACTIVE))849 {850 Win32BaseWindow *topparent = win32wnd->GetTopParent();851 if(!winfocus || (winfocus->GetTopParent() != topparent))852 {853 if(!(fsFocusChange & FC_NOBRINGTOTOP))854 {855 if(topparent) {856 //put window at the top of z order857 WinSetWindowPos(topparent->getOS2WindowHandle(), HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);858 }859 }860 861 // PH 2000/09/01 Netscape 4.7862 // check if topparent is valid863 if (topparent)864 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);865 }866 }867 //SvL: Check if window is still valid868 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);869 if(win32wnd == NULL)870 return (MRESULT)rc;871 872 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection873 if(!(fsFocusChange & FC_NOSETSELECTION)) {874 WinSendMsg(hwndGainFocus, WM_SETSELECTION, (MPARAM)1, (MPARAM)0);875 }876 877 if(!(fsFocusChange & FC_NOSETFOCUS)) {878 WinSendMsg(hwndGainFocus, WM_SETFOCUS, (MPARAM)hwndLoseFocus, (MPARAM)1);879 }880 }881 else /* no usSetFocus */882 {883 if(!(fsFocusChange & FC_NOLOSEFOCUS)) {884 WinSendMsg(hwndLoseFocus, WM_SETFOCUS, (MPARAM)hwndGainFocus, (MPARAM)0);885 }886 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection887 if(!(fsFocusChange & FC_NOLOSESELECTION)) {888 WinSendMsg(hwndLoseFocus, WM_SETSELECTION, (MPARAM)0, (MPARAM)0);889 }890 //SvL: Check if window is still valid891 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);892 if(win32wnd == NULL) {893 return (MRESULT)rc;894 }895 896 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndGainFocus);897 if(!(fsFocusChange & FC_NOLOSEACTIVE))898 {899 Win32BaseWindow *topparent = win32wnd->GetTopParent();900 901 if(!winfocus || (winfocus->GetTopParent() != topparent))902 {903 // PH 2000/09/01 Netscape 4.7904 // check if topparent is valid905 if (topparent)906 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus);907 }908 }909 //SvL: Check if window is still valid910 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);911 if(win32wnd == NULL)912 return (MRESULT)rc;913 914 if(!(fsFocusChange & FC_NOSETACTIVE))915 {916 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent()))917 {918 if(winfocus)919 {920 // PH 2000/09/01 Netscape 4.7921 // check if topparent is valid922 Win32BaseWindow *topparent = winfocus->GetTopParent();923 if (topparent)924 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);925 }926 else927 WinSendMsg(hwndGainFocus, WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus);928 }929 }930 }931 932 933 #ifdef DEBUG934 SetWin32TIB();935 dprintf(("OS2: WM_FOCUSCHANGE (end) %x %x %x", win32wnd->getWindowHandle(), mp1, mp2));936 #endif937 return (MRESULT)rc;938 }939 #endif940 941 340 //************************************************************************** 942 341 //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen 943 342 //************************************************************************** 944 #ifndef ODIN_HITTEST945 case WM_HITTEST:946 {947 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {948 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);949 }950 if(win32wnd && win32wnd->IsWindowCreated())951 {952 MRESULT rc;953 954 rc = (MRESULT)win32wnd->MsgHitTest(pWinMsg);955 return rc;956 }957 return (MRESULT)HT_NORMAL;958 }959 #endif960 343 961 344 case WM_BUTTON1DOWN: … … 991 374 case WM_MOUSEMOVE: 992 375 { 993 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {994 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);995 }376 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 377 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 378 } 996 379 if(win32wnd) 997 380 win32wnd->MsgMouseMove(pWinMsg); … … 1068 451 rectl.yBottom != rectl.yTop)) 1069 452 { 1070 PRECT pClient = win32wnd->getClientRectPtr(); 1071 PRECT pWindow = win32wnd->getWindowRect(); 1072 1073 if(!(pClient->left == 0 && pClient->top == 0 && 1074 win32wnd->getClientHeight() == win32wnd->getWindowHeight() && 1075 win32wnd->getClientWidth() == win32wnd->getWindowWidth())) 1076 { 1077 win32wnd->MsgNCPaint(); 1078 } 1079 win32wnd->DispatchMsgA(pWinMsg); 453 win32wnd->DispatchMsgA(pWinMsg); 1080 454 } 1081 455 else goto RunDefWndProc; 1082 1083 //SvL: Not calling the default window procedure causes all sorts of1084 // strange problems (redraw & hanging app)1085 // -> check what WinBeginPaint does what we're forgetting in BeginPaint1086 // WinQueryUpdateRect(hwnd, &rectl);1087 // if(rectl.xLeft == 0 && rectl.yTop == 0 && rectl.xRight == 0 && rectl.yBottom == 0) {1088 // RestoreOS2TIB();1089 // return (MRESULT)FALSE;1090 // }1091 // dprintf(("Update rectangle (%d,%d)(%d,%d) not empty, msg %x", rectl.xLeft, rectl.yTop, rectl.xRight, rectl.yBottom, pWinMsg->message));1092 // goto RunDefWndProc;1093 456 break; 1094 457 } … … 1100 463 } 1101 464 1102 #if 0 1103 case WM_CONTEXTMENU: 1104 { 1105 win32wnd->DispatchMsgA(pWinMsg); 1106 1107 return (MRESULT)TRUE; 1108 } 1109 #endif 1110 1111 case WM_QUERYTRACKINFO: 1112 { 1113 PTRACKINFO trackInfo = (PTRACKINFO)mp2; 1114 1115 dprintf(("OS2: WM_QUERYTRACKINFO %x", win32wnd->getWindowHandle())); 1116 trackInfo->cxBorder = 4; 1117 trackInfo->cyBorder = 4; 1118 win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize); 1119 return (MRESULT)TRUE; 1120 } 1121 1122 case WM_QUERYBORDERSIZE: 1123 { 1124 PWPOINT size = (PWPOINT)mp1; 1125 1126 dprintf(("OS2: WM_QUERYBORDERSIZE %x", win32wnd->getWindowHandle())); 1127 1128 size->x = 0; 1129 size->y = 0; 1130 return (MRESULT)TRUE; 1131 } 465 case WM_CALCVALIDRECTS: 466 dprintf(("OS2: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 467 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 1132 468 1133 469 case WM_REALIZEPALETTE: … … 1163 499 default: 1164 500 dprintf2(("OS2: RunDefWndProc hwnd %x msg %x mp1 %x mp2 %x", hwnd, msg, mp1, mp2)); 1165 RestoreOS2TIB(); 1166 if(isFrame) { 1167 return pfnFrameWndProc(hwnd, msg, mp1, mp2); 1168 } 1169 else return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 1170 } 1171 return (MRESULT)rc; 501 goto RunDefWndProc; 502 } 503 return (MRESULT)rc; 1172 504 1173 505 RunDefWndProc: 1174 506 // dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 1175 RestoreOS2TIB(); 1176 if(isFrame) { 1177 return pfnFrameWndProc(hwnd, msg, mp1, mp2); 1178 } 1179 else return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 507 RestoreOS2TIB(); 508 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 1180 509 } /* End of Win32WindowProc */ 1181 510 //****************************************************************************** … … 1195 524 //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- BEGIN 1196 525 teb = GetThreadTEB(); 1197 win32wnd = Win32BaseWindow::GetWindowFromOS2 Handle(hwnd);526 win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd); 1198 527 1199 528 if(!teb || (msg != WM_CREATE && win32wnd == NULL)) { 1200 dprintf((" Invalid win32wnd pointer for window %x msg %x", hwnd, msg));529 dprintf(("PMFRAME: Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 1201 530 goto RunDefFrameWndProc; 1202 531 } … … 1233 562 case WM_CREATE: 1234 563 { 1235 RestoreOS2TIB(); 1236 pfnFrameWndProc(hwnd, msg, mp1, mp2); 1237 SetWin32TIB(); 1238 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1239 break; 1240 } 564 //WM_CREATE handled during client window creation 565 goto RunDefFrameWndProc; 566 } 567 568 case WM_PAINT: 569 { 570 RECTL rectl; 571 572 573 HPS hps = WinBeginPaint(hwnd, NULL, &rectl); 574 dprintf(("PMFRAME: WM_PAINT %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop)); 575 576 if(win32wnd->IsWindowCreated() && (rectl.xLeft != rectl.xRight && 577 rectl.yBottom != rectl.yTop)) 578 { 579 PRECT pClient = win32wnd->getClientRectPtr(); 580 PRECT pWindow = win32wnd->getWindowRect(); 581 582 if(!(pClient->left == 0 && pClient->top == 0 && 583 win32wnd->getClientHeight() == win32wnd->getWindowHeight() && 584 win32wnd->getClientWidth() == win32wnd->getWindowWidth())) 585 { 586 RECT rectUpdate; 587 588 mapOS2ToWin32Rect(win32wnd->getWindowHeight(), (PRECTLOS2)&rectl, &rectUpdate); 589 win32wnd->MsgNCPaint(&rectUpdate); 590 } 591 } 592 WinEndPaint(hps); 593 break; 594 } 595 596 case WM_ERASEBACKGROUND: 597 { 598 dprintf(("PMFRAME:WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle())); 599 return (MRESULT)FALSE; 600 } 601 602 //************************************************************************** 603 //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen 604 //************************************************************************** 605 606 case WM_BUTTON1DOWN: 607 case WM_BUTTON1UP: 608 case WM_BUTTON1DBLCLK: 609 case WM_BUTTON2DOWN: 610 case WM_BUTTON2UP: 611 case WM_BUTTON2DBLCLK: 612 case WM_BUTTON3DOWN: 613 case WM_BUTTON3UP: 614 case WM_BUTTON3DBLCLK: 615 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 616 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 617 } 618 if(win32wnd) 619 win32wnd->MsgButton(pWinMsg); 620 621 rc = (MRESULT)TRUE; 622 break; 623 624 case WM_BUTTON2MOTIONSTART: 625 case WM_BUTTON2MOTIONEND: 626 case WM_BUTTON2CLICK: 627 case WM_BUTTON1MOTIONSTART: 628 case WM_BUTTON1MOTIONEND: 629 case WM_BUTTON1CLICK: 630 case WM_BUTTON3MOTIONSTART: 631 case WM_BUTTON3MOTIONEND: 632 case WM_BUTTON3CLICK: 633 rc = (MRESULT)TRUE; 634 break; 635 636 case WM_MOUSEMOVE: 637 { 638 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 639 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 640 } 641 if(win32wnd) 642 win32wnd->MsgMouseMove(pWinMsg); 643 break; 644 } 645 646 case WM_ADJUSTWINDOWPOS: 647 { 648 PSWP pswp = (PSWP)mp1; 649 SWP swpOld; 650 WINDOWPOS wp,wpOld; 651 HWND hParent = NULLHANDLE, hwndAfter; 652 653 dprintf(("PMFRAME:WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 654 655 if(pswp->fl & SWP_NOADJUST) { 656 //ignore weird messages (TODO: why are they sent?) 657 break; 658 } 659 //CB: show dialog in front of owner 660 if (win32wnd->IsModalDialogOwner()) 661 { 662 dprintf(("win32wnd->IsModalDialogOwner %x", win32wnd->getWindowHandle())); 663 pswp->fl |= SWP_ZORDER; 664 pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog(); 665 if (pswp->fl & SWP_ACTIVATE) 666 { 667 pswp->fl &= ~SWP_ACTIVATE; 668 WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE); 669 } 670 } 671 672 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 673 goto RunDefWndProc; 674 675 if(!win32wnd->CanReceiveSizeMsgs()) 676 break; 677 678 WinQueryWindowPos(hwnd, &swpOld); 679 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 680 if (win32wnd->isChild()) { 681 if(win32wnd->getParent()) { 682 hParent = win32wnd->getParent()->getOS2WindowHandle(); 683 } 684 else goto RunDefWndProc; 685 } 686 } 687 hwndAfter = pswp->hwndInsertBehind; 688 if(win32wnd->getParent()) { 689 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getClientHeight(), hwnd); 690 } 691 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), hwnd); 692 693 wp.hwnd = win32wnd->getWindowHandle(); 694 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 695 { 696 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 697 if(wndAfter) { 698 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 699 } 700 else wp.hwndInsertAfter = HWND_TOP_W; 701 } 702 703 wpOld = wp; 704 win32wnd->MsgPosChanging((LPARAM)&wp); 705 706 if ((wp.hwndInsertAfter != wpOld.hwndInsertAfter) || 707 (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags)) 708 { 709 ULONG flags = pswp->fl; //make a backup copy; OSLibMapWINDOWPOStoSWP will modify it 710 711 dprintf(("PMFRAME:WM_ADJUSTWINDOWPOS, app changed windowpos struct")); 712 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 713 714 if(win32wnd->getParent()) { 715 OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, win32wnd->getParent()->getClientHeight(), 716 hwnd); 717 } 718 else OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, OSLibQueryScreenHeight(), hwnd); 719 720 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 721 722 //OSLibMapWINDOWPOStoSWP can add flags, but we must not let it remove flags! 723 if(pswp->fl & SWP_SIZE) 724 flags |= SWP_SIZE; 725 726 if(pswp->fl & SWP_MOVE) 727 flags |= SWP_MOVE; 728 729 pswp->fl = flags; //restore flags 730 731 pswp->fl |= SWP_NOADJUST; 732 pswp->hwndInsertBehind = hwndAfter; 733 pswp->hwnd = hwnd; 734 735 return (MRESULT)0xf; 736 } 737 return (MRESULT)0; 738 } 739 740 case WM_WINDOWPOSCHANGED: 741 { 742 PSWP pswp = (PSWP)mp1,pswpOld = pswp+1; 743 SWP swpOld = *(pswp + 1); 744 WINDOWPOS wp; 745 HWND hParent = NULLHANDLE; 746 RECTL rect; 747 748 dprintf(("PMFRAME:WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 749 750 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 751 { 752 if(pswp->fl & SWP_ACTIVATE) 753 { 754 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 755 if(!(WinQueryWindowULong(WinWindowFromID(hwnd,FID_CLIENT), OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE)) 756 { 757 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 758 } 759 } 760 else 761 if(pswp->fl & SWP_DEACTIVATE) 762 { 763 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 764 if(WinQueryWindowULong(WinWindowFromID(hwnd,FID_CLIENT), OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE) 765 { 766 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd); 767 } 768 } 769 goto RunDefWndProc; 770 } 771 772 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) 773 { 774 if(win32wnd->isChild()) 775 { 776 if(win32wnd->getParent()) { 777 hParent = win32wnd->getParent()->getOS2WindowHandle(); 778 } 779 else goto PosChangedEnd; //parent has just been destroyed 780 } 781 } 782 783 784 if(win32wnd->getParent()) { 785 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getClientHeight(), 786 hwnd); 787 } 788 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), hwnd); 789 790 wp.hwnd = win32wnd->getWindowHandle(); 791 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 792 { 793 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 794 if(wndAfter) { 795 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 796 } 797 else wp.hwndInsertAfter = HWND_TOP_W; 798 } 799 800 if(pswp->fl & SWP_SHOW) { 801 WinShowWindow(win32wnd->getOS2WindowHandle(), 1); 802 } 803 #ifndef USE_CALCVALIDRECT 804 if((pswp->fl & (SWP_MOVE | SWP_SIZE))) 805 { 806 //CB: todo: use result for WM_CALCVALIDRECTS 807 //Get old client rectangle (for invalidation of frame window parts later on) 808 //Use new window height to calculate the client area 809 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&rect); 810 811 //Note: Also updates the new window rectangle 812 win32wnd->MsgFormatFrame(&wp); 813 814 if(win32wnd->isOwnDC()) { 815 setPageXForm(win32wnd, (pDCData)GpiQueryDCData(win32wnd->getOwnDC())); 816 } 817 818 if(win32wnd->CanReceiveSizeMsgs()) 819 win32wnd->MsgPosChanged((LPARAM)&wp); 820 821 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy))) 822 { 823 //redraw the frame (to prevent unnecessary client updates) 824 BOOL redrawAll = FALSE; 825 826 dprintf2(("WM_WINDOWPOSCHANGED: redraw frame")); 827 if (win32wnd->getWindowClass()) 828 { 829 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 830 831 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx)) 832 redrawAll = TRUE; 833 else 834 if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy)) 835 redrawAll = TRUE; 836 } 837 else redrawAll = TRUE; 838 839 if(win32wnd->IsMixMaxStateChanging()) { 840 dprintf(("WM_CALCVALIDRECT: window changed min/max/restore state, invalidate entire window")); 841 redrawAll = TRUE; 842 } 843 844 if (redrawAll) 845 { 846 //CB: redraw all children for now 847 // -> problems with update region if we don't do it 848 // todo: rewrite whole handling 849 WinInvalidateRect(hwnd,NULL,TRUE); 850 } 851 else 852 { 853 HPS hps = WinGetPS(hwnd); 854 RECTL frame,client,arcl[4]; 855 856 WinQueryWindowRect(hwnd,&frame); 857 858 //top 859 arcl[0].xLeft = 0; 860 arcl[0].xRight = frame.xRight; 861 arcl[0].yBottom = rect.yTop; 862 arcl[0].yTop = frame.yTop; 863 //right 864 arcl[1].xLeft = rect.xRight; 865 arcl[1].xRight = frame.xRight; 866 arcl[1].yBottom = 0; 867 arcl[1].yTop = frame.yTop; 868 //left 869 arcl[2].xLeft = 0; 870 arcl[2].xRight = rect.xLeft; 871 arcl[2].yBottom = 0; 872 arcl[2].yTop = frame.yTop; 873 //bottom 874 arcl[3].xLeft = 0; 875 arcl[3].xRight = frame.xRight; 876 arcl[3].yBottom = 0; 877 arcl[3].yTop = rect.yBottom; 878 879 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl); 880 881 WinInvalidateRegion(hwnd,hrgn,FALSE); 882 GpiDestroyRegion(hps,hrgn); 883 WinReleasePS(hps); 884 } 885 } 886 } 887 else 888 { 889 #endif //USE_CALCVALIDRECT 890 if(win32wnd->CanReceiveSizeMsgs()) 891 win32wnd->MsgPosChanged((LPARAM)&wp); 892 #ifndef USE_CALCVALIDRECT 893 } 894 #endif 895 896 if(pswp->fl & SWP_ACTIVATE) 897 { 898 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 899 if(!(WinQueryWindowULong(WinWindowFromID(hwnd,FID_CLIENT), OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE)) 900 { 901 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 902 } 903 } 904 else 905 if(pswp->fl & SWP_DEACTIVATE) 906 { 907 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 908 if(WinQueryWindowULong(WinWindowFromID(hwnd,FID_CLIENT), OFFSET_WIN32FLAGS) & WINDOWFLAG_ACTIVE) 909 { 910 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)FALSE, (MPARAM)hwnd); 911 } 912 } 913 914 PosChangedEnd: 915 return (MRESULT)FALSE; 916 } 917 918 case WM_CALCVALIDRECTS: 919 #ifdef USE_CALCVALIDRECT 920 { 921 PRECTL oldRect = (PRECTL)mp1, newRect = oldRect+1; 922 PSWP pswp = (PSWP)mp2; 923 SWP swpOld; 924 WINDOWPOS wp; 925 RECTL newClientRect, oldClientRect; 926 ULONG nccalcret; 927 // UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP; 928 UINT res = 0; 929 930 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 931 932 //Get old position info 933 WinQueryWindowPos(hwnd, &swpOld); 934 935 if(win32wnd->getParent()) { 936 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getClientHeight(), 937 win32wnd->getParent()->getClientRectPtr()->left, 938 win32wnd->getParent()->getClientRectPtr()->top, 939 hwnd); 940 } 941 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 942 943 wp.hwnd = win32wnd->getWindowHandle(); 944 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 945 { 946 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 947 if(wndAfter) { 948 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 949 } 950 else wp.hwndInsertAfter = HWND_TOP_W; 951 } 952 953 //Get old client rectangle 954 mapWin32ToOS2Rect(oldRect->yTop - oldRect->yBottom, win32wnd->getClientRectPtr(), (PRECTLOS2)&oldClientRect); 955 956 //Note: Also updates the new window rectangle 957 nccalcret = win32wnd->MsgFormatFrame(&wp); 958 959 //Get new client rectangle 960 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&newClientRect); 961 962 if(nccalcret == 0) { 963 res = CVR_ALIGNTOP | CVR_ALIGNLEFT; 964 } 965 else { 966 if(nccalcret & WVR_ALIGNTOP_W) { 967 res |= CVR_ALIGNTOP; 968 } 969 else 970 if(nccalcret & WVR_ALIGNBOTTOM_W) { 971 res |= CVR_ALIGNBOTTOM; 972 } 973 974 if(nccalcret & WVR_ALIGNLEFT_W) { 975 res |= CVR_ALIGNLEFT; 976 } 977 else 978 if(nccalcret & WVR_ALIGNRIGHT_W) { 979 res |= CVR_ALIGNRIGHT; 980 } 981 982 if(nccalcret & WVR_REDRAW_W) {//WVR_REDRAW_W = (WVR_HREDRAW | WVR_VREDRAW) 983 res |= CVR_REDRAW; 984 } 985 else 986 if(nccalcret & WVR_VALIDRECTS_W) { 987 //TODO: 988 //res = 0; 989 } 990 } 991 if(win32wnd->IsMixMaxStateChanging()) { 992 dprintf(("WM_CALCVALIDRECT: window changed min/max/restore state, invalidate entire window")); 993 res |= CVR_REDRAW; 994 } 995 if(res == (CVR_ALIGNTOP|CVR_ALIGNLEFT)) { 996 oldRect->xRight -= oldClientRect.xLeft; 997 oldRect->yBottom += oldClientRect.yBottom; 998 newRect->xRight -= newClientRect.xLeft; 999 newRect->yBottom += newClientRect.yBottom; 1000 } 1001 return (MRESULT)res; 1002 } 1003 #else 1004 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 1005 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 1006 #endif 1241 1007 1242 1008 case WM_CALCFRAMERECT: 1243 dprintf((" OS2:WM_CALCFRAMERECT %x", win32wnd->getWindowHandle()));1009 dprintf(("PMFRAME:WM_CALCFRAMERECT %x", win32wnd->getWindowHandle())); 1244 1010 rc = (MRESULT)TRUE; 1245 1011 break; … … 1247 1013 case WM_QUERYCTLTYPE: 1248 1014 // This is a frame window 1249 dprintf((" OS2:WM_QUERYCTLTYPE %x", win32wnd->getWindowHandle()));1015 dprintf(("PMFRAME:WM_QUERYCTLTYPE %x", win32wnd->getWindowHandle())); 1250 1016 rc = (MRESULT)CCT_FRAME; 1251 1017 break; 1252 1018 1019 #ifdef DEBUG 1253 1020 case WM_QUERYFOCUSCHAIN: 1254 dprintf(("OS2: WM_QUERYFOCUSCHAIN %x fsCmd %x parent %x", win32wnd->getWindowHandle(), SHORT1FROMMP(mp1), mp2)); 1255 1256 RestoreOS2TIB(); 1257 rc = pfnFrameWndProc(hwnd, msg, mp1, mp2); 1258 SetWin32TIB(); 1259 dprintf(("OS2: WM_QUERYFOCUSCHAIN %x fsCmd %x parent %x returned %x", win32wnd->getWindowHandle(), SHORT1FROMMP(mp1), mp2, rc)); 1260 break; 1261 1021 dprintf(("PMFRAME:WM_QUERYFOCUSCHAIN %x fsCmd %x parent %x", win32wnd->getWindowHandle(), SHORT1FROMMP(mp1), mp2)); 1022 1023 // RestoreOS2TIB(); 1024 // rc = pfnFrameWndProc(hwnd, msg, mp1, mp2); 1025 // SetWin32TIB(); 1026 // dprintf(("PMFRAME:WM_QUERYFOCUSCHAIN %x fsCmd %x parent %x returned %x", win32wnd->getWindowHandle(), SHORT1FROMMP(mp1), mp2, rc)); 1027 // break; 1028 goto RunDefFrameWndProc; 1029 #endif 1030 1031 #if 0 1032 //is sent to both windows gaining and loosing the focus 1033 case WM_FOCUSCHANGE: 1034 { 1035 HWND hwndFocus = (HWND)mp1; 1036 HWND hwndLoseFocus, hwndGainFocus; 1037 USHORT usSetFocus = SHORT1FROMMP(mp2); 1038 USHORT fsFocusChange = SHORT2FROMMP(mp2); 1039 1040 rc = 0; 1041 dprintf(("PMFRAME:WM_FOCUSCHANGE (start) %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange)); 1042 if(usSetFocus) { 1043 hwndGainFocus = hwnd; 1044 hwndLoseFocus = hwndFocus; 1045 } 1046 else { 1047 hwndGainFocus = hwndFocus; 1048 hwndLoseFocus = hwnd; 1049 } 1050 1051 if(usSetFocus) 1052 { 1053 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndLoseFocus); 1054 if(!(fsFocusChange & FC_NOSETACTIVE)) 1055 { 1056 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent())) 1057 { 1058 if(winfocus) 1059 WinSendMsg(winfocus->GetTopParent()->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus); 1060 else 1061 WinSendMsg(hwndLoseFocus, WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus); 1062 } 1063 } 1064 //SvL: Check if window is still valid 1065 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 1066 if(win32wnd == NULL) 1067 return (MRESULT)rc; 1068 1069 if(!(fsFocusChange & FC_NOSETACTIVE)) 1070 { 1071 Win32BaseWindow *topparent = win32wnd->GetTopParent(); 1072 if(!winfocus || (winfocus->GetTopParent() != topparent)) 1073 { 1074 if(!(fsFocusChange & FC_NOBRINGTOTOP)) 1075 { 1076 if(topparent) { 1077 //put window at the top of z order 1078 WinSetWindowPos(topparent->getOS2WindowHandle(), HWND_TOP, 0, 0, 0, 0, SWP_ZORDER); 1079 } 1080 } 1081 1082 // PH 2000/09/01 Netscape 4.7 1083 // check if topparent is valid 1084 if (topparent) 1085 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus); 1086 } 1087 } 1088 //SvL: Check if window is still valid 1089 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 1090 if(win32wnd == NULL) 1091 return (MRESULT)rc; 1092 1093 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection 1094 if(!(fsFocusChange & FC_NOSETSELECTION)) { 1095 WinSendMsg(hwndGainFocus, WM_SETSELECTION, (MPARAM)1, (MPARAM)0); 1096 } 1097 1098 if(!(fsFocusChange & FC_NOSETFOCUS)) { 1099 WinSendMsg(hwndGainFocus, WM_SETFOCUS, (MPARAM)hwndLoseFocus, (MPARAM)1); 1100 } 1101 } 1102 else /* no usSetFocus */ 1103 { 1104 if(!(fsFocusChange & FC_NOLOSEFOCUS)) { 1105 WinSendMsg(hwndLoseFocus, WM_SETFOCUS, (MPARAM)hwndGainFocus, (MPARAM)0); 1106 } 1107 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection 1108 if(!(fsFocusChange & FC_NOLOSESELECTION)) { 1109 WinSendMsg(hwndLoseFocus, WM_SETSELECTION, (MPARAM)0, (MPARAM)0); 1110 } 1111 //SvL: Check if window is still valid 1112 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 1113 if(win32wnd == NULL) { 1114 return (MRESULT)rc; 1115 } 1116 1117 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndGainFocus); 1118 if(!(fsFocusChange & FC_NOLOSEACTIVE)) 1119 { 1120 Win32BaseWindow *topparent = win32wnd->GetTopParent(); 1121 1122 if(!winfocus || (winfocus->GetTopParent() != topparent)) 1123 { 1124 // PH 2000/09/01 Netscape 4.7 1125 // check if topparent is valid 1126 if (topparent) 1127 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus); 1128 } 1129 } 1130 //SvL: Check if window is still valid 1131 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 1132 if(win32wnd == NULL) 1133 return (MRESULT)rc; 1134 1135 if(!(fsFocusChange & FC_NOSETACTIVE)) 1136 { 1137 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent())) 1138 { 1139 if(winfocus) 1140 { 1141 // PH 2000/09/01 Netscape 4.7 1142 // check if topparent is valid 1143 Win32BaseWindow *topparent = winfocus->GetTopParent(); 1144 if (topparent) 1145 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus); 1146 } 1147 else 1148 WinSendMsg(hwndGainFocus, WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus); 1149 } 1150 } 1151 } 1152 1153 1154 #ifdef DEBUG 1155 dprintf(("PMFRAME:WM_FOCUSCHANGE (end) %x %x %x", win32wnd->getWindowHandle(), mp1, mp2)); 1156 #endif 1157 return (MRESULT)rc; 1158 } 1159 #endif 1160 1161 #ifdef DEBUG 1262 1162 case WM_FOCUSCHANGE: 1263 1163 { … … 1267 1167 USHORT fsFocusChange = SHORT2FROMMP(mp2); 1268 1168 1269 dprintf((" OS2:WM_FOCUSCHANGE %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange));1169 dprintf(("PMFRAME:WM_FOCUSCHANGE %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange)); 1270 1170 goto RunDefFrameWndProc; 1271 1171 } 1172 #endif 1272 1173 1273 1174 case WM_ACTIVATE: 1175 { 1176 HWND hwndTitle; 1177 USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS); 1178 1179 dprintf(("PMFRAME: WM_ACTIVATE %x %x %x", hwnd, mp1, mp2)); 1180 if (win32wnd->IsWindowCreated()) 1181 { 1182 WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),WM_ACTIVATE,mp1,mp2); 1183 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 1184 1185 //CB: show owner behind the dialog 1186 if (win32wnd->IsModalDialog()) 1187 { 1188 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 1189 1190 if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 1191 } 1192 } 1193 else 1194 { 1195 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 1196 } 1197 RestoreOS2TIB(); 1198 return 0; 1199 } 1200 1201 case WM_ENABLE: 1202 dprintf(("OS2: WM_ENABLE %x", hwnd)); 1203 win32wnd->MsgEnable(SHORT1FROMMP(mp1)); 1204 break; 1205 1206 case WM_SHOW: 1207 dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1)); 1208 //show client window 1209 WinShowWindow(win32wnd->getOS2WindowHandle(), (BOOL)mp1); 1210 win32wnd->MsgShow((ULONG)mp1); 1211 break; 1212 1274 1213 case WM_SETFOCUS: 1275 1214 { 1276 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE);1277 1215 goto RunDefFrameWndProc; 1278 1216 } 1279 1217 1280 #if 0 1281 //just a test 1282 case WM_ADJUSTWINDOWPOS: 1283 case WM_WINDOWPOSCHANGED: 1284 { 1285 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1218 case WM_QUERYTRACKINFO: 1219 { 1220 PTRACKINFO trackInfo = (PTRACKINFO)mp2; 1221 1222 dprintf(("PMFRAME:WM_QUERYTRACKINFO %x", win32wnd->getWindowHandle())); 1223 trackInfo->cxBorder = 4; 1224 trackInfo->cyBorder = 4; 1225 win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize); 1226 return (MRESULT)TRUE; 1227 } 1228 1229 case WM_QUERYBORDERSIZE: 1230 { 1231 PWPOINT size = (PWPOINT)mp1; 1232 1233 dprintf(("PMFRAME:WM_QUERYBORDERSIZE %x", win32wnd->getWindowHandle())); 1234 1235 size->x = 0; 1236 size->y = 0; 1237 return (MRESULT)TRUE; 1238 } 1239 1240 case WM_QUERYFRAMEINFO: 1241 dprintf(("PMFRAME:WM_QUERYFRAMEINFO %x", win32wnd->getWindowHandle())); 1286 1242 goto RunDefFrameWndProc; 1287 } 1288 #endif 1289 1290 case WM_QUERYFRAMEINFO: 1291 dprintf(("OS2: WM_QUERYFRAMEINFO %x", win32wnd->getWindowHandle())); 1243 1244 case WM_FORMATFRAME: 1245 dprintf(("PMFRAME:WM_FORMATFRAME %x", win32wnd->getWindowHandle())); 1246 break; 1247 1248 case WM_ADJUSTFRAMEPOS: 1249 { 1250 PSWP pswp = (PSWP)mp1; 1251 1252 dprintf(("PMFRAME:WM_ADJUSTFRAMEPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 1292 1253 goto RunDefFrameWndProc; 1293 1294 case WM_FORMATFRAME: 1295 dprintf(("OS2: WM_FORMATFRAME %x", win32wnd->getWindowHandle())); 1254 } 1255 1256 case WM_OWNERPOSCHANGE: 1257 { 1258 PSWP pswp = (PSWP)mp1; 1259 1260 dprintf(("PMFRAME:WM_OWNERPOSCHANGE %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 1296 1261 goto RunDefFrameWndProc; 1297 1298 case WM_ADJUSTFRAMEPOS:1299 {1300 PSWP pswp = (PSWP)mp1;1301 1302 dprintf(("OS2: WM_ADJUSTFRAMEPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));1303 goto RunDefFrameWndProc;1304 }1305 1306 case WM_OWNERPOSCHANGE:1307 {1308 PSWP pswp = (PSWP)mp1;1309 1310 dprintf(("OS2: WM_OWNERPOSCHANGE %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));1311 goto RunDefFrameWndProc;1312 1262 } 1313 1263 … … 1318 1268 if (!win32wnd->IsWindowCreated()) goto RunDefWndProc; 1319 1269 1320 dprintf((" OS2:WM_MINMAXFRAME %x",hwnd));1270 dprintf(("PMFRAME:WM_MINMAXFRAME %x",hwnd)); 1321 1271 if ((swp->fl & SWP_MAXIMIZE) == SWP_MAXIMIZE) 1322 1272 { … … 1346 1296 1347 1297 case WM_UPDATEFRAME: 1348 dprintf((" OS2:WM_UPDATEFRAME %x", win32wnd->getWindowHandle()));1298 dprintf(("PMFRAME:WM_UPDATEFRAME %x", win32wnd->getWindowHandle())); 1349 1299 goto RunDefFrameWndProc; 1350 1300 1351 1301 default: 1352 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1353 break; 1302 goto RunDefFrameWndProc; 1354 1303 } 1355 1304 RestoreOS2TIB(); … … 1362 1311 RunDefWndProc: 1363 1312 RestoreOS2TIB(); 1364 return Win 32WindowProc(hwnd, msg, mp1, mp2);1313 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 1365 1314 } 1366 1315 //****************************************************************************** … … 1373 1322 PRECT pWindowRect, pClientRect; 1374 1323 HWND hwndTracking; 1375 HPS hpsTrack;1376 1324 LONG parentHeight, parentWidth; 1377 LONG clientOrgX, clientOrgY;1378 1325 1379 1326 dprintf(("FrameTrackFrame: %x %x", win32wnd->getWindowHandle(), flags)); … … 1387 1334 pWindowRect = win32wnd->getWindowRect(); 1388 1335 if(win32wnd->getParent()) { 1389 parentHeight = win32wnd->getParent()->get WindowHeight();1390 parentWidth = win32wnd->getParent()->get WindowWidth();1336 parentHeight = win32wnd->getParent()->getClientHeight(); 1337 parentWidth = win32wnd->getParent()->getClientWidth(); 1391 1338 hwndTracking = win32wnd->getParent()->getOS2WindowHandle(); 1392 hpsTrack = WinGetPS(hwndTracking);1393 clientOrgX = win32wnd->getParent()->getClientRectPtr()->left;1394 clientOrgY = win32wnd->getParent()->getClientRectPtr()->top;1395 1339 } 1396 1340 else { … … 1398 1342 parentWidth = OSLibQueryScreenWidth(); 1399 1343 hwndTracking = HWND_DESKTOP; 1400 hpsTrack = NULL;1401 clientOrgX = 0;1402 clientOrgY = 0;1403 1344 } 1404 1345 1405 1346 mapWin32ToOS2Rect(parentHeight, pWindowRect, (PRECTLOS2)&track.rclTrack); 1406 track.rclTrack.xLeft += clientOrgX;1407 track.rclTrack.yTop -= clientOrgY;1408 1347 rcl = track.rclTrack; 1409 1348 WinQueryWindowRect(hwndTracking, &track.rclBoundary); … … 1420 1359 if(WinTrackRect(hwndTracking, NULL, &track) ) 1421 1360 { 1422 if(hpsTrack) WinReleasePS(hpsTrack);1423 1424 1361 /* if successful copy final position back */ 1425 1362 if(!WinEqualRect(0, &rcl, &track.rclTrack)) { 1426 1363 dprintf(("FrameTrackFrame: new (os/2) window rect: (%d,%d)(%d,%d)", track.rclTrack.xLeft, track.rclTrack.yBottom, track.rclTrack.xRight - track.rclTrack.xLeft, track.rclTrack.yTop - track.rclTrack.yBottom)); 1427 1364 if(flags == TF_MOVE) { 1428 WinSetWindowPos(win32wnd->getOS2 WindowHandle(),1365 WinSetWindowPos(win32wnd->getOS2FrameWindowHandle(), 1429 1366 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 1430 1367 0, 0, SWP_MOVE); 1431 1368 } 1432 1369 else { 1433 //// SetWindowPos(win32wnd->getWindowHandle(), 0, track.rclTrack.xLeft, 1434 //// parentHeight - track.rclTrack.yTop, 1435 //// track.rclTrack.xRight - track.rclTrack.xLeft, 1436 //// track.rclTrack.yTop - track.rclTrack.yBottom, 1437 //// SWP_NOACTIVATE_W | SWP_NOZORDER_W | SWP_NOACTIVATE_W); 1438 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 1370 WinSetWindowPos(win32wnd->getOS2FrameWindowHandle(), 1439 1371 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 1440 1372 track.rclTrack.xRight - track.rclTrack.xLeft, … … 1445 1377 return; 1446 1378 } 1447 if(hpsTrack) WinReleasePS(hpsTrack);1448 1379 return; 1449 1380 }
Note:
See TracChangeset
for help on using the changeset viewer.