Changeset 3662 for trunk/src/user32/pmwindow.cpp
- Timestamp:
- Jun 7, 2000, 4:51:33 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/pmwindow.cpp
r3603 r3662 1 /* $Id: pmwindow.cpp,v 1.9 1 2000-05-24 19:30:06sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.92 2000-06-07 14:51:27 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 15 15 #define INCL_GPICONTROL /* GPI control Functions */ 16 16 #define INCL_DOSPROCESS 17 #define INCL_WINTRACKRECT 17 18 18 19 #include <os2wrap.h> … … 52 53 MRESULT EXPENTRY Win32WindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 53 54 55 PFNWP PMFrameWindowProc = 0; 56 54 57 //****************************************************************************** 55 58 //Initialize PM; create hab, message queue and register special Win32 window classes … … 57 60 BOOL InitPM() 58 61 { 59 CLASSINFO FrameClassInfo; 60 62 61 63 hab = WinInitialize(0); 62 64 dprintf(("Winitialize returned %x", hab)); … … 96 98 (PSZ)WIN32_STDCLASS, /* Window class name */ 97 99 (PFNWP)Win32WindowProc, /* Address of window procedure */ 98 #ifdef ODIN_HITTEST99 0,100 #else101 100 CS_HITTEST, 102 #endif103 101 NROF_WIN32WNDBYTES)) { 104 102 dprintf(("WinRegisterClass Win32BaseWindow failed")); 105 103 return(FALSE); 106 } 104 } 105 106 CLASSINFO FrameClassInfo; 107 if(!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) { 108 dprintf (("WinQueryClassInfo WC_FRAME failed")); 109 return (FALSE); 110 } 111 dprintf(("WC_FRAME style %x", FrameClassInfo.flClassStyle)); 112 113 PMFrameWindowProc = FrameClassInfo.pfnWindowProc; 107 114 if(!WinRegisterClass( /* Register window class */ 108 115 hab, /* Anchor block handle */ 109 (PSZ)WIN32_STD CLASS2,/* Window class name */116 (PSZ)WIN32_STDFRAMECLASS, /* Window class name */ 110 117 (PFNWP)Win32WindowProc, /* Address of window procedure */ 111 #ifdef ODIN_HITTEST 112 CS_SAVEBITS, 113 #else 114 CS_SAVEBITS | CS_HITTEST, 115 #endif 116 NROF_WIN32WNDBYTES)) { 117 dprintf(("WinRegisterClass Win32BaseWindow failed")); 118 CS_HITTEST | CS_FRAME, 119 FrameClassInfo.cbWindowData+NROF_WIN32WNDBYTES)) { 120 dprintf(("WinRegisterClass Win32BaseWindow failed %x", WinGetLastError(hab))); 118 121 return(FALSE); 119 } 120 if (!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) { 121 dprintf (("WinQueryClassInfo WC_FRAME failed")); 122 return (FALSE); 123 } 124 FrameClassInfo.flClassStyle &= ~(CS_PUBLIC | CS_CLIPSIBLINGS); 125 if (!WinRegisterClass (hab, 126 WIN32_INNERFRAME, 127 FrameClassInfo.pfnWindowProc, 128 #ifdef ODIN_HITTEST 129 FrameClassInfo.flClassStyle, 130 #else 131 FrameClassInfo.flClassStyle | CS_HITTEST, 132 #endif 133 FrameClassInfo.cbWindowData)) { 134 dprintf (("WinRegisterClass Win32InnerFrame failed")); 135 return (FALSE); 136 } 137 138 WinQueryWindowRect(HWND_DESKTOP, &desktopRectl); 139 ScreenWidth = desktopRectl.xRight; 140 ScreenHeight = desktopRectl.yTop; 141 142 143 HDC hdc; /* Device-context handle */ 144 /* context data structure */ 145 DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, 146 NULL, NULL, NULL}; 147 148 /* create memory device context */ 149 hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); 150 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel); 151 DevCloseDC(hdc); 152 153 dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight)); 154 return TRUE; 122 } 123 124 WinQueryWindowRect(HWND_DESKTOP, &desktopRectl); 125 ScreenWidth = desktopRectl.xRight; 126 ScreenHeight = desktopRectl.yTop; 127 128 HDC hdc; /* Device-context handle */ 129 /* context data structure */ 130 DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, 131 NULL, NULL, NULL}; 132 133 /* create memory device context */ 134 hdc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); 135 DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, (PLONG)&ScreenBitsPerPel); 136 DevCloseDC(hdc); 137 138 dprintf(("InitPM: Desktop (%d,%d)", ScreenWidth, ScreenHeight)); 139 return TRUE; 155 140 } /* End of main */ 156 141 //****************************************************************************** … … 223 208 win32wnd = (Win32BaseWindow *)thdb->newWindow; 224 209 thdb->newWindow = 0; 225 226 if(win32wnd->MsgCreate(WinQueryWindow(hwnd, QW_PARENT), hwnd) == FALSE) 210 if(win32wnd->MsgCreate(hwnd) == FALSE) 227 211 { 228 212 RestoreOS2TIB(); 229 213 return (MRESULT)TRUE; //discontinue window creation 230 214 } 215 RestoreOS2TIB(); 216 PMFrameWindowProc(hwnd, msg, mp1, mp2); 217 SetWin32TIB(); 231 218 createfail: 232 219 RestoreOS2TIB(); … … 247 234 dprintf(("OS2: WM_DESTROY %x", hwnd)); 248 235 win32wnd->MsgDestroy(); 249 break; 236 WinSetVisibleRegionNotify(hwnd, FALSE); 237 goto RunDefWndProc; 250 238 251 239 case WM_ENABLE: … … 261 249 case WM_ADJUSTWINDOWPOS: 262 250 { 263 PSWP pswp = (PSWP)mp1; 264 dprintf(("PMWINDOW: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 265 goto RunDefWndProc; 251 PSWP pswp = (PSWP)mp1; 252 SWP swpOld; 253 WINDOWPOS wp,wpOld; 254 HWND hParent = NULLHANDLE, hwndAfter; 255 256 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)); 257 258 //CB: show dialog in front of owner 259 if (win32wnd->IsModalDialogOwner()) 260 { 261 pswp->fl |= SWP_ZORDER; 262 pswp->hwndInsertBehind = win32wnd->getOS2HwndModalDialog(); 263 if (pswp->fl & SWP_ACTIVATE) 264 { 265 pswp->fl &= ~SWP_ACTIVATE; 266 WinSetWindowPos(win32wnd->getOS2HwndModalDialog(),0,0,0,0,0,SWP_ACTIVATE); 267 } 268 } 269 270 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 271 goto RunDefWndProc; 272 273 if(!win32wnd->CanReceiveSizeMsgs()) 274 break; 275 276 WinQueryWindowPos(hwnd, &swpOld); 277 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 278 if (win32wnd->isChild()) { 279 if(win32wnd->getParent()) { 280 hParent = win32wnd->getParent()->getOS2WindowHandle(); 281 } 282 else goto RunDefWndProc; 283 } 284 } 285 hwndAfter = pswp->hwndInsertBehind; 286 if(win32wnd->getParent()) { 287 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 288 win32wnd->getParent()->getClientRectPtr()->left, 289 win32wnd->getParent()->getClientRectPtr()->top, 290 hwnd); 291 } 292 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 293 294 wp.hwnd = win32wnd->getWindowHandle(); 295 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 296 { 297 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 298 if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle(); 299 } 300 301 wpOld = wp; 302 win32wnd->MsgPosChanging((LPARAM)&wp); 303 304 if ((wp.hwndInsertAfter != wpOld.hwndInsertAfter) || 305 (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags)) 306 { 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 OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, win32wnd->getParent()->getWindowHeight(), 312 win32wnd->getParent()->getClientRectPtr()->left, 313 win32wnd->getParent()->getClientRectPtr()->top, 314 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(); 327 return (MRESULT)0; 266 328 } 267 329 268 330 case WM_WINDOWPOSCHANGED: 269 331 { 270 if(pWinMsg->message != 0) 271 win32wnd->MsgPosChanged((LPARAM)&thdb->wp); 272 goto RunDefWndProc; 332 PSWP pswp = (PSWP)mp1,pswpOld = pswp+1; 333 SWP swpOld = *(pswp + 1); 334 WINDOWPOS wp; 335 HWND hParent = NULLHANDLE; 336 RECTL rect; 337 338 dprintf(("OS2: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 339 340 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 341 { 342 goto RunDefWndProc; 343 } 344 345 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 346 if(win32wnd->isChild()) { 347 if(win32wnd->getParent()) { 348 hParent = win32wnd->getParent()->getOS2WindowHandle(); 349 } 350 else goto PosChangedEnd; //parent has just been destroyed 351 } 352 } 353 354 355 if(win32wnd->getParent()) { 356 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 357 win32wnd->getParent()->getClientRectPtr()->left, 358 win32wnd->getParent()->getClientRectPtr()->top, 359 hwnd); 360 } 361 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 362 363 if((pswp->fl & (SWP_MOVE | SWP_SIZE)) && !(win32wnd->getStyle() & WS_MINIMIZE_W)) 364 { 365 //Note: Also updates the new window rectangle 366 win32wnd->MsgFormatFrame(&wp); 367 368 //CB: todo: use result for WM_CALCVALIDRECTS 369 mapWin32ToOS2RectFrame(win32wnd, win32wnd->getClientRectPtr(), (PRECTLOS2)&rect); 370 371 if(win32wnd->CanReceiveSizeMsgs()) 372 win32wnd->MsgPosChanged((LPARAM)&wp); 373 374 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy))) 375 { 376 //redraw the frame (to prevent unnecessary client updates) 377 BOOL redrawAll = FALSE; 378 379 if (win32wnd->getWindowClass()) 380 { 381 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 382 383 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx)) 384 redrawAll = TRUE; 385 else if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy)) 386 redrawAll = TRUE; 387 } else redrawAll = TRUE; 388 389 if (redrawAll) 390 { 391 //CB: redraw all children for now 392 // -> problems with update region if we don't do it 393 // todo: rewrite whole handling 394 WinInvalidateRect(hwnd,NULL,TRUE); 395 } 396 else 397 { 398 HPS hps = WinGetPS(hwnd); 399 RECTL frame,client,arcl[4]; 400 401 WinQueryWindowRect(hwnd,&frame); 402 //top 403 arcl[0].xLeft = 0; 404 arcl[0].xRight = frame.xRight; 405 arcl[0].yBottom = rect.yTop; 406 arcl[0].yTop = frame.yTop; 407 //right 408 arcl[1].xLeft = rect.xRight; 409 arcl[1].xRight = frame.xRight; 410 arcl[1].yBottom = 0; 411 arcl[1].yTop = frame.yTop; 412 //left 413 arcl[2].xLeft = 0; 414 arcl[2].xRight = rect.xLeft; 415 arcl[2].yBottom = 0; 416 arcl[2].yTop = frame.yTop; 417 //bottom 418 arcl[3].xLeft = 0; 419 arcl[3].xRight = frame.xRight; 420 arcl[3].yBottom = 0; 421 arcl[3].yTop = rect.yBottom; 422 423 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl); 424 425 WinInvalidateRegion(hwnd,hrgn,FALSE); 426 GpiDestroyRegion(hps,hrgn); 427 WinReleasePS(hps); 428 } 429 } 430 } 431 else 432 { 433 if(win32wnd->CanReceiveSizeMsgs()) 434 win32wnd->MsgPosChanged((LPARAM)&wp); 435 } 436 437 PosChangedEnd: 438 RestoreOS2TIB(); 439 return (MRESULT)FALSE; 273 440 } 274 441 275 442 case WM_ACTIVATE: 276 443 { 444 USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS); 445 277 446 dprintf(("OS2: WM_ACTIVATE %x %x %x", hwnd, mp1, mp2)); 278 447 279 if(win32wnd->IsWindowCreated()) 448 if(win32wnd->IsWindowCreated()) 449 { 450 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 280 451 win32wnd->MsgActivate((LOWORD(pWinMsg->wParam) == WA_ACTIVE_W) ? 1 : 0, HIWORD(pWinMsg->wParam), pWinMsg->lParam, (HWND)mp2); 281 452 453 //CB: show owner behind the dialog 454 if(win32wnd->IsModalDialog()) 455 { 456 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 457 458 if(topOwner) WinSetWindowPos(topOwner->getOS2WindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 459 } 460 } 461 282 462 break; 283 463 } … … 289 469 } 290 470 471 291 472 case WM_MINMAXFRAME: 292 473 { 293 dprintf(("OS2: WM_MINMAXFRAME")); 294 break; 474 PSWP swp = (PSWP)mp1; 475 476 if (!win32wnd->IsWindowCreated()) goto RunDefFrameProc; 477 dprintf(("OS2: WM_MINMAXFRAME %x",hwnd)); 478 if ((swp->fl & SWP_MAXIMIZE) == SWP_MAXIMIZE) 479 { 480 win32wnd->setStyle((win32wnd->getStyle() & ~WS_MINIMIZE_W) | WS_MAXIMIZE_W); 481 482 RECT rect; 483 484 rect.left = rect.top = rect.right = rect.bottom = 0; 485 win32wnd->AdjustMaximizedRect(&rect); 486 swp->x += rect.left; 487 swp->cx += rect.right-rect.left; 488 swp->y -= rect.bottom; 489 swp->cy += rect.bottom-rect.top; 490 } 491 else if ((swp->fl & SWP_MINIMIZE) == SWP_MINIMIZE) 492 { 493 win32wnd->setStyle((win32wnd->getStyle() & ~WS_MAXIMIZE_W) | WS_MINIMIZE_W); 494 } 495 else if ((swp->fl & SWP_RESTORE) == SWP_RESTORE) 496 { 497 win32wnd->setStyle(win32wnd->getStyle() & ~(WS_MINIMIZE_W | WS_MAXIMIZE_W)); 498 } 499 goto RunDefFrameProc; 295 500 } 296 501 … … 322 527 } 323 528 #else 324 dprintf(("PMWINDOW: WM_CALCVALIDRECTS "));529 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 325 530 RestoreOS2TIB(); 326 531 return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 327 532 #endif 533 534 case WM_VRNENABLED: 535 if(!win32wnd->isComingToTop() && ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == WS_EX_TOPMOST_W)) 536 { 537 HWND hwndrelated; 538 Win32BaseWindow *topwindow; 539 540 win32wnd->setComingToTop(TRUE); 541 542 hwndrelated = WinQueryWindow(hwnd, QW_PREV); 543 dprintf(("WM_VRNENABLED hwndrelated = %x (hwnd=%x)", hwndrelated, hwnd)); 544 topwindow = Win32BaseWindow::GetWindowFromOS2Handle(hwndrelated); 545 if(topwindow == NULL || ((win32wnd->getExStyle() & WS_EX_TOPMOST_W) == 0)) { 546 //put window at the top of z order 547 WinSetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER ); 548 } 549 550 win32wnd->setComingToTop(FALSE); 551 break; 552 } 553 goto RunDefWndProc; 328 554 329 555 case WM_SETFOCUS: … … 350 576 //************************************************************************** 351 577 case WM_HITTEST: 352 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 353 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 354 } 355 if(win32wnd) 356 rc = win32wnd->MsgHitTest(pWinMsg); 357 break; 358 578 { 579 if(win32wnd->getWindowHandle() != pWinMsg->hwnd) { 580 win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd); 581 } 582 if(win32wnd && win32wnd->IsWindowCreated()) 583 { 584 MRESULT rc; 585 586 rc = (MRESULT)win32wnd->MsgHitTest(pWinMsg); 587 RestoreOS2TIB(); 588 return rc; 589 } 590 return (MRESULT)HT_NORMAL; 591 } 359 592 360 593 case WM_BUTTON1DOWN: … … 452 685 case WM_PAINT: 453 686 { 454 // RECTL rectl; 455 456 dprintf(("OS2: WM_PAINT")); 457 win32wnd->DispatchMsgA(pWinMsg); 687 RECTL rectl; 688 689 WinQueryUpdateRect(hwnd, &rectl); 690 dprintf(("OS2: WM_PAINT (%d,%d) (%d,%d)", rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop)); 691 if(win32wnd->IsWindowCreated()) 692 { 693 PRECT pClient = win32wnd->getClientRectPtr(); 694 PRECT pWindow = win32wnd->getWindowRect(); 695 696 if(!(pClient->left == 0 && pClient->top == 0 && 697 win32wnd->getClientHeight() == win32wnd->getWindowHeight() && 698 win32wnd->getClientWidth() == win32wnd->getWindowWidth())) 699 { 700 win32wnd->MsgNCPaint(); 701 } 702 win32wnd->DispatchMsgA(pWinMsg); 703 } 458 704 //SvL: Not calling the default window procedure causes all sorts of 459 705 // strange problems (redraw & hanging app) 706 // -> check what WinBeginPaint does what we're forgetting in BeginPaint 460 707 // WinQueryUpdateRect(hwnd, &rectl); 461 708 // if(rectl.xLeft == 0 && rectl.yTop == 0 && rectl.xRight == 0 && rectl.yBottom == 0) { … … 465 712 // dprintf(("Update rectangle (%d,%d)(%d,%d) not empty, msg %x", rectl.xLeft, rectl.yTop, rectl.xRight, rectl.yBottom, pWinMsg->message)); 466 713 goto RunDefWndProc; 467 } 468 469 case WM_CONTEXTMENU: 470 { 471 win32wnd->DispatchMsgA(pWinMsg); 472 473 RestoreOS2TIB(); 474 return (MRESULT)TRUE; 714 // break; 475 715 } 476 716 … … 482 722 } 483 723 724 #if 0 725 case WM_CONTEXTMENU: 726 { 727 win32wnd->DispatchMsgA(pWinMsg); 728 729 RestoreOS2TIB(); 730 return (MRESULT)TRUE; 731 } 732 #endif 733 484 734 case WM_FOCUSCHANGE: 485 735 dprintf(("OS2: WM_FOCUSCHANGE %x", win32wnd->getWindowHandle())); 486 736 goto RunDefWndProc; 737 738 case WM_QUERYTRACKINFO: 739 { 740 PTRACKINFO trackInfo = (PTRACKINFO)mp2; 741 742 dprintf(("OS2: WM_QUERYTRACKINFO %x", win32wnd->getWindowHandle())); 743 RestoreOS2TIB(); 744 PMFrameWindowProc(hwnd,msg,mp1,mp2); 745 SetWin32TIB(); 746 trackInfo->cxBorder = 4; 747 trackInfo->cyBorder = 4; 748 win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize); 749 RestoreOS2TIB(); 750 return (MRESULT)TRUE; 751 } 752 753 case WM_QUERYBORDERSIZE: 754 { 755 PWPOINT size = (PWPOINT)mp1; 756 757 dprintf(("OS2: WM_QUERYBORDERSIZE %x", win32wnd->getWindowHandle())); 758 759 size->x = 0; 760 size->y = 0; 761 RestoreOS2TIB(); 762 return (MRESULT)TRUE; 763 } 764 765 case WM_FORMATFRAME: 766 dprintf(("OS2: WM_FORMATFRAME %x", win32wnd->getWindowHandle())); 767 break; 768 769 #if 0 770 case WM_ADJUSTFRAMEPOS: 771 dprintf(("OS2: WM_ADJUSTFRAMEPOS %x", win32wnd->getWindowHandle())); 772 break; 773 774 case WM_QUERYFRAMEINFO: 775 dprintf(("OS2: WM_QUERYFRAMEINFO %x", win32wnd->getWindowHandle())); 776 return (MRESULT)(FI_FRAME|FI_ACTIVATEOK); 777 778 case WM_QUERYFOCUSCHAIN: 779 { 780 USHORT fsCmd = SHORT1FROMMP(mp1); 781 782 dprintf(("OS2: WM_QUERYFOCUSCHAIN %x %x %x", win32wnd->getWindowHandle(), mp1, mp2)); 783 switch(fsCmd) { 784 case QFC_NEXTINCHAIN: 785 break; 786 case QFC_ACTIVE: 787 case QFC_FRAME: 788 if(win32wnd->GetTopParent()) { 789 dprintf(("Frame = %x", win32wnd->GetTopParent()->getOS2WindowHandle())); 790 return (MRESULT)win32wnd->GetTopParent()->getOS2WindowHandle(); 791 } 792 break; 793 case QFC_SELECTACTIVE: 794 break; 795 case QFC_PARTOFCHAIN: 796 return (MRESULT)TRUE; 797 } 798 break; 799 } 800 #endif 487 801 488 802 case WM_INITMENU: … … 511 825 case WM_SEMANTICEVENT: 512 826 default: 513 //dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));827 // dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 514 828 RestoreOS2TIB(); 515 return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 829 return PMFrameWindowProc(hwnd, msg, mp1, mp2); 830 // return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 516 831 } 517 832 RestoreOS2TIB(); 518 833 return (MRESULT)rc; 519 834 835 RunDefFrameProc: 836 RestoreOS2TIB(); 837 return PMFrameWindowProc(hwnd, msg, mp1, mp2); 838 520 839 RunDefWndProc: 521 840 // dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd)); 522 841 RestoreOS2TIB(); 523 524 return WinDefWindowProc( hwnd, msg, mp1, mp2 );842 return PMFrameWindowProc(hwnd, msg, mp1, mp2); 843 // return WinDefWindowProc( hwnd, msg, mp1, mp2 ); 525 844 } /* End of Win32WindowProc */ 526 845 //****************************************************************************** 846 //TODO: Quickly moving a window two times doesn't force a repaint (1st time) 527 847 //****************************************************************************** 848 VOID FrameTrackFrame(Win32BaseWindow *win32wnd,DWORD flags) 849 { 850 TRACKINFO track; 851 RECTL rcl; 852 PRECT pWindowRect; 853 HWND hwndTracking; 854 HPS hpsTrack; 855 LONG parentHeight, parentWidth; 856 857 track.cxBorder = 4; 858 track.cyBorder = 4; /* 4 pel wide lines used for rectangle */ 859 track.cxGrid = 1; 860 track.cyGrid = 1; /* smooth tracking with mouse */ 861 track.cxKeyboard = 8; 862 track.cyKeyboard = 8; /* faster tracking using cursor keys */ 863 864 pWindowRect = win32wnd->getWindowRect(); 865 if(win32wnd->getParent()) { 866 parentHeight = win32wnd->getParent()->getWindowHeight(); 867 parentWidth = win32wnd->getParent()->getWindowWidth(); 868 hwndTracking = win32wnd->getParent()->getOS2WindowHandle(); 869 hpsTrack = WinGetPS(hwndTracking); 870 } 871 else { 872 parentHeight = OSLibQueryScreenHeight(); 873 parentWidth = OSLibQueryScreenWidth(); 874 hwndTracking = HWND_DESKTOP; 875 hpsTrack = NULL; 876 } 877 878 rcl.xLeft = pWindowRect->left; 879 rcl.yTop = OSLibQueryScreenHeight() - pWindowRect->top; 880 rcl.xRight = pWindowRect->right; 881 rcl.yBottom = OSLibQueryScreenHeight() - pWindowRect->bottom; 882 if(hwndTracking != HWND_DESKTOP) { 883 WinMapWindowPoints(win32wnd->getOS2WindowHandle(), HWND_DESKTOP, (PPOINTL)&rcl, 2); 884 } 885 WinCopyRect(hab, &track.rclTrack, &rcl); /* starting point */ 886 887 WinSetRect(hab, &track.rclBoundary, 0, 0, parentWidth, parentHeight); /* bounding rectangle */ 888 889 track.ptlMinTrackSize.x = 10; 890 track.ptlMinTrackSize.y = 10; /* set smallest allowed size of rectangle */ 891 track.ptlMaxTrackSize.x = parentWidth; 892 track.ptlMaxTrackSize.y = parentHeight; /* set largest allowed size of rectangle */ 893 894 win32wnd->AdjustTrackInfo((PPOINT)&track.ptlMinTrackSize, (PPOINT)&track.ptlMaxTrackSize); 895 896 track.fs = flags; 897 898 if(WinTrackRect(HWND_DESKTOP, NULL, &track) ) 899 { 900 if(hpsTrack) WinReleasePS(hpsTrack); 901 902 /* if successful copy final position back */ 903 if(!WinEqualRect(0, &rcl, &track.rclTrack)) { 904 if(flags == TF_MOVE) { 905 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 906 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 907 0, 0, SWP_MOVE); 908 } 909 else { 910 WinSetWindowPos(win32wnd->getOS2WindowHandle(), 911 0, track.rclTrack.xLeft, track.rclTrack.yBottom, 912 track.rclTrack.xRight - track.rclTrack.xLeft, 913 track.rclTrack.yTop - track.rclTrack.yBottom, 914 SWP_SIZE|SWP_MOVE); 915 } 916 } 917 return; 918 } 919 if(hpsTrack) WinReleasePS(hpsTrack); 920 return; 921 } 922 //****************************************************************************** 923 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.