- Timestamp:
- Feb 22, 2001, 7:18:59 PM (25 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/dc.cpp
r5215 r5246 1 /* $Id: dc.cpp,v 1.9 1 2001-02-20 15:40:22sandervl Exp $ */1 /* $Id: dc.cpp,v 1.92 2001-02-22 18:18:59 sandervl Exp $ */ 2 2 3 3 /* … … 515 515 516 516 //testestest 517 #if 0 517 518 GpiQueryViewingLimits(pHps->hps, &rectWindowOS2); 518 519 dprintf2(("view limits (%d,%d)(%d,%d)", rectWindowOS2.xLeft, rectWindowOS2.yBottom, rectWindowOS2.xRight, rectWindowOS2.yTop)); … … 531 532 GpiQueryPickApertureSize(pHps->hps, &size); 532 533 dprintf2(("page viewport (%d,%d)", size.cx, size.cy)); 534 535 GpiQueryPS(pHps->hps, &size); 536 dprintf2(("page space (%d,%d)", size.cx, size.cy)); 537 #endif 533 538 //testestest 534 539 … … 1291 1296 pr->yTop = height - pr->yBottom; 1292 1297 pr->yBottom = height - temp; 1298 dprintf2(("Invalid region (%d,%d) (%d,%d)", pr->xLeft, pr->yBottom, pr->xRight, pr->yTop)); 1293 1299 } 1294 1300 -
trunk/src/user32/pmwindow.cpp
r5217 r5246 1 /* $Id: pmwindow.cpp,v 1.11 8 2001-02-20 17:22:05sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.119 2001-02-22 18:18:59 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 44 44 #include "dbglocal.h" 45 45 46 //define this to use the new code for WM_CALCVALIDRECT handling 47 //#define USE_CALCVALIDRECT 48 46 49 HMQ hmq = 0; /* Message queue handle */ 47 50 HAB hab = 0; … … 438 441 } 439 442 440 if((pswp->fl & (SWP_MOVE | SWP_SIZE)) && !(win32wnd->getStyle() & WS_MINIMIZE_W)) 443 #ifndef USE_CALCVALIDRECT 444 if((pswp->fl & (SWP_MOVE | SWP_SIZE))) 441 445 { 442 446 //CB: todo: use result for WM_CALCVALIDRECTS … … 513 517 else 514 518 { 519 #endif //USE_CALCVALIDRECT 515 520 if(win32wnd->CanReceiveSizeMsgs()) 516 521 win32wnd->MsgPosChanged((LPARAM)&wp); 517 } 522 #ifndef USE_CALCVALIDRECT 523 } 524 #endif 518 525 519 526 if(pswp->fl & SWP_ACTIVATE) … … 568 575 569 576 case WM_CALCVALIDRECTS: 577 #ifdef USE_CALCVALIDRECT 578 { 579 PRECTL oldRect = (PRECTL)mp1, newRect = oldRect+1; 580 PSWP pswp = (PSWP)mp2; 581 SWP swpOld; 582 WINDOWPOS wp; 583 RECTL newClientrect, oldClientRect; 584 ULONG nccalcret; 585 // UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP; 586 UINT res = 0; 587 588 dprintf(("PMWINDOW: WM_CALCVALIDRECTS %x", win32wnd->getWindowHandle())); 589 590 //Get old position info 591 WinQueryWindowPos(hwnd, &swpOld); 592 593 if(win32wnd->getParent()) { 594 OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, win32wnd->getParent()->getWindowHeight(), 595 win32wnd->getParent()->getClientRectPtr()->left, 596 win32wnd->getParent()->getClientRectPtr()->top, 597 hwnd); 598 } 599 else OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, OSLibQueryScreenHeight(), 0, 0, hwnd); 600 601 wp.hwnd = win32wnd->getWindowHandle(); 602 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 603 { 604 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 605 if(wndAfter) { 606 wp.hwndInsertAfter = wndAfter->getWindowHandle(); 607 } 608 else wp.hwndInsertAfter = HWND_TOP_W; 609 } 610 611 //Get old client rectangle 612 mapWin32ToOS2Rect(oldRect->yTop - oldRect->yBottom, win32wnd->getClientRectPtr(), (PRECTLOS2)&oldClientRect); 613 614 //Note: Also updates the new window rectangle 615 nccalcret = win32wnd->MsgFormatFrame(&wp); 616 617 //Get new client rectangle 618 mapWin32ToOS2Rect(pswp->cy, win32wnd->getClientRectPtr(), (PRECTLOS2)&newClientrect); 619 620 if(nccalcret == 0) { 621 res = CVR_ALIGNTOP | CVR_ALIGNLEFT; 622 } 623 else { 624 if(nccalcret & WVR_ALIGNTOP_W) { 625 res |= CVR_ALIGNTOP; 626 } 627 else 628 if(nccalcret & WVR_ALIGNBOTTOM_W) { 629 res |= CVR_ALIGNBOTTOM; 630 } 631 632 if(nccalcret & WVR_ALIGNLEFT_W) { 633 res |= CVR_ALIGNLEFT; 634 } 635 else 636 if(nccalcret & WVR_ALIGNRIGHT_W) { 637 res |= CVR_ALIGNRIGHT; 638 } 639 640 if(nccalcret & WVR_REDRAW_W) {//WVR_REDRAW_W = (WVR_HREDRAW | WVR_VREDRAW) 641 res |= CVR_REDRAW; 642 } 643 else 644 if(nccalcret & WVR_VALIDRECTS_W) { 645 //TODO: 646 //res = 0; 647 } 648 } 649 if(res != 0) { 650 651 } 652 570 653 #if 0 571 { 572 PRECTL oldRect = (PRECTL)mp1,newRect = oldRect+1; 573 UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP; 574 575 //CB: todo: use WM_NCCALCSIZE result 576 if (win32wnd->getWindowClass()) 577 { 578 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 579 580 if ((dwStyle & CS_HREDRAW_W) && (newRect->xRight-newRect->xLeft != oldRect->xRight-oldRect->xLeft)) 581 res |= CVR_REDRAW; 582 else 583 if ((dwStyle & CS_VREDRAW_W) && (newRect->yTop-newRect->yBottom != oldRect->yTop-oldRect->yBottom)) 584 res |= CVR_REDRAW; 585 } 586 else res |= CVR_REDRAW; 587 588 return (MRESULT)res; 654 if((pswp->fl & SWP_SIZE) && ((pswp->cx != pswpOld->cx) || (pswp->cy != pswpOld->cy))) 655 { 656 //redraw the frame (to prevent unnecessary client updates) 657 BOOL redrawAll = FALSE; 658 659 if (win32wnd->getWindowClass()) 660 { 661 DWORD dwStyle = win32wnd->getWindowClass()->getClassLongA(GCL_STYLE_W); 662 663 if ((dwStyle & CS_HREDRAW_W) && (pswp->cx != pswpOld->cx)) 664 redrawAll = TRUE; 665 else 666 if ((dwStyle & CS_VREDRAW_W) && (pswp->cy != pswpOld->cy)) 667 redrawAll = TRUE; 668 } 669 else redrawAll = TRUE; 670 671 if (redrawAll) 672 { 673 //CB: redraw all children for now 674 // -> problems with update region if we don't do it 675 // todo: rewrite whole handling 676 WinInvalidateRect(hwnd,NULL,TRUE); 677 } 678 else 679 { 680 HPS hps = WinGetPS(hwnd); 681 RECTL frame,client,arcl[4]; 682 683 WinQueryWindowRect(hwnd,&frame); 684 685 //top 686 arcl[0].xLeft = 0; 687 arcl[0].xRight = frame.xRight; 688 arcl[0].yBottom = rect.yTop; 689 arcl[0].yTop = frame.yTop; 690 //right 691 arcl[1].xLeft = rect.xRight; 692 arcl[1].xRight = frame.xRight; 693 arcl[1].yBottom = 0; 694 arcl[1].yTop = frame.yTop; 695 //left 696 arcl[2].xLeft = 0; 697 arcl[2].xRight = rect.xLeft; 698 arcl[2].yBottom = 0; 699 arcl[2].yTop = frame.yTop; 700 //bottom 701 arcl[3].xLeft = 0; 702 arcl[3].xRight = frame.xRight; 703 arcl[3].yBottom = 0; 704 arcl[3].yTop = rect.yBottom; 705 706 HRGN hrgn = GpiCreateRegion(hps,4,(PRECTL)&arcl); 707 708 WinInvalidateRegion(hwnd,hrgn,FALSE); 709 GpiDestroyRegion(hps,hrgn); 710 WinReleasePS(hps); 711 } 712 } 713 714 } 715 #endif 716 717 return (MRESULT)res; 589 718 } 590 719 #else -
trunk/src/user32/win32wbase.cpp
r5242 r5246 1 /* $Id: win32wbase.cpp,v 1.24 2 2001-02-22 10:37:31sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.243 2001-02-22 18:18:59 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 2180 2180 BOOL rc,wasVisible,showFlag; 2181 2181 RECT newPos = {0, 0, 0, 0}; 2182 BOOL fInvalidate = FALSE;2183 2182 2184 2183 dprintf(("ShowWindow %x %x", getWindowHandle(), nCmdShow)); … … 2200 2199 /* fall through */ 2201 2200 case SW_MINIMIZE: 2202 //testesteest2203 2201 if(!(getStyle() & WS_CHILD)) 2204 2202 { … … 2212 2210 if( !(getStyle() & WS_MINIMIZE) ) { 2213 2211 swp |= MinMaximize(SW_MINIMIZE, &newPos ); 2214 fInvalidate = TRUE;2215 2212 } 2216 2213 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2217 2214 } 2218 //testesteest2219 2215 break; 2220 2216 … … 2253 2249 swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED; 2254 2250 2255 if( getStyle() & (WS_MINIMIZE | WS_MAXIMIZE) ) 2251 if( getStyle() & (WS_MINIMIZE | WS_MAXIMIZE) ) { 2256 2252 swp |= MinMaximize(SW_RESTORE, &newPos ); 2253 } 2257 2254 else swp |= SWP_NOSIZE | SWP_NOMOVE; 2258 2255 break; … … 2292 2289 rectClient.bottom-rectClient.top)); 2293 2290 SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top)); 2294 }2295 if(fInvalidate) {2296 InvalidateRect(getWindowHandle(), NULL, 1);2297 2291 } 2298 2292 END: … … 2519 2513 else SendInternalMessageA(WM_WINDOWPOSCHANGED, 0, (LPARAM)wpos); 2520 2514 2515 //Calculate invalid areas 2521 2516 rect = rectWindow; 2522 2517 OffsetRect(&rect, -rectWindow.left, -rectWindow.top); … … 2527 2522 } 2528 2523 rect = rectClient; 2529 OffsetRect(&rect, -rectClient.left, -rectClient.top);2530 2524 hrgnClient = CreateRectRgnIndirect(&rect); 2531 2525 if (!hrgn) { … … 2538 2532 if(!EqualRect(oldClientRect, &rectClient)) { 2539 2533 UnionRect(oldClientRect, oldClientRect, &rectClient); 2540 OffsetRect(oldClientRect, -rectClient.left, -rectClient.top);2541 2534 hrgnClient = CreateRectRgnIndirect(oldClientRect); 2542 2535 if (!hrgn) { … … 2547 2540 DeleteObject(hrgnClient); 2548 2541 } 2549 InvalidateRgn(getWindowHandle(), hrgn, TRUE); 2542 RedrawWindow(getWindowHandle(), NULL, hrgn, RDW_ALLCHILDREN | 2543 RDW_INVALIDATE | RDW_ERASE | RDW_FRAME); 2550 2544 DeleteObject(hrgn); 2551 2545 } -
trunk/src/user32/win32wbasepos.cpp
r5236 r5246 1 /* $Id: win32wbasepos.cpp,v 1.2 0 2001-02-21 20:51:07sandervl Exp $ */1 /* $Id: win32wbasepos.cpp,v 1.21 2001-02-22 18:18:59 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (nonclient/position methods) … … 155 155 if((winpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE ) 156 156 { 157 params.rgrc[0] = *newWindowRect;158 if(calcValidRect)159 {157 params.rgrc[0] = *newWindowRect; 158 if(calcValidRect) 159 { 160 160 winposCopy = *winpos; 161 161 params.rgrc[1] = *oldWindowRect; … … 165 165 166 166 params.lppos = &winposCopy; 167 }168 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)¶ms );169 170 /* If the application send back garbage, ignore it */171 if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom)172 {167 } 168 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)¶ms ); 169 170 /* If the application send back garbage, ignore it */ 171 if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom) 172 { 173 173 *newClientRect = params.rgrc[0]; 174 174 //client rectangle now in parent coordinates; convert to 'frame' coordinates 175 175 OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top); 176 }176 } 177 177 178 178 /* FIXME: WVR_ALIGNxxx */ … … 211 211 return 0; 212 212 } 213 /*********************************************************************** 214 * WINPOS_FindIconPos 215 * 216 * Find a suitable place for an iconic window. 217 */ 218 static void WINPOS_FindIconPos( HWND hwnd, POINT &pt ) 219 { 220 RECT rectParent; 221 int x, y, xspacing, yspacing; 222 HWND hwndChild, hwndParent; 223 224 hwndParent = GetParent(hwnd); 225 if(hwndParent == 0) { 226 DebugInt3(); 227 return; 228 } 229 230 GetClientRect(hwndParent, &rectParent ); 231 if ((pt.x >= rectParent.left) && (pt.x + GetSystemMetrics(SM_CXICON) < rectParent.right) && 232 (pt.y >= rectParent.top) && (pt.y + GetSystemMetrics(SM_CYICON) < rectParent.bottom)) 233 return; /* The icon already has a suitable position */ 234 235 xspacing = GetSystemMetrics(SM_CXICONSPACING); 236 yspacing = GetSystemMetrics(SM_CYICONSPACING); 237 238 y = rectParent.bottom; 239 for (;;) 240 { 241 x = rectParent.left; 242 do 243 { 244 /* Check if another icon already occupies this spot */ 245 hwndChild = GetWindow(hwndParent, GW_CHILD); 246 247 while(hwndChild) 248 { 249 Win32BaseWindow *child = NULL; 250 RECT *pRectWindow; 251 252 child = Win32BaseWindow::GetWindowFromHandle(hwndChild); 253 if(!child) { 254 dprintf(("ERROR: WINPOS_FindIconPos, child %x not found", hwndChild)); 255 return; 256 } 257 if ((child->getStyle() & WS_MINIMIZE) && (child->getWindowHandle() != hwnd)) 258 { 259 pRectWindow = child->getWindowRect(); 260 if ((pRectWindow->left < x + xspacing) && 261 (pRectWindow->right >= x) && 262 (pRectWindow->top <= y) && 263 (pRectWindow->bottom > y - yspacing)) 264 break; /* There's a window in there */ 265 } 266 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT); 267 } 268 269 if (!hwndChild) /* No window was found, so it's OK for us */ 270 { 271 pt.x = x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2; 272 pt.y = y - (yspacing + GetSystemMetrics(SM_CYICON)) / 2; 273 return; 274 } 275 x += xspacing; 276 } while(x <= rectParent.right-xspacing); 277 278 y -= yspacing; 279 } 280 } 213 281 /****************************************************************************** 214 282 * WINPOS_MinMaximize … … 221 289 { 222 290 UINT swpFlags = 0; 223 POINT size ;291 POINT size, iconPos; 224 292 225 293 size.x = rectWindow.left; … … 248 316 setStyle(getStyle() | WS_MINIMIZE); 249 317 250 SetRect(lpRect, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y, 251 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 318 iconPos.x = windowpos.ptMinPosition.x; 319 iconPos.y = windowpos.ptMinPosition.y; 320 WINPOS_FindIconPos(getWindowHandle(), iconPos); 321 SetRect(lpRect, iconPos.x, iconPos.y, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 252 322 break; 253 323
Note:
See TracChangeset
for help on using the changeset viewer.