Changeset 4839 for trunk/src/user32/pmwindow.cpp
- Timestamp:
- Dec 24, 2000, 3:54:07 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/pmwindow.cpp
r4825 r4839 1 /* $Id: pmwindow.cpp,v 1.1 09 2000-12-17 15:04:10sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.110 2000-12-24 14:54:07 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 50 50 ULONG ScreenBitsPerPel = 0; 51 51 52 static PFNWP pfnFrameWndProc = NULL; 52 53 53 54 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 55 MRESULT EXPENTRY Win32FrameWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 56 MRESULT ProcessPMMessage(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, Win32BaseWindow *win32wnd, 57 MSG *pWinMsg, TEB *teb, BOOL isFrame); 54 58 55 59 //****************************************************************************** … … 58 62 BOOL InitPM() 59 63 { 60 61 hab = WinInitialize(0);62 dprintf(("Winitialize returned %x", hab));63 hmq = WinCreateMsgQueue(hab, 0);64 65 if(!hab || !hmq)66 {64 65 hab = WinInitialize(0); 66 dprintf(("Winitialize returned %x", hab)); 67 hmq = WinCreateMsgQueue(hab, 0); 68 69 if(!hab || !hmq) 70 { 67 71 UINT error; 68 72 //CB: only fail on real error … … 74 78 return(FALSE); 75 79 } 76 else77 { 78 if(!hab) {80 else 81 { 82 if(!hab) { 79 83 hab = WinQueryAnchorBlock(HWND_DESKTOP); 80 dprintf(("WinQueryAnchorBlock returned %x", hab)); 81 } 82 if(!hmq) { 83 hmq = HMQ_CURRENT; 84 } 85 } 86 } 87 SetThreadHAB(hab); 88 dprintf(("InitPM: hmq = %x", hmq)); 89 SetThreadMessageQueue(hmq); 90 91 BOOL rc = WinSetCp(hmq, GetDisplayCodepage()); 92 dprintf(("InitPM: WinSetCP was %sOK", rc ? "" : "not ")); 93 94 if(!WinRegisterClass( /* Register window class */ 95 hab, /* Anchor block handle */ 96 (PSZ)WIN32_STDCLASS, /* Window class name */ 97 (PFNWP)Win32WindowProc, /* Address of window procedure */ 98 CS_HITTEST, 99 NROF_WIN32WNDBYTES)) { 100 dprintf(("WinRegisterClass Win32BaseWindow failed")); 101 return(FALSE); 102 } 103 104 CLASSINFO FrameClassInfo; 105 if(!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) { 106 dprintf (("WinQueryClassInfo WC_FRAME failed")); 107 return (FALSE); 108 } 109 dprintf(("WC_FRAME style %x", FrameClassInfo.flClassStyle)); 110 111 if(!WinRegisterClass( /* Register window class */ 112 hab, /* Anchor block handle */ 113 (PSZ)WIN32_STDFRAMECLASS, /* Window class name */ 114 (PFNWP)Win32WindowProc, /* Address of window procedure */ 115 CS_HITTEST | CS_FRAME, 116 FrameClassInfo.cbWindowData+NROF_WIN32WNDBYTES)) { 84 dprintf(("WinQueryAnchorBlock returned %x", hab)); 85 } 86 if(!hmq) { 87 hmq = HMQ_CURRENT; 88 } 89 } 90 } 91 SetThreadHAB(hab); 92 dprintf(("InitPM: hmq = %x", hmq)); 93 SetThreadMessageQueue(hmq); 94 95 BOOL rc = WinSetCp(hmq, GetDisplayCodepage()); 96 dprintf(("InitPM: WinSetCP was %sOK", rc ? "" : "not ")); 97 98 if(!WinRegisterClass( /* Register window class */ 99 hab, /* Anchor block handle */ 100 (PSZ)WIN32_STDCLASS, /* Window class name */ 101 (PFNWP)Win32WindowProc, /* Address of window procedure */ 102 CS_HITTEST, 103 NROF_WIN32WNDBYTES)) 104 { 105 dprintf(("WinRegisterClass Win32BaseWindow failed")); 106 return(FALSE); 107 } 108 109 CLASSINFO FrameClassInfo; 110 if(!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) { 111 dprintf (("WinQueryClassInfo WC_FRAME failed")); 112 return (FALSE); 113 } 114 pfnFrameWndProc = FrameClassInfo.pfnWindowProc; 115 116 dprintf(("WC_FRAME style %x", FrameClassInfo.flClassStyle)); 117 118 if(!WinRegisterClass( /* Register window class */ 119 hab, /* Anchor block handle */ 120 (PSZ)WIN32_STDFRAMECLASS, /* Window class name */ 121 (PFNWP)Win32FrameWindowProc, /* Address of window procedure */ 122 CS_HITTEST | CS_FRAME, 123 FrameClassInfo.cbWindowData+NROF_WIN32WNDBYTES)) 124 { 117 125 dprintf(("WinRegisterClass Win32BaseWindow failed %x", WinGetLastError(hab))); 118 126 return(FALSE); 119 }120 121 WinQueryWindowRect(HWND_DESKTOP, &desktopRectl);122 ScreenWidth = desktopRectl.xRight;123 ScreenHeight = desktopRectl.yTop;124 125 HDC hdc; /* Device-context handle */126 /* context data structure */127 DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL,128 NULL, NULL, NULL};129 130 /* create memory device context */131 hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);132 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel);133 DevCloseDC(hdc);134 135 dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight));136 return TRUE;127 } 128 129 WinQueryWindowRect(HWND_DESKTOP, &desktopRectl); 130 ScreenWidth = desktopRectl.xRight; 131 ScreenHeight = desktopRectl.yTop; 132 133 HDC hdc; /* Device-context handle */ 134 /* context data structure */ 135 DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, 136 NULL, NULL, NULL}; 137 138 /* create memory device context */ 139 hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); 140 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel); 141 DevCloseDC(hdc); 142 143 dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight)); 144 return TRUE; 137 145 } /* End of main */ 138 146 //****************************************************************************** … … 141 149 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 142 150 { 143 POSTMSG_PACKET *postmsg;144 OSLIBPOINT point, ClientPoint;145 151 Win32BaseWindow *win32wnd; 146 152 TEB *teb; 147 APIRET rc = 0;148 153 MSG winMsg, *pWinMsg; 149 150 //Restore our FS selector 151 SetWin32TIB(); 152 153 teb = GetThreadTEB(); 154 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 155 156 if(!teb || (msg != WM_CREATE && win32wnd == NULL)) { 154 MRESULT rc = 0; 155 156 //Restore our FS selector 157 SetWin32TIB(); 158 159 //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- BEGIN 160 teb = GetThreadTEB(); 161 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 162 163 if(!teb || (msg != WM_CREATE && win32wnd == NULL)) { 157 164 dprintf(("Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 158 165 goto RunDefWndProc; 159 }160 161 if((teb->o.odin.msgstate & 1) == 0)162 {//message that was sent directly to our window proc handler; translate it here166 } 167 168 if((teb->o.odin.msgstate & 1) == 0) 169 {//message that was sent directly to our window proc handler; translate it here 163 170 QMSG qmsg; 164 171 … … 176 183 } 177 184 pWinMsg = &winMsg; 178 }179 else {185 } 186 else { 180 187 pWinMsg = &teb->o.odin.msg; 181 188 teb->o.odin.msgstate++; 182 } 189 } 190 //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END 191 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, FALSE); 192 RestoreOS2TIB(); 193 return rc; 194 195 RunDefWndProc: 196 RestoreOS2TIB(); 197 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 198 } 199 //****************************************************************************** 200 //****************************************************************************** 201 MRESULT ProcessPMMessage(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, Win32BaseWindow *win32wnd, MSG *pWinMsg, TEB *teb, BOOL isFrame) 202 { 203 POSTMSG_PACKET *postmsg; 204 OSLIBPOINT point, ClientPoint; 205 MRESULT rc = 0; 183 206 184 207 if(msg == WIN32APP_POSTMSG) { … … 192 215 } 193 216 } 217 194 218 switch( msg ) 195 219 { … … 206 230 if(win32wnd->MsgCreate(hwnd) == FALSE) 207 231 { 208 RestoreOS2TIB();209 232 return (MRESULT)TRUE; //discontinue window creation 210 233 } 211 234 createfail: 212 RestoreOS2TIB();213 235 return (MRESULT)FALSE; 214 236 } … … 228 250 win32wnd->MsgDestroy(); 229 251 WinSetVisibleRegionNotify(hwnd, FALSE); 230 252 goto RunDefWndProc; 231 253 232 254 case WM_ENABLE: … … 248 270 249 271 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)); 250 272 251 273 if(pswp->fl & SWP_NOADJUST) { 252 253 254 274 //ignore weird messages (TODO: why are they sent?) 275 break; 276 } 255 277 //CB: show dialog in front of owner 256 278 if (win32wnd->IsModalDialogOwner()) 257 279 { 258 pswp->fl |= SWP_ZORDER;259 pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog();260 if (pswp->fl & SWP_ACTIVATE)261 {262 pswp->fl &= ~SWP_ACTIVATE;263 WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE);264 }280 pswp->fl |= SWP_ZORDER; 281 pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog(); 282 if (pswp->fl & SWP_ACTIVATE) 283 { 284 pswp->fl &= ~SWP_ACTIVATE; 285 WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE); 286 } 265 287 } 266 288 … … 282 304 hwndAfter = pswp->hwndInsertBehind; 283 305 if(win32wnd->getParent()) { 284 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(),285 286 287 288 } 289 else 306 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 307 win32wnd->getParent()->getClientRectPtr()->left, 308 win32wnd->getParent()->getClientRectPtr()->top, 309 hwnd); 310 } 311 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 290 312 291 313 wp.hwnd = win32wnd->getWindowHandle(); … … 305 327 (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags)) 306 328 { 307 dprintf(("OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct"));308 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));309 310 if(win32wnd->getParent()) {311 312 313 329 dprintf(("OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct")); 330 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 331 332 if(win32wnd->getParent()) { 333 OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, win32wnd->getParent()->getWindowHeight(), 334 win32wnd->getParent()->getClientRectPtr()->left, 335 win32wnd->getParent()->getClientRectPtr()->top, 314 336 hwnd); 315 } 316 else OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 317 318 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 319 pswp->fl |= SWP_NOADJUST; 320 pswp->hwndInsertBehind = hwndAfter; 321 pswp->hwnd = hwnd; 322 323 RestoreOS2TIB(); 324 return (MRESULT)0xf; 325 } 326 RestoreOS2TIB(); 337 } 338 else OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 339 340 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 341 pswp->fl |= SWP_NOADJUST; 342 pswp->hwndInsertBehind = hwndAfter; 343 pswp->hwnd = hwnd; 344 345 return (MRESULT)0xf; 346 } 327 347 return (MRESULT)0; 328 348 } … … 340 360 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 341 361 { 342 if(pswp->fl & SWP_ACTIVATE) 343 { 344 if(!(WinQueryWindowUShort(hwnd,QWS_FLAGS) & FF_ACTIVE)) { 345 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 346 } 347 } 348 goto RunDefWndProc; 349 } 350 351 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 352 if(win32wnd->isChild()) { 362 if(pswp->fl & SWP_ACTIVATE) 363 { 364 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 365 if(!(WinQueryWindowUShort(hwnd,QWS_FLAGS) & FF_ACTIVE)) 366 { 367 if(isFrame) { 368 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 369 } 370 else 371 if(win32wnd->IsWindowCreated()) { 372 win32wnd->MsgActivate(1, 0, win32wnd->getWindowHandle(), hwnd); 373 } 374 } 375 } 376 goto RunDefWndProc; 377 } 378 379 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) 380 { 381 if(win32wnd->isChild()) 382 { 353 383 if(win32wnd->getParent()) { 354 384 hParent = win32wnd->getParent()->getOS2WindowHandle(); … … 360 390 361 391 if(win32wnd->getParent()) { 362 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(),392 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 363 393 win32wnd->getParent()->getClientRectPtr()->left, 364 394 win32wnd->getParent()->getClientRectPtr()->top, 365 395 hwnd); 366 } 396 } 367 397 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 368 398 … … 454 484 if(pswp->fl & SWP_ACTIVATE) 455 485 { 456 if(!(WinQueryWindowUShort(hwnd,QWS_FLAGS) & FF_ACTIVE)) { 457 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 458 } 486 //Only send PM WM_ACTIVATE to top-level windows (frame windows) 487 if(!(WinQueryWindowUShort(hwnd,QWS_FLAGS) & FF_ACTIVE)) 488 { 489 if(isFrame) { 490 WinSendMsg(hwnd, WM_ACTIVATE, (MPARAM)TRUE, (MPARAM)hwnd); 491 } 492 else 493 if(win32wnd->IsWindowCreated()) { 494 win32wnd->MsgActivate(1, 0, win32wnd->getWindowHandle(), hwnd); 495 } 496 } 459 497 } 460 498 461 499 PosChangedEnd: 462 RestoreOS2TIB();463 500 return (MRESULT)FALSE; 464 501 } … … 471 508 472 509 WinSetWindowUShort(hwnd,QWS_FLAGS, SHORT1FROMMP(mp1) ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 473 if(win32wnd->IsWindowCreated()) 474 { 475 win32wnd->MsgActivate((LOWORD(pWinMsg->wParam) == WA_ACTIVE_W) ? 1 : 0, HIWORD(pWinMsg->wParam), pWinMsg->lParam, (HWND)mp2); 476 477 //CB: show owner behind the dialog 478 if(win32wnd->IsModalDialog()) 479 { 480 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 481 482 if(topOwner) WinSetWindowPos(topOwner->getOS2WindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 483 } 484 } 485 RestoreOS2TIB(); 510 if(win32wnd->IsWindowCreated()) 511 { 512 win32wnd->MsgActivate((LOWORD(pWinMsg->wParam) == WA_ACTIVE_W) ? 1 : 0, HIWORD(pWinMsg->wParam), pWinMsg->lParam, (HWND)mp2); 513 514 //CB: show owner behind the dialog 515 if(win32wnd->IsModalDialog()) 516 { 517 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 518 519 if(topOwner) WinSetWindowPos(topOwner->getOS2WindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 520 } 521 } 486 522 return 0; 487 523 } … … 491 527 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp2))); 492 528 goto RunDefWndProc; 493 }494 495 case WM_MINMAXFRAME:496 {497 PSWP swp = (PSWP)mp1;498 499 if (!win32wnd->IsWindowCreated()) goto RunDefWndProc;500 501 dprintf(("OS2: WM_MINMAXFRAME %x",hwnd));502 if ((swp->fl & SWP_MAXIMIZE) == SWP_MAXIMIZE)503 {504 win32wnd->setStyle((win32wnd->getStyle() & ~WS_MINIMIZE_W) | WS_MAXIMIZE_W);505 506 RECT rect;507 508 rect.left = rect.top = rect.right = rect.bottom = 0;509 win32wnd->AdjustMaximizedRect(&rect);510 swp->x += rect.left;511 swp->cx += rect.right-rect.left;512 swp->y -= rect.bottom;513 swp->cy += rect.bottom-rect.top;514 }515 else if ((swp->fl & SWP_MINIMIZE) == SWP_MINIMIZE)516 {517 win32wnd->setStyle((win32wnd->getStyle() & ~WS_MAXIMIZE_W) | WS_MINIMIZE_W);518 }519 else if ((swp->fl & SWP_RESTORE) == SWP_RESTORE)520 {521 win32wnd->setStyle(win32wnd->getStyle() & ~(WS_MINIMIZE_W | WS_MAXIMIZE_W));522 }523 goto RunDefWndProc;524 529 } 525 530 … … 536 541 537 542 if ((dwStyle & CS_HREDRAW_W) && (newRect->xRight-newRect->xLeft != oldRect->xRight-oldRect->xLeft)) 538 res |= CVR_REDRAW; 539 else if ((dwStyle & CS_VREDRAW_W) && (newRect->yTop-newRect->yBottom != oldRect->yTop-oldRect->yBottom)) 540 res |= CVR_REDRAW; 541 } else res |= CVR_REDRAW; 542 543 RestoreOS2TIB(); 543 res |= CVR_REDRAW; 544 else 545 if ((dwStyle & CS_VREDRAW_W) && (newRect->yTop-newRect->yBottom != oldRect->yTop-oldRect->yBottom)) 546 res |= CVR_REDRAW; 547 } 548 else res |= CVR_REDRAW; 549 544 550 return (MRESULT)res; 545 551 } 546 552 #else 547 553 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 548 RestoreOS2TIB();549 554 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 550 555 #endif 551 556 552 557 case WM_VRNENABLED: 553 dprintf(("OS2: WM_VRNENABLED %x", win32wnd->getWindowHandle()));558 dprintf(("OS2: WM_VRNENABLED %x %x %x", win32wnd->getWindowHandle(), mp1, mp2)); 554 559 if(!win32wnd->isComingToTop() && ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == WS_EX_TOPMOST_W)) 555 560 { … … 576 581 HWND hwndFocus = (HWND)mp1; 577 582 578 dprintf(("OS2: WM_SETFOCUS %x %x %d", win32wnd->getWindowHandle(), mp1, mp2));583 dprintf(("OS2: WM_SETFOCUS %x %x (%x) %d", win32wnd->getWindowHandle(), mp1, Win32BaseWindow::OS2ToWin32Handle(hwndFocus), mp2)); 579 584 if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { 580 585 //another (non-win32) application's window … … 591 596 } 592 597 598 #if 0 593 599 //is sent to both windows gaining and loosing the focus 594 600 case WM_FOCUSCHANGE: … … 601 607 rc = 0; 602 608 dprintf(("OS2: WM_FOCUSCHANGE (start) %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange)); 603 RestoreOS2TIB(); 604 if(usSetFocus) { 605 hwndGainFocus = hwnd; 606 hwndLoseFocus = hwndFocus; 607 } 608 else { 609 hwndGainFocus = hwndFocus; 610 hwndLoseFocus = hwnd; 611 } 612 609 if(usSetFocus) { 610 hwndGainFocus = hwnd; 611 hwndLoseFocus = hwndFocus; 612 } 613 else { 614 hwndGainFocus = hwndFocus; 615 hwndLoseFocus = hwnd; 616 } 617 613 618 if(usSetFocus) 614 619 { … … 616 621 if(!(fsFocusChange & FC_NOSETACTIVE)) 617 622 { 618 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent())) 623 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent())) 619 624 { 620 625 if(winfocus) 621 626 WinSendMsg(winfocus->GetTopParent()->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus); 622 else 627 else 623 628 WinSendMsg(hwndLoseFocus, WM_ACTIVATE, (MPARAM)0, (MPARAM)hwndGainFocus); 624 629 } … … 641 646 } 642 647 } 643 648 644 649 // PH 2000/09/01 Netscape 4.7 645 650 // check if topparent is valid … … 653 658 return (MRESULT)rc; 654 659 655 656 657 658 659 660 661 662 660 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection 661 if(!(fsFocusChange & FC_NOSETSELECTION)) { 662 WinSendMsg(hwndGainFocus, WM_SETSELECTION, (MPARAM)1, (MPARAM)0); 663 } 664 665 if(!(fsFocusChange & FC_NOSETFOCUS)) { 666 WinSendMsg(hwndGainFocus, WM_SETFOCUS, (MPARAM)hwndLoseFocus, (MPARAM)1); 667 } 663 668 } 664 669 else /* no usSetFocus */ 665 670 { 666 667 668 669 670 671 672 671 if(!(fsFocusChange & FC_NOLOSEFOCUS)) { 672 WinSendMsg(hwndLoseFocus, WM_SETFOCUS, (MPARAM)hwndGainFocus, (MPARAM)0); 673 } 674 //TODO: Don't send WM_SETSELECTION to child window if frame already has selection 675 if(!(fsFocusChange & FC_NOLOSESELECTION)) { 676 WinSendMsg(hwndLoseFocus, WM_SETSELECTION, (MPARAM)0, (MPARAM)0); 677 } 673 678 //SvL: Check if window is still valid 674 679 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 675 680 if(win32wnd == NULL) { 676 681 return (MRESULT)rc; 677 } 682 } 678 683 679 684 Win32BaseWindow *winfocus = Win32BaseWindow::GetWindowFromOS2Handle(hwndGainFocus); 680 if(!(fsFocusChange & FC_NOLOSEACTIVE)) 685 if(!(fsFocusChange & FC_NOLOSEACTIVE)) 681 686 { 682 687 Win32BaseWindow *topparent = win32wnd->GetTopParent(); 683 688 684 689 if(!winfocus || (winfocus->GetTopParent() != topparent)) 685 690 { … … 694 699 if(win32wnd == NULL) 695 700 return (MRESULT)rc; 696 697 if(!(fsFocusChange & FC_NOSETACTIVE)) 701 702 if(!(fsFocusChange & FC_NOSETACTIVE)) 698 703 { 699 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent())) 704 if(!winfocus || (winfocus->GetTopParent() != win32wnd->GetTopParent())) 700 705 { 701 706 if(winfocus) … … 707 712 WinSendMsg(topparent->getOS2WindowHandle(), WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus); 708 713 } 709 else 714 else 710 715 WinSendMsg(hwndGainFocus, WM_ACTIVATE, (MPARAM)1, (MPARAM)hwndLoseFocus); 711 716 } 712 717 } 713 718 } 714 715 719 720 716 721 #ifdef DEBUG 717 722 SetWin32TIB(); 718 723 dprintf(("OS2: WM_FOCUSCHANGE (end) %x %x %x", win32wnd->getWindowHandle(), mp1, mp2)); 719 RestoreOS2TIB();720 724 #endif 721 725 return (MRESULT)rc; 722 726 } 727 #endif 723 728 724 729 //************************************************************************** … … 728 733 { 729 734 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 730 735 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 731 736 } 732 737 if(win32wnd && win32wnd->IsWindowCreated()) 733 738 { 734 MRESULT rc; 735 736 rc = (MRESULT)win32wnd->MsgHitTest(pWinMsg); 737 RestoreOS2TIB(); 738 return rc; 739 MRESULT rc; 740 741 rc = (MRESULT)win32wnd->MsgHitTest(pWinMsg); 742 return rc; 739 743 } 740 744 return (MRESULT)HT_NORMAL; … … 750 754 case WM_BUTTON3UP: 751 755 case WM_BUTTON3DBLCLK: 752 753 754 756 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 757 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 758 } 755 759 if(win32wnd) 756 win32wnd->MsgButton(pWinMsg); 757 rc = TRUE; 760 win32wnd->MsgButton(pWinMsg); 761 762 rc = (MRESULT)TRUE; 758 763 break; 759 764 … … 767 772 case WM_BUTTON3MOTIONEND: 768 773 case WM_BUTTON3CLICK: 769 rc = TRUE;774 rc = (MRESULT)TRUE; 770 775 break; 771 776 772 777 case WM_MOUSEMOVE: 773 778 { 774 775 776 779 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 780 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 781 } 777 782 if(win32wnd) 778 783 win32wnd->MsgMouseMove(pWinMsg); 779 784 break; 780 785 } … … 808 813 case WM_SETWINDOWPARAMS: 809 814 { 810 WNDPARAMS *wndParams = (WNDPARAMS *)mp1;815 WNDPARAMS *wndParams = (WNDPARAMS *)mp1; 811 816 812 817 dprintf(("OS2: WM_SETWINDOWPARAMS %x", hwnd)); … … 833 838 wndpars->cbCtlData = 0; 834 839 wndpars->cbPresParams = 0; 835 RestoreOS2TIB();836 840 return (MRESULT)TRUE; 837 841 } … … 844 848 BOOL rc; 845 849 846 850 rc = WinQueryUpdateRect(hwnd, &rectl); 847 851 dprintf(("OS2: WM_PAINT %x (%d,%d) (%d,%d) rc=%d", win32wnd->getWindowHandle(), rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop, rc)); 848 852 849 853 if(rc && win32wnd->IsWindowCreated() && (rectl.xLeft != rectl.xRight && 850 rectl.yBottom != rectl.yTop)) 851 852 853 854 855 856 win32wnd->getClientHeight() == win32wnd->getWindowHeight() &&857 858 859 860 861 862 } 863 elsegoto RunDefWndProc;864 865 854 rectl.yBottom != rectl.yTop)) 855 { 856 PRECT pClient = win32wnd->getClientRectPtr(); 857 PRECT pWindow = win32wnd->getWindowRect(); 858 859 if(!(pClient->left == 0 && pClient->top == 0 && 860 win32wnd->getClientHeight() == win32wnd->getWindowHeight() && 861 win32wnd->getClientWidth() == win32wnd->getWindowWidth())) 862 { 863 win32wnd->MsgNCPaint(); 864 } 865 win32wnd->DispatchMsgA(pWinMsg); 866 } 867 else goto RunDefWndProc; 868 869 //SvL: Not calling the default window procedure causes all sorts of 866 870 // strange problems (redraw & hanging app) 867 871 // -> check what WinBeginPaint does what we're forgetting in BeginPaint 868 // 872 // WinQueryUpdateRect(hwnd, &rectl); 869 873 // if(rectl.xLeft == 0 && rectl.yTop == 0 && rectl.xRight == 0 && rectl.yBottom == 0) { 870 // 871 // 872 // 873 // 874 // 874 // RestoreOS2TIB(); 875 // return (MRESULT)FALSE; 876 // } 877 // dprintf(("Update rectangle (%d,%d)(%d,%d) not empty, msg %x", rectl.xLeft, rectl.yTop, rectl.xRight, rectl.yBottom, pWinMsg->message)); 878 // goto RunDefWndProc; 875 879 break; 876 880 } … … 879 883 { 880 884 dprintf(("OS2: WM_ERASEBACKGROUND %x", win32wnd->getWindowHandle())); 881 RestoreOS2TIB();882 885 return (MRESULT)FALSE; 883 886 } … … 888 891 win32wnd->DispatchMsgA(pWinMsg); 889 892 890 RestoreOS2TIB();891 893 return (MRESULT)TRUE; 892 894 } … … 898 900 899 901 dprintf(("OS2: WM_QUERYTRACKINFO %x", win32wnd->getWindowHandle())); 900 trackInfo->cxBorder = 4; 901 trackInfo->cyBorder = 4; 902 win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize); 903 RestoreOS2TIB(); 904 return (MRESULT)TRUE; 902 trackInfo->cxBorder = 4; 903 trackInfo->cyBorder = 4; 904 win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize); 905 return (MRESULT)TRUE; 905 906 } 906 907 … … 913 914 size->x = 0; 914 915 size->y = 0; 915 RestoreOS2TIB();916 916 return (MRESULT)TRUE; 917 917 } … … 927 927 dprintf(("OS2: WM_OWNERPOSCHANGE")); 928 928 goto RunDefWndProc; 929 }930 931 case WM_FORMATFRAME:932 dprintf(("OS2: WM_FORMATFRAME %x", win32wnd->getWindowHandle()));933 // goto RunDefWndProc;934 break;935 936 case WM_ADJUSTFRAMEPOS:937 {938 PSWP pswp = (PSWP)mp1;939 940 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));941 break;942 }943 944 case WM_QUERYFRAMEINFO:945 dprintf(("OS2: WM_QUERYFRAMEINFO %x", win32wnd->getWindowHandle()));946 return (MRESULT)(FI_FRAME|FI_ACTIVATEOK);947 948 case WM_QUERYFOCUSCHAIN:949 {950 USHORT fsCmd = SHORT1FROMMP(mp1);951 952 dprintf(("OS2: WM_QUERYFOCUSCHAIN %x %x %x", win32wnd->getWindowHandle(), mp1, mp2));953 #if 1954 goto RunDefWndProc;955 #else956 switch(fsCmd) {957 case QFC_NEXTINCHAIN:958 goto RunDefWndProc;959 case QFC_ACTIVE:960 case QFC_FRAME:961 if(win32wnd->GetTopParent()) {962 dprintf(("Frame = %x", win32wnd->GetTopParent()->getOS2WindowHandle()));963 return (MRESULT)win32wnd->GetTopParent()->getOS2WindowHandle();964 }965 break;966 case QFC_SELECTACTIVE:967 goto RunDefWndProc;968 case QFC_PARTOFCHAIN:969 goto RunDefWndProc;970 }971 break;972 #endif973 929 } 974 930 … … 998 954 case WM_SEMANTICEVENT: 999 955 default: 1000 // dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));956 dprintf2(("OS2: RunDefWndProc hwnd %x msg %x mp1 %x mp2 %x", hwnd, msg, mp1, mp2)); 1001 957 RestoreOS2TIB(); 1002 958 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 1003 959 } 1004 RestoreOS2TIB();1005 960 return (MRESULT)rc; 1006 961 … … 1010 965 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 1011 966 } /* End of Win32WindowProc */ 967 //****************************************************************************** 968 //****************************************************************************** 969 MRESULT EXPENTRY Win32FrameWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 970 { 971 POSTMSG_PACKET *postmsg; 972 OSLIBPOINT point, ClientPoint; 973 Win32BaseWindow *win32wnd; 974 TEB *teb; 975 MRESULT rc = 0; 976 MSG winMsg, *pWinMsg; 977 978 //Restore our FS selector 979 SetWin32TIB(); 980 981 //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- BEGIN 982 teb = GetThreadTEB(); 983 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 984 985 if(!teb || (msg != WM_CREATE && win32wnd == NULL)) { 986 dprintf(("Invalid win32wnd pointer for window %x msg %x", hwnd, msg)); 987 goto RunDefFrameWndProc; 988 } 989 990 if((teb->o.odin.msgstate & 1) == 0) 991 {//message that was sent directly to our window proc handler; translate it here 992 QMSG qmsg; 993 994 qmsg.msg = msg; 995 qmsg.hwnd = hwnd; 996 qmsg.mp1 = mp1; 997 qmsg.mp2 = mp2; 998 qmsg.time = WinQueryMsgTime(teb->o.odin.hab); 999 WinQueryMsgPos(teb->o.odin.hab, &qmsg.ptl); 1000 qmsg.reserved = 0; 1001 1002 if(OS2ToWinMsgTranslate((PVOID)teb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE) 1003 {//message was not translated 1004 memset(&winMsg, 0, sizeof(MSG)); 1005 } 1006 pWinMsg = &winMsg; 1007 } 1008 else { 1009 pWinMsg = &teb->o.odin.msg; 1010 teb->o.odin.msgstate++; 1011 } 1012 //NOTE-------------->>>>>> If this is changed, also change Win32WindowProc!! <<<<<<<<<<<-------------------- END 1013 1014 switch( msg ) 1015 { 1016 case WM_CREATE: 1017 { 1018 RestoreOS2TIB(); 1019 pfnFrameWndProc(hwnd, msg, mp1, mp2); 1020 SetWin32TIB(); 1021 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1022 break; 1023 } 1024 1025 case WM_CALCFRAMERECT: 1026 dprintf(("OS2: WM_CALCFRAMERECT %x", win32wnd->getWindowHandle())); 1027 rc = (MRESULT)TRUE; 1028 break; 1029 1030 case WM_QUERYCTLTYPE: 1031 // This is a frame window 1032 dprintf(("OS2: WM_QUERYCTLTYPE %x", win32wnd->getWindowHandle())); 1033 rc = (MRESULT)CCT_FRAME; 1034 break; 1035 1036 case WM_QUERYFOCUSCHAIN: 1037 dprintf(("OS2: WM_QUERYFOCUSCHAIN %x", win32wnd->getWindowHandle())); 1038 goto RunDefFrameWndProc; 1039 1040 case WM_FOCUSCHANGE: 1041 { 1042 HWND hwndFocus = (HWND)mp1; 1043 HWND hwndLoseFocus, hwndGainFocus; 1044 USHORT usSetFocus = SHORT1FROMMP(mp2); 1045 USHORT fsFocusChange = SHORT2FROMMP(mp2); 1046 1047 dprintf(("OS2: WM_FOCUSCHANGE %x %x %x %x", win32wnd->getWindowHandle(), hwndFocus, usSetFocus, fsFocusChange)); 1048 goto RunDefFrameWndProc; 1049 } 1050 1051 case WM_ACTIVATE: 1052 case WM_SETFOCUS: 1053 { 1054 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1055 goto RunDefFrameWndProc; 1056 } 1057 1058 #if 0 1059 //just a test 1060 case WM_ADJUSTWINDOWPOS: 1061 case WM_WINDOWPOSCHANGED: 1062 { 1063 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1064 goto RunDefFrameWndProc; 1065 } 1066 #endif 1067 1068 case WM_QUERYFRAMEINFO: 1069 dprintf(("OS2: WM_QUERYFRAMEINFO %x", win32wnd->getWindowHandle())); 1070 goto RunDefFrameWndProc; 1071 1072 case WM_FORMATFRAME: 1073 dprintf(("OS2: WM_FORMATFRAME %x", win32wnd->getWindowHandle())); 1074 goto RunDefFrameWndProc; 1075 1076 case WM_ADJUSTFRAMEPOS: 1077 { 1078 PSWP pswp = (PSWP)mp1; 1079 1080 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)); 1081 goto RunDefFrameWndProc; 1082 } 1083 1084 case WM_MINMAXFRAME: 1085 { 1086 PSWP swp = (PSWP)mp1; 1087 1088 if (!win32wnd->IsWindowCreated()) goto RunDefWndProc; 1089 1090 dprintf(("OS2: WM_MINMAXFRAME %x",hwnd)); 1091 if ((swp->fl & SWP_MAXIMIZE) == SWP_MAXIMIZE) 1092 { 1093 win32wnd->setStyle((win32wnd->getStyle() & ~WS_MINIMIZE_W) | WS_MAXIMIZE_W); 1094 1095 RECT rect; 1096 1097 rect.left = rect.top = rect.right = rect.bottom = 0; 1098 win32wnd->AdjustMaximizedRect(&rect); 1099 swp->x += rect.left; 1100 swp->cx += rect.right-rect.left; 1101 swp->y -= rect.bottom; 1102 swp->cy += rect.bottom-rect.top; 1103 } 1104 else 1105 if ((swp->fl & SWP_MINIMIZE) == SWP_MINIMIZE) 1106 { 1107 win32wnd->setStyle((win32wnd->getStyle() & ~WS_MAXIMIZE_W) | WS_MINIMIZE_W); 1108 } 1109 else 1110 if ((swp->fl & SWP_RESTORE) == SWP_RESTORE) 1111 { 1112 win32wnd->setStyle(win32wnd->getStyle() & ~(WS_MINIMIZE_W | WS_MAXIMIZE_W)); 1113 } 1114 goto RunDefWndProc; 1115 } 1116 1117 case WM_UPDATEFRAME: 1118 dprintf(("OS2: WM_UPDATEFRAME %x", win32wnd->getWindowHandle())); 1119 goto RunDefFrameWndProc; 1120 1121 default: 1122 rc = ProcessPMMessage(hwnd, msg, mp1, mp2, win32wnd, pWinMsg, teb, TRUE); 1123 break; 1124 } 1125 RestoreOS2TIB(); 1126 return (MRESULT)rc; 1127 1128 RunDefFrameWndProc: 1129 RestoreOS2TIB(); 1130 return pfnFrameWndProc(hwnd, msg, mp1, mp2); 1131 1132 RunDefWndProc: 1133 RestoreOS2TIB(); 1134 return Win32WindowProc(hwnd, msg, mp1, mp2); 1135 } 1012 1136 //****************************************************************************** 1013 1137 //TODO: Quickly moving a window two times doesn't force a repaint (1st time) … … 1022 1146 LONG parentHeight, parentWidth; 1023 1147 1024 dprintf(("FrameTrackFrame: %x %x", win32wnd->getWindowHandle(), flags)); 1025 track.cxBorder = 4; 1026 track.cyBorder = 4; /* 4 pel wide lines used for rectangle */ 1027 track.cxGrid = 1; 1028 track.cyGrid = 1; /* smooth tracking with mouse */ 1029 track.cxKeyboard = 8; 1030 track.cyKeyboard = 8; /* faster tracking using cursor keys */ 1031 1032 pWindowRect = win32wnd->getWindowRect(); 1033 if(win32wnd->getParent()) { 1034 parentHeight = win32wnd->getParent()->getWindowHeight(); 1035 parentWidth = win32wnd->getParent()->getWindowWidth(); 1036 hwndTracking = win32wnd->getParent()->getOS2WindowHandle(); 1037 hpsTrack = WinGetPS(hwndTracking); 1148 dprintf(("FrameTrackFrame: %x %x", win32wnd->getWindowHandle(), flags)); 1149 track.cxBorder = 4; 1150 track.cyBorder = 4; /* 4 pel wide lines used for rectangle */ 1151 track.cxGrid = 1; 1152 track.cyGrid = 1; /* smooth tracking with mouse */ 1153 track.cxKeyboard = 8; 1154 track.cyKeyboard = 8; /* faster tracking using cursor keys */ 1155 1156 pWindowRect = win32wnd->getWindowRect(); 1157 if(win32wnd->getParent()) { 1158 parentHeight = win32wnd->getParent()->getWindowHeight(); 1159 parentWidth = win32wnd->getParent()->getWindowWidth(); 1160 hwndTracking = win32wnd->getParent()->getOS2WindowHandle(); 1161 hpsTrack = WinGetPS(hwndTracking); 1162 } 1163 else { 1164 parentHeight = OSLibQueryScreenHeight(); 1165 parentWidth = OSLibQueryScreenWidth(); 1166 hwndTracking = HWND_DESKTOP; 1167 hpsTrack = NULL; 1168 } 1169 1170 mapWin32ToOS2Rect(parentHeight, pWindowRect, (PRECTLOS2)&track.rclTrack); 1171 WinQueryWindowRect(hwndTracking, &track.rclBoundary); 1172 1173 track.ptlMinTrackSize.x = 10; 1174 track.ptlMinTrackSize.y = 10; /* set smallest allowed size of rectangle */ 1175 track.ptlMaxTrackSize.x = parentWidth; 1176 track.ptlMaxTrackSize.y = parentHeight; /* set largest allowed size of rectangle */ 1177 1178 win32wnd->AdjustTrackInfo((PPOINT)&track.ptlMinTrackSize, (PPOINT)&track.ptlMaxTrackSize); 1179 1180 track.fs = flags; 1181 1182 if(WinTrackRect(hwndTracking, NULL, &track) ) 1183 { 1184 if(hpsTrack) WinReleasePS(hpsTrack); 1185 1186 /* if successful copy final position back */ 1187 if(!WinEqualRect(0, &rcl, &track.rclTrack)) { 1188 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)); 1189 if(flags == TF_MOVE) { 1190 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 1191 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 1192 0, 0, SWP_MOVE); 1193 } 1194 else { 1195 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 1196 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 1197 track.rclTrack.xRight - track.rclTrack.xLeft, 1198 track.rclTrack.yTop - track.rclTrack.yBottom, 1199 SWP_SIZE|SWP_MOVE); 1200 } 1201 } 1202 return; 1038 1203 } 1039 else { 1040 parentHeight = OSLibQueryScreenHeight(); 1041 parentWidth = OSLibQueryScreenWidth(); 1042 hwndTracking = HWND_DESKTOP; 1043 hpsTrack = NULL; 1044 } 1045 1046 mapWin32ToOS2Rect(parentHeight, pWindowRect, (PRECTLOS2)&track.rclTrack); 1047 WinQueryWindowRect(hwndTracking, &track.rclBoundary); 1048 1049 track.ptlMinTrackSize.x = 10; 1050 track.ptlMinTrackSize.y = 10; /* set smallest allowed size of rectangle */ 1051 track.ptlMaxTrackSize.x = parentWidth; 1052 track.ptlMaxTrackSize.y = parentHeight; /* set largest allowed size of rectangle */ 1053 1054 win32wnd->AdjustTrackInfo((PPOINT)&track.ptlMinTrackSize, (PPOINT)&track.ptlMaxTrackSize); 1055 1056 track.fs = flags; 1057 1058 if(WinTrackRect(hwndTracking, NULL, &track) ) 1059 { 1060 if(hpsTrack) WinReleasePS(hpsTrack); 1061 1062 /* if successful copy final position back */ 1063 if(!WinEqualRect(0, &rcl, &track.rclTrack)) { 1064 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)); 1065 if(flags == TF_MOVE) { 1066 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 1067 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 1068 0, 0, SWP_MOVE); 1069 } 1070 else { 1071 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 1072 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 1073 track.rclTrack.xRight - track.rclTrack.xLeft, 1074 track.rclTrack.yTop - track.rclTrack.yBottom, 1075 SWP_SIZE|SWP_MOVE); 1076 } 1077 } 1078 return; 1079 } 1080 if(hpsTrack) WinReleasePS(hpsTrack); 1204 if(hpsTrack) WinReleasePS(hpsTrack); 1081 1205 return; 1082 1206 }
Note:
See TracChangeset
for help on using the changeset viewer.