- Timestamp:
- Nov 12, 2003, 3:13:26 PM (22 years ago)
- Location:
- trunk/src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/gdi32.DEF
r8871 r10316 1 ; $Id: gdi32.DEF,v 1.2 2 2002-07-15 10:02:28sandervl Exp $1 ; $Id: gdi32.DEF,v 1.23 2003-11-12 14:10:55 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 16 16 17 17 EXPORTS 18 _GDI_CallDevInstall16@20 @100 19 _GDI_CallExtDeviceModePropSheet16@16 @101 20 _GDI_CallExtDeviceMode16@28 @102 21 _GDI_CallAdvancedSetupDialog16@16 @103 22 _GDI_CallDeviceCapabilities16@20 @104 18 _GDI_CallDevInstall16@20 @100 NONAME 19 _GDI_CallExtDeviceModePropSheet16@16 @101 NONAME 20 _GDI_CallExtDeviceMode16@28 @102 NONAME 21 _GDI_CallAdvancedSetupDialog16@16 @103 NONAME 22 _GDI_CallDeviceCapabilities16@20 @104 NONAME 23 23 24 24 AbortDoc = _AbortDoc@4 @105 … … 207 207 GetPolyFillMode = _GetPolyFillMode@4 @288 208 208 GetROP2 = _GetROP2@4 @289 209 ; GetRandomRgn = _GetRandomRgn@??@290209 GetRandomRgn = _GetRandomRgn@12 @290 210 210 GetRasterizerCaps = _GetRasterizerCaps@8 @291 211 211 GetRegionData = _GetRegionData@12 @292 … … 352 352 ; pfnRealizePalette = _pfnRealizePalette@?? @433 353 353 ; pfnSelectPalette = _pfnSelectPalette@?? @434 354 354 GetGlyphIndicesA = _GetGlyphIndicesA@20 @435 355 GetGlyphIndicesW = _GetGlyphIndicesW@20 @436 356 357 ; 358 ; ENDOFEXPORTS 359 ; Internal function marker 360 ; 355 361 356 362 ; … … 374 380 OSLibGpiSetCp__FUlT1 @1213 NONAME 375 381 _ConvertRGB555to565@12 @1214 NONAME 382 383 _FillRect@12 @1215 NONAME 384 _FrameRect@12 @1216 NONAME 385 _InvertRect@8 @1217 NONAME 386 387 _GdiCombineVisRgn@12 @1218 NONAME 388 _GdiSetVisRgn@8 @1219 NONAME 389 _GdiCombineVisRgnClipRgn@12 @1220 NONAME 390 -
trunk/src/gdi32/gdi32.cpp
r9554 r10316 1 /* $Id: gdi32.cpp,v 1.8 7 2002-12-28 10:16:20sandervl Exp $ */1 /* $Id: gdi32.cpp,v 1.88 2003-11-12 14:12:01 sandervl Exp $ */ 2 2 3 3 /* … … 35 35 //****************************************************************************** 36 36 //****************************************************************************** 37 int WIN32API FillRect(HDC hDC, const RECT * lprc, HBRUSH hbr) 38 { 39 int ret; 40 41 //SvL: brush 0 means current selected brush (verified in NT4) 42 if(hbr == 0) { 43 hbr = GetCurrentObject(hDC, OBJ_BRUSH); 44 } 45 else 46 if (hbr <= (HBRUSH) (COLOR_MAX + 1)) { 47 hbr = GetSysColorBrush( (INT) hbr - 1 ); 48 } 49 dprintf(("USER32: FillRect %x (%d,%d)(%d,%d) brush %X", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom, hbr)); 50 ret = O32_FillRect(hDC,lprc,hbr); 51 return ret; 52 } 53 //****************************************************************************** 54 //****************************************************************************** 55 int WIN32API FrameRect( HDC hDC, const RECT * lprc, HBRUSH hbr) 56 { 57 int ret; 58 59 dprintf(("USER32: FrameRect %x (%d,%d)(%d,%d) brush %x", hDC, lprc->top, lprc->left, lprc->bottom, lprc->right, hbr)); 60 ret = O32_FrameRect(hDC,lprc,hbr); 61 return ret; 62 } 63 //****************************************************************************** 64 //****************************************************************************** 65 BOOL WIN32API InvertRect( HDC hDC, const RECT * lprc) 66 { 67 int ret; 68 69 if(lprc) { 70 dprintf(("USER32: InvertRect %x (%d,%d)(%d,%d)", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom)); 71 } 72 else dprintf(("USER32: InvertRect %x NULL", hDC)); 73 ret = O32_InvertRect(hDC,lprc); 74 return ret; 75 } 37 76 //****************************************************************************** 38 77 //****************************************************************************** -
trunk/src/gdi32/gdi32dbg.def
r9429 r10316 1 ; $Id: gdi32dbg.def,v 1. 1 2002-11-26 10:53:09sandervl Exp $1 ; $Id: gdi32dbg.def,v 1.2 2003-11-12 14:10:55 sandervl Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 16 16 17 17 EXPORTS 18 _GDI_CallDevInstall16@20 @100 19 _GDI_CallExtDeviceModePropSheet16@16 @101 20 _GDI_CallExtDeviceMode16@28 @102 21 _GDI_CallAdvancedSetupDialog16@16 @103 22 _GDI_CallDeviceCapabilities16@20 @104 18 _GDI_CallDevInstall16@20 @100 NONAME 19 _GDI_CallExtDeviceModePropSheet16@16 @101 NONAME 20 _GDI_CallExtDeviceMode16@28 @102 NONAME 21 _GDI_CallAdvancedSetupDialog16@16 @103 NONAME 22 _GDI_CallDeviceCapabilities16@20 @104 NONAME 23 23 24 24 AbortDoc = _DbgAbortDoc@4 @105 … … 207 207 GetPolyFillMode = _DbgGetPolyFillMode@4 @288 208 208 GetROP2 = _DbgGetROP2@4 @289 209 ; GetRandomRgn = _DbgGetRandomRgn@??@290209 GetRandomRgn = _DbgGetRandomRgn@12 @290 210 210 GetRasterizerCaps = _DbgGetRasterizerCaps@8 @291 211 211 GetRegionData = _DbgGetRegionData@12 @292 … … 352 352 ; pfnRealizePalette = _DbgpfnRealizePalette@?? @433 353 353 ; pfnSelectPalette = _DbgpfnSelectPalette@?? @434 354 GetGlyphIndicesA = _GetGlyphIndicesA@20 @435 355 GetGlyphIndicesW = _GetGlyphIndicesW@20 @436 356 357 ; 358 ; ENDOFEXPORTS 359 ; Internal function marker 360 ; 354 361 355 362 … … 374 381 OSLibGpiSetCp__FUlT1 @1213 NONAME 375 382 _ConvertRGB555to565@12 @1214 NONAME 383 384 _DbgFillRect@12 @1215 NONAME 385 _DbgFrameRect@12 @1216 NONAME 386 _DbgInvertRect@8 @1217 NONAME 387 388 _GdiCombineVisRgn@12 @1218 NONAME 389 _GdiSetVisRgn@8 @1219 NONAME 390 _GdiCombineVisRgnClipRgn@12 @1220 NONAME -
trunk/src/gdi32/region.cpp
r10140 r10316 1 /* $Id: region.cpp,v 1.3 2 2003-06-03 13:48:13sandervl Exp $ */1 /* $Id: region.cpp,v 1.33 2003-11-12 14:10:55 sandervl Exp $ */ 2 2 3 3 /* … … 6 6 * Copyright 1998-2000 Sander van Leeuwen (sandervl@xs4all.nl) 7 7 * Copyright 1998 Patrick Haller 8 * Copyright 2002-2003 Innotek Systemberatung GmbH (sandervl@innotek.de) 8 9 * 9 10 * TODO: Metafile recording 10 11 * TODO: Do we need to translate & set the last error for Gpi operations? 12 * 13 * 14 * NOTE: In windows there is a clip and a visible region (just like in PM) 15 * We do not map the Win32 visible region to the PM visible region 16 * as that's rather annoying. 17 * Instead we use the intersection of the win32 visible and win32 clip 18 * region for the PM clip region. 19 * The original Win32 clip region is saved in pHps->hrgnWin32Clip. 20 * The Win32 visible region is saved in pHps->hrgnWinVis. 21 * 22 * 11 23 * 12 24 * Project Odin Software License can be found in LICENSE.TXT … … 31 43 #include <stats.h> 32 44 #include "dibsect.h" 45 #include <wingdi32.h> 33 46 34 47 #define DBG_LOCALLOG DBG_region 35 48 #include "dbglocal.h" 49 50 //GPI and Windows use the same values 51 #define GPI_TO_WIN_COMPLEXITY(a) a 36 52 37 53 typedef enum … … 42 58 43 59 #define MEM_HPS_MAX 768 60 61 int WIN32API OffsetRgn( HRGN hrgn, int xOffset, int yOffset); 44 62 45 63 static void convertDeviceRect(HWND hwnd, pDCData pHps, PRECTL pRectl, ULONG count); … … 107 125 LONG y = 0; 108 126 109 if(pHps == 0 ||pHps->isClient) //client area127 if(pHps && pHps->isClient) //client area 110 128 { 111 129 if(GetClientRect(OS2ToWin32Handle(hwnd), &rect) == TRUE) { … … 132 150 if(pHps->isPrinter) 133 151 { 134 return pHps->printPageHeight;152 return GetDeviceCaps(pHps->hps, VERTRES_W); 135 153 } 136 154 else … … 152 170 LONG x = 0; 153 171 154 if(pHps == 0 ||pHps->isClient) //client area172 if(pHps && pHps->isClient) //client area 155 173 { 156 174 if(GetClientRect(OS2ToWin32Handle(hwnd), &rect) == TRUE) { … … 164 182 return x; 165 183 } 184 else 185 if(pHps->bitmapHandle) 186 { 187 return pHps->bitmapWidth; 188 } 189 else 190 if(pHps->isMetaPS) 191 { 192 return 0; 193 } 194 else 195 if(pHps->isPrinter) 196 { 197 return GetDeviceCaps(pHps->hps, HORZRES_W); 198 } 166 199 // else 167 200 // DebugInt3(); … … 211 244 if(pHps) 212 245 { 213 246 wHeight += pHps->HPStoHDCInversionHeight; 214 247 } 215 248 … … 388 421 } 389 422 //****************************************************************************** 390 //****************************************************************************** 391 int WIN32API SelectClipRgn(HDC hdc, HRGN hrgn) 392 { 393 LONG lComplexity = RGN_NULL; 394 HRGN hrgnNewClip; 395 HRGN hrgnOldClip; 423 // GdiSetVisRgn 424 // 425 // Change the Win32 visible region to the specified region 426 // 427 // Parameters: 428 // 429 // pDCData pHps - presentation space structure 430 // HRGN hrgn - region handle (GPI) 431 // 432 // 433 // Returns: - ERROR_W -> failure 434 // - NULLREGION_W -> empty region 435 // - SIMPLEREGION_W -> rectangular region 436 // - COMPLEXREGION_W -> complex region 437 // 438 // NOTE: In windows there is a clip and a visible region (just like in PM) 439 // We do not map the Win32 visible region to the PM visible region 440 // as that's rather annoying. 441 // Instead we use the intersection of the win32 visible and win32 clip 442 // region for the PM clip region. 443 // The Win32 clip region is saved in pHps->hrgnWin32Clip. 444 // The Win32 visible region is saved in pHps->hrgnWinVis. 445 // 446 //****************************************************************************** 447 INT WIN32API GdiSetVisRgn(pDCData pHps, HRGN hrgn) 448 { 449 HRGN hrgnNewClip = NULLHANDLE, hrgnOldClip = NULLHANDLE; 450 LONG lComplexity = RGN_NULL; 451 RECTL rectl = {0, 0, 1, 1}; 452 453 if(pHps == NULL) { 454 DebugInt3(); 455 return ERROR_W; 456 } 457 458 if(hrgn != NULLHANDLE) 459 { 460 hrgnNewClip = GpiCreateRegion(pHps->hps, 1, &rectl); 461 if(hrgnNewClip == NULLHANDLE) { 462 dprintf(("ERROR: GdiCombineVisRgn: GpiCreateRegion failed!!")); 463 DebugInt3(); 464 goto failure; 465 } 466 //make a copy of the new visible region 467 lComplexity = GpiCombineRegion(pHps->hps, hrgnNewClip, hrgn, NULLHANDLE, CRGN_COPY); 468 } 469 else { 470 hrgnNewClip = NULLHANDLE; 471 } 472 473 //and set that as the GPI clip region 474 lComplexity = GpiSetClipRegion(pHps->hps, hrgnNewClip, &hrgnOldClip); 475 if (lComplexity != RGN_ERROR) 476 { 477 //SvL: Must check if origin changed here. Sometimes happens when 478 // window looses focus. (don't know why....) 479 checkOrigin(pHps); 480 481 if(hrgnOldClip) GpiDestroyRegion(pHps->hps, hrgnOldClip); 482 483 dprintf(("New visible region %x", hrgn)); 484 pHps->hrgnWinVis = hrgn; 485 return GPI_TO_WIN_COMPLEXITY(lComplexity); 486 } 487 failure: 488 if(hrgnNewClip) GpiDestroyRegion(pHps->hps, hrgnNewClip); 489 490 return ERROR_W; 491 } 492 //****************************************************************************** 493 // GdiCombineVisRgn 494 // 495 // Combine the specified region with the visible region according to the operation 496 // 497 // Parameters: 498 // 499 // pDCData pHps - presentation space structure 500 // HRGN hrgn - region handle (Win32) 501 // INT operation - combine operation (RGN_*) 502 // 503 // 504 // Returns: - ERROR_W -> failure 505 // - NULLREGION_W -> empty region 506 // - SIMPLEREGION_W -> rectangular region 507 // - COMPLEXREGION_W -> complex region 508 // 509 // NOTE: In windows there is a clip and a visible region (just like in PM) 510 // We do not map the Win32 visible region to the PM visible region 511 // as that's rather annoying. 512 // Instead we use the intersection of the win32 visible and win32 clip 513 // region for the PM clip region. 514 // The Win32 clip region is saved in pHps->hrgnWin32Clip. 515 // The Win32 visible region is saved in pHps->hrgnWinVis. 516 // 517 //****************************************************************************** 518 INT WIN32API GdiCombineVisRgn(pDCData pHps, HRGN hrgn, INT operation) 519 { 396 520 #ifdef DEBUG 397 HRGN hrgn1 = hrgn;521 HRGN hrgn1 = hrgn; 398 522 #endif 399 400 pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc); 401 if(!pHps) 402 { 403 dprintf(("WARNING: SelectClipRgn: invalid hdc!", hdc, hrgn)); 404 SetLastError(ERROR_INVALID_HANDLE_W); 523 LONG lComplexity = RGN_NULL; 524 525 if(pHps == NULL) { 526 DebugInt3(); 405 527 return ERROR_W; 406 528 } 407 529 408 if(hrgn) 409 { 410 hrgn = ObjQueryHandleData(hrgn, HNDL_REGION); 411 if(hrgn == HANDLE_OBJ_ERROR) { 412 dprintf(("WARNING: SelectClipRgn: invalid region!", hdc, hrgn1)); 413 SetLastError(ERROR_INVALID_HANDLE_W); 414 return ERROR_W; 415 } 416 } 417 418 if(hrgn) 419 { 420 RECTL rectl = {0,0,1,1}; 421 hrgnNewClip = GpiCreateRegion(pHps->hps, 1, &rectl); 422 if(interpretRegionAs(pHps, hrgnNewClip, hrgn, AS_DEVICE) == 0) 530 hrgn = ObjQueryHandleData(hrgn, HNDL_REGION); 531 if(hrgn == HANDLE_OBJ_ERROR || !pHps) { 532 dprintf(("ERROR: GdiCombineVisRgn %x invalid handle", hrgn1)); 533 return ERROR_W; 534 } 535 //interpretRegionAs converts the region and saves it in pHps->hrgnHDC 536 if(!interpretRegionAs(pHps, 0, hrgn, AS_DEVICE) ) 537 { 538 dprintf(("ERROR: interpretRegionAs failed!!")); 539 return ERROR_W; 540 } 541 542 //If there is no visible region, then create one that covers the whole DC 543 if(pHps->hrgnWinVis == NULLHANDLE) 544 { 545 RECTL rectl = {0, 0, hdcWidth(0, pHps), hdcHeight(0, pHps)}; 546 dprintf(("No visible region: create one (0,0)(%d,%d)", rectl.xRight, rectl.yTop)); 547 pHps->hrgnWinVis = GpiCreateRegion(pHps->hps, 1, &rectl); 548 if(pHps->hrgnWinVis == NULLHANDLE) { 549 dprintf(("ERROR: GdiCombineVisRgn: GpiCreateRegion failed!!")); 550 DebugInt3(); 551 goto failure; 552 } 553 } 554 555 LONG lMode; 556 switch (operation) 557 { 558 case RGN_AND_W : lMode = CRGN_AND ; break; 559 case RGN_DIFF_W : lMode = CRGN_DIFF; break; 560 default: 561 dprintf(("ERROR: GdiCombineVisRgn %d invalid parameter", operation)); 562 DebugInt3(); 563 goto failure; 564 } 565 lComplexity = GpiCombineRegion(pHps->hps, pHps->hrgnWinVis, pHps->hrgnWinVis, pHps->hrgnHDC, lMode); 566 if (lComplexity != RGN_ERROR) 567 { 568 return GdiSetVisRgn(pHps, pHps->hrgnWinVis); 569 } 570 dprintf(("ERROR: GdiCombineVisRgn: GpiCombineRegion failed")); 571 DebugInt3(); 572 573 failure: 574 return ERROR_W; 575 } 576 //****************************************************************************** 577 // GdiCombineVisRgnClipRgn 578 // 579 // Combine the specified clip region with the visible region according to the operation 580 // 581 // Parameters: 582 // 583 // pDCData pHps - presentation space structure 584 // HRGN hrgn - region handle (GPI) 585 // INT operation - combine operation (RGN_*) 586 // 587 // 588 // Returns: - ERROR_W -> failure 589 // - NULLREGION_W -> empty region 590 // - SIMPLEREGION_W -> rectangular region 591 // - COMPLEXREGION_W -> complex region 592 // 593 // NOTE: In windows there is a clip and a visible region (just like in PM) 594 // We do not map the Win32 visible region to the PM visible region 595 // as that's rather annoying. 596 // Instead we use the intersection of the win32 visible and win32 clip 597 // region for the PM clip region. 598 // The Win32 clip region is saved in pHps->hrgnWin32Clip. 599 // The Win32 visible region is saved in pHps->hrgnWinVis. 600 // 601 //****************************************************************************** 602 INT WIN32API GdiCombineVisRgnClipRgn(pDCData pHps, HRGN hrgn, INT operation) 603 { 604 HRGN hrgnClip = NULL, hrgnOldClip, hrgnNewClip; 605 LONG lComplexity = RGN_NULL; 606 607 //Create a region that will be used for the new GPI clip region 608 RECTL rectl = {0, 0, 1, 1}; 609 hrgnNewClip = GpiCreateRegion(pHps->hps, 1, &rectl); 610 if(hrgnNewClip == NULLHANDLE) { 611 dprintf(("ERROR: GdiCombineVisRgnClipRgn: GpiCreateRegion failed!!")); 612 DebugInt3(); 613 return ERROR_W; 614 } 615 616 if(hrgn == NULLHANDLE) 617 { 618 if(pHps->hrgnWin32Clip != NULL) 423 619 { 424 lComplexity = RGN_ERROR; 425 } 426 } 427 else 428 hrgnNewClip = 0; 429 430 if(lComplexity != RGN_ERROR) 431 { 432 if(hrgnNewClip == 0) { 433 GpiSetClipPath(pHps->hps, 0, SCP_RESET); 434 } 435 lComplexity = GpiSetClipRegion(pHps->hps, hrgnNewClip, &hrgnOldClip); 436 if (lComplexity != RGN_ERROR ) 437 { 438 if(hrgnOldClip) 439 GpiDestroyRegion(pHps->hps, hrgnOldClip); 440 441 //todo: metafile recording 442 SetLastError(ERROR_SUCCESS_W); 620 //Only reset the path if both the visible and clip regions are zero 621 if(!pHps->hrgnWinVis) { 622 GpiSetClipPath(pHps->hps, 0, SCP_RESET); 623 624 GpiDestroyRegion(pHps->hps, hrgnNewClip); 625 hrgnNewClip = NULLHANDLE; 626 } 627 else 628 {//set PM clip region to Win32 visible region 629 lComplexity = GpiCombineRegion(pHps->hps, hrgnNewClip, pHps->hrgnWinVis, NULLHANDLE, CRGN_COPY); 630 if(lComplexity == RGN_ERROR) { 631 dprintf(("ERROR: GdiCombineVisRgnClipRgn: GpiSetClipRegion failed!!")); 632 DebugInt3(); 633 goto failure; 634 } 635 } 636 dprintfRegion(pHps->hps, hrgnNewClip); 637 lComplexity = GpiSetClipRegion(pHps->hps, hrgnNewClip, &hrgnOldClip); 638 if(lComplexity == RGN_ERROR) { 639 dprintf(("ERROR: GdiCombineVisRgnClipRgn: GpiSetClipRegion failed!!")); 640 DebugInt3(); 641 } 443 642 444 643 //SvL: Must check if origin changed here. Sometimes happens when 445 644 // window looses focus. (don't know why....) 446 645 checkOrigin(pHps); 447 return lComplexity; 448 } 449 } 450 451 dprintf(("WARNING: SelectClipRgn: RGN_ERROR!", hdc, hrgn1)); 452 if(hrgnNewClip) 453 GpiDestroyRegion(pHps->hps, hrgnNewClip); 454 455 SetLastError(ERROR_SUCCESS_W); 456 return lComplexity; 646 if(hrgnOldClip) GpiDestroyRegion(pHps->hps, hrgnOldClip); 647 } 648 //else already NULL, so nothing to do. 649 650 pHps->hrgnWin32Clip = hrgn; 651 return NULLREGION_W; 652 } 653 654 LONG lMode; 655 switch (operation) 656 { 657 case RGN_AND_W : lMode = CRGN_AND ; break; //intersect clip & visible region 658 default: 659 dprintf(("ERROR: GdiCombineVisRgnClipRgn %d invalid parameter", operation)); 660 DebugInt3(); 661 goto failure; 662 } 663 // If there's no visible region (meaning entire DC is visible), then just set 664 // the GPI clip region to the win32 clip region 665 if (pHps->hrgnWinVis == NULLHANDLE) 666 { 667 lComplexity = GpiCombineRegion(pHps->hps, hrgnNewClip, hrgn, NULLHANDLE, CRGN_COPY); 668 } 669 else lComplexity = GpiCombineRegion(pHps->hps, hrgnNewClip, pHps->hrgnWinVis, hrgn, lMode); 670 671 if (lComplexity != RGN_ERROR) 672 { 673 dprintfRegion(pHps->hps, hrgnNewClip); 674 //And activate the new clip region 675 lComplexity = GpiSetClipRegion(pHps->hps, hrgnNewClip, &hrgnOldClip); 676 if (lComplexity == RGN_ERROR ) 677 { 678 dprintf(("ERROR: GdiCombineVisRgnClipRgn: GpiSetClipRegion failed")); 679 DebugInt3(); 680 goto failure; 681 } 682 //SvL: Must check if origin changed here. Sometimes happens when 683 // window looses focus. (don't know why....) 684 checkOrigin(pHps); 685 686 if(hrgnOldClip) GpiDestroyRegion(pHps->hps, hrgnOldClip); 687 688 pHps->hrgnWin32Clip = hrgn; 689 690 return GPI_TO_WIN_COMPLEXITY(lComplexity); 691 } 692 dprintf(("ERROR: GdiCombineVisRgnClipRgn: GpiCombineRegion failed")); 693 DebugInt3(); 694 695 failure: 696 if(hrgnNewClip) GpiDestroyRegion(pHps->hps, hrgnNewClip); 697 698 return ERROR_W; 457 699 } 458 700 //****************************************************************************** … … 464 706 #endif 465 707 466 pDCData 708 pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc); 467 709 if (!pHps) 468 710 { … … 473 715 474 716 LONG lComplexity; 475 HRGN hrgnCurrent = NULLHANDLE ;717 HRGN hrgnCurrent = NULLHANDLE, hrgnOld = NULLHANDLE; 476 718 477 719 if(!hrgn && mode != RGN_COPY_W) … … 506 748 return 0; 507 749 } 750 dprintfRegion(hdc, hrgn); 508 751 } 509 752 … … 511 754 if(hrgn) 512 755 { 756 //interpretRegionAs converts the region and saves it in pHps->hrgnHDC 513 757 if(!interpretRegionAs(pHps, 0, hrgn, AS_DEVICE) ) 514 758 { … … 518 762 else 519 763 { 520 //remove clip region 521 GpiSetClipPath(pHps->hps, 0, SCP_RESET); 522 GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnCurrent); 523 524 if(hrgnCurrent) 525 GpiDestroyRegion(pHps->hps, hrgnCurrent); 764 //Intersect the Windows clip region with the current visible region 765 lComplexity = GdiCombineVisRgnClipRgn(pHps, NULLHANDLE, RGN_AND_W); 526 766 527 767 return NULLREGION_W; 528 768 } 529 769 530 GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnCurrent); 770 // get current clipping region 771 hrgnOld = pHps->hrgnWin32Clip; 772 hrgnCurrent = hrgnOld; 531 773 532 774 if(hrgnCurrent == NULLHANDLE) 533 { 775 {//if none, then create one 534 776 lMode = CRGN_COPY; 535 777 RECTL rectl = {0, 0, 1, 1}; … … 554 796 { 555 797 HRGN hrgnOld; 556 lComplexity = GpiSetClipRegion(pHps->hps, hrgnCurrent, &hrgnOld); 798 799 //Intersect the Windows clip region with the current visible region 800 lComplexity = GdiCombineVisRgnClipRgn(pHps, hrgnCurrent, RGN_AND_W); 801 557 802 SetLastError(ERROR_SUCCESS_W); 558 803 559 //SvL: Must check if origin changed here. Sometimes happens when 560 // window looses focus. (don't know why....) 561 checkOrigin(pHps); 562 563 if (lComplexity != RGN_ERROR) 804 if (lComplexity != RGN_ERROR) { 564 805 return lComplexity; 565 } 566 SetLastError(ERROR_SUCCESS_W); 806 } 807 } 808 GpiDestroyRegion(pHps->hps, hrgnCurrent); //delete newly created region 809 810 SetLastError(ERROR_INVALID_PARAMETER_W); //TODO 567 811 return ERROR_W; 568 812 } 569 813 //****************************************************************************** 814 //****************************************************************************** 815 int WIN32API SelectClipRgn(HDC hdc, HRGN hrgn) 816 { 817 return ExtSelectClipRgn(hdc, hrgn, RGN_COPY_W); 818 } 819 //****************************************************************************** 820 // The GetClipBox function retrieves the dimensions of the tightest bounding 821 // rectangle that can be drawn around the current visible area on the device. 822 // The visible area is defined by the current clipping region or clip path, as well 823 // as any overlapping windows. 824 // 825 // NOTE: We simply call GpiQueryClipBox as it behaves just like GetClipBox 826 // 570 827 //****************************************************************************** 571 828 int WIN32API GetClipBox(HDC hdc, PRECT lpRect) … … 583 840 if(pHps->isPrinter) 584 841 { 842 //Some printers return the wrong clip box. Return the full page instead. 843 //(TODO: which is incorrect!) 585 844 lpRect->left = 0; 586 845 lpRect->top = 0; … … 608 867 //Convert coordinates from PM to win32 609 868 if (pHps->yInvert > 0) { 610 LONG temp = pHps->yInvert - rectl.yBottom;611 612 rectl.yTop = temp;869 LONG temp = pHps->yInvert - rectl.yBottom; 870 rectl.yBottom = pHps->yInvert - rectl.yTop; 871 rectl.yTop = temp; 613 872 } 614 873 #endif … … 628 887 } 629 888 630 rc = (lComplexity == RGN_RECT) ? SIMPLEREGION_W : COMPLEXREGION_W;889 rc = GPI_TO_WIN_COMPLEXITY(lComplexity); 631 890 } 632 891 } … … 655 914 } 656 915 657 if(GpiSetClipRegion(pHps->hps, NULL, &hrgnClip) == RGN_ERROR) { 658 dprintf(("WARNING: GetClipRgn GpiSetClipRegion failed! (%x)", WinGetLastError(0))); 659 SetLastError(ERROR_INVALID_PARAMETER_W); //todo right errror 660 return 0; 661 } 662 if(hrgnClip) { 663 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgnClip, pHps, NULL)) { 664 dprintf(("WARNING: GetClipRgn setWinDeviceRegionFromPMDeviceRegion failed!")); 665 GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnTemp); 666 SetLastError(ERROR_INVALID_PARAMETER_W); //todo right errror 667 return 0; 668 } 669 if(GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnTemp) == RGN_ERROR ) 670 { 671 dprintf(("WARNING: GetClipRgn GpiSetClipRegion failed %x!", WinGetLastError(0))); 916 if(pHps->hrgnWin32Clip) { 917 dprintfRegion(hdc, pHps->hrgnWin32Clip); 918 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, pHps->hrgnWin32Clip, pHps, NULL)) { 919 dprintf(("WARNING: GetClipRgn setWinDeviceRegionFromPMDeviceRegion failed!")); 920 GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnTemp); 672 921 SetLastError(ERROR_INVALID_PARAMETER_W); //todo right errror 673 922 return 0; 674 923 } 675 924 } 676 else lComplexity = RGN_NULL; 925 else { 926 //no clip region; return NULL 927 lComplexity = RGN_NULL; 928 } 677 929 678 930 SetLastError(ERROR_SUCCESS_W); … … 682 934 } 683 935 //****************************************************************************** 936 // The GetRandomRgn function copies the system clipping region of a specified 937 // device context to a specific region. 938 // It returns the visible region of the specified device context in screen 939 // coordinates (if it belongs to a window). 940 // 941 // VALUE = 1: This undocumented value will return the current Clip Region contained in the DC. 942 // VALUE = 2: This undocumented value will return the current Meta Region contained in the DC. 943 // VALUE = 3: This undocumented value will return the intersection of the Clip Region and Meta Region. 944 // VALUE = 4, SYSRGN: The only value that is documented and defined for this function. 945 // This value returns the System Region 946 //****************************************************************************** 947 INT WIN32API GetRandomRgn(HDC hdc, HRGN hrgn, INT iNum) 948 { 949 HWND hwnd; 950 INT ret; 951 952 if(iNum != SYSRGN_W) { 953 dprintf(("WARNING: GetRandomRgn: invalid parameter %x", iNum)); 954 SetLastError(ERROR_INVALID_PARAMETER_W); 955 return ERROR_W; 956 } 957 ret = GetClipRgn(hdc, hrgn); 958 959 hwnd = WindowFromDC(hdc); 960 if(hwnd) { 961 POINT pt = {0,0}; 962 //map from client to desktop coordinates 963 MapWindowPoints(hwnd, 0, &pt, 1); 964 965 OffsetRgn(hrgn, pt.x, pt.y); 966 } 967 return ret; 968 } 969 //****************************************************************************** 684 970 //****************************************************************************** 685 971 int WIN32API ExcludeClipRect(HDC hdc, int left, int top, int right, int bottom) … … 688 974 if(!pHps) 689 975 { 690 dprintf((" WARNING: ExcludeClipRgn %x (%d,%d)(%d,%d) invalid hdc", hdc, left, top, right, bottom));976 dprintf(("ERROR: ExcludeClipRgn %x (%d,%d)(%d,%d) invalid hdc", hdc, left, top, right, bottom)); 691 977 SetLastError(ERROR_INVALID_HANDLE_W); 692 978 return ERROR_W; … … 712 998 713 999 dprintf(("ExcludeClipRgn %x (%d,%d)(%d,%d)", hdc, left, top, right, bottom)); 1000 714 1001 lComplexity = GpiExcludeClipRectangle(pHps->hps, &rectl); 715 1002 if (lComplexity == RGN_ERROR) { 1003 dprintf(("ERROR: ExcludeClipRgn: GpiExcludeClipRectangle failed!!")); 716 1004 SetLastError(ERROR_INVALID_PARAMETER_W); //TODO: wrong error 717 1005 return ERROR_W; 1006 } 1007 1008 //Ok, success. Now update the cached win32 clip region 1009 if(pHps->hrgnWin32Clip != NULLHANDLE) 1010 { 1011 HRGN hrgnClipRect = GpiCreateRegion(pHps->hps, 1, &rectl); 1012 if(hrgnClipRect == NULLHANDLE) { 1013 dprintf(("ERROR: ExcludeClipRgn GpiCreateRegion failed!!")); 1014 DebugInt3(); 1015 SetLastError(ERROR_INVALID_PARAMETER_W); //TODO: wrong error 1016 return ERROR_W; 1017 } 1018 //subtract rect region from clip region 1019 lComplexity = GpiCombineRegion(pHps->hps, pHps->hrgnWin32Clip, pHps->hrgnWin32Clip, hrgnClipRect, CRGN_DIFF); 1020 GpiDestroyRegion(pHps->hps, hrgnClipRect); 1021 1022 if (lComplexity == RGN_ERROR) { 1023 dprintf(("ERROR: ExcludeClipRgn GpiCombineRegion failed!!")); 1024 DebugInt3(); 1025 SetLastError(ERROR_INVALID_PARAMETER_W); //TODO: wrong error 1026 return ERROR_W; 1027 } 718 1028 } 719 1029 … … 756 1066 dprintf(("IntersectClipRect %x (%d,%d)(%d,%d)", hdc, left, top, right, bottom)); 757 1067 lComplexity = GpiIntersectClipRectangle(pHps->hps, &rectl); 1068 if (lComplexity == RGN_ERROR) { 1069 dprintf(("ERROR: IntersectClipRect: GpiIntersectClipRectangle failed!!")); 1070 SetLastError(ERROR_INVALID_PARAMETER_W); //TODO: wrong error 1071 return ERROR_W; 1072 } 1073 1074 //Ok, success. Now update the cached win32 clip region 1075 if(pHps->hrgnWin32Clip != NULLHANDLE) 1076 { 1077 HRGN hrgnClipRect = GpiCreateRegion(pHps->hps, 1, &rectl); 1078 if(hrgnClipRect == NULLHANDLE) { 1079 dprintf(("ERROR: IntersectClipRect GpiCreateRegion failed!!")); 1080 DebugInt3(); 1081 SetLastError(ERROR_INVALID_PARAMETER_W); //TODO: wrong error 1082 return ERROR_W; 1083 } 1084 //intersect rect region with clip region 1085 lComplexity = GpiCombineRegion(pHps->hps, pHps->hrgnWin32Clip, pHps->hrgnWin32Clip, hrgnClipRect, CRGN_AND); 1086 GpiDestroyRegion(pHps->hps, hrgnClipRect); 1087 1088 if (lComplexity == RGN_ERROR) { 1089 dprintf(("ERROR: IntersectClipRect GpiCombineRegion failed!!")); 1090 DebugInt3(); 1091 SetLastError(ERROR_INVALID_PARAMETER_W); //TODO: wrong error 1092 return ERROR_W; 1093 } 1094 } 758 1095 759 1096 //todo metafile recording … … 784 1121 #endif 785 1122 786 lComplexity = GpiOffsetClipRegion(pHps->hps, &pointl); 1123 if(pHps->hrgnWin32Clip == NULLHANDLE) { 1124 lComplexity = NULLREGION_W; 1125 } 1126 else { 1127 lComplexity = GpiOffsetRegion(pHps->hps, pHps->hrgnWin32Clip, &pointl); 1128 if (lComplexity == RGN_ERROR) { 1129 dprintf(("ERROR: OffsetClipRgn: GpiOffsetRegion failed!!")); 1130 SetLastError(ERROR_INVALID_PARAMETER_W); //TODO: wrong error 1131 return ERROR_W; 1132 } 1133 1134 //Intersect the Windows clip region with the current visible region 1135 lComplexity = GdiCombineVisRgnClipRgn(pHps, pHps->hrgnWin32Clip, RGN_AND_W); 1136 1137 lComplexity = GPI_TO_WIN_COMPLEXITY(lComplexity); 1138 } 787 1139 788 1140 //todo metafile recording … … 1038 1390 dprintf(("CreateEllipticRgn (%d,%d)(%d,%d)", left, top, right, bottom)); 1039 1391 hrgn = GpiCreateEllipticRegion(hpsRegion, &rectl); 1392 if(hrgn == RGN_ERROR) { 1393 SetLastError(ERROR_INVALID_PARAMETER_W); //todo: not right 1394 dprintf(("WARNING: CreateEllipticRgn: GpiCreateEllipticRegion failed! %x", WinGetLastError(0))); 1395 return 0; 1396 } 1040 1397 1041 1398 if(ObjAllocateHandle(&hrgn, hrgn, HNDL_REGION) == FALSE) { … … 1086 1443 polygon.aPointl = (PPOINTL)(lppt + 1); 1087 1444 1445 #ifdef DEBUG 1446 for(int i=0;i<cPoints;i++) { 1447 dprintf(("Point %d: (%d,%d)", i, lppt[i].x, lppt[i].y)); 1448 } 1449 #endif 1088 1450 GpiMove(hpsRegion, (PPOINTL)lppt); 1089 1451 hrgn = GpiCreatePolygonRegion(hpsRegion, 1, &polygon, POLYGON_BOUNDARY | flMode); 1452 if(hrgn == RGN_ERROR) { 1453 SetLastError(ERROR_INVALID_PARAMETER_W); //todo: not right 1454 dprintf(("WARNING: CreatePolygonRgn: GpiCreatePolygonRegion failed! %x", WinGetLastError(0))); 1455 return 0; 1456 } 1090 1457 1091 1458 if(ObjAllocateHandle(&hrgn, hrgn, HNDL_REGION) == FALSE) { … … 1284 1651 dprintf(("WARNING: GetRgnBox %x %x invalid region!", hrgn1, pRect)); 1285 1652 SetLastError(ERROR_INVALID_HANDLE_W); 1286 return FALSE;1653 return ERROR_W; 1287 1654 } 1288 1655 … … 1356 1723 } 1357 1724 1725 DIBSECTION_MARK_INVALID(hdc); 1358 1726 return TRUE; 1359 1727 } … … 1448 1816 SelectObject(hdc, hbrushRestore); 1449 1817 1818 if(lHits != GPI_ERROR) 1819 DIBSECTION_MARK_INVALID(hdc); 1820 1450 1821 //todo metafile recording 1451 1822 return (lHits != GPI_ERROR); … … 1458 1829 HBRUSH hbrushRestore = 0; 1459 1830 #ifdef DEBUG 1460 HRGN hrgn1 = hrgn;1831 HRGN hrgn1 = hrgn; 1461 1832 #endif 1462 1463 1833 1464 1834 pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc); … … 1483 1853 dprintf(("FillRgn %x %x %x", hdc, hrgn1, hBrush)); 1484 1854 1855 DIBSECTION_CHECK_IF_DIRTY(hdc); 1485 1856 interpretRegionAs(pHps, NULL, hrgn, AS_WORLD); 1486 1857 … … 1495 1866 SelectObject(hdc, hbrushRestore); 1496 1867 1497 /* PF Sync DIBSection as well */ 1498 if(DIBSection::getSection() != NULL) 1499 { 1500 DIBSection *dsect = DIBSection::findHDC(hdc); 1501 if(dsect) 1502 { 1503 dsect->sync(hdc, 0, dsect->GetHeight()); 1504 } 1505 } 1506 1868 if(success) 1869 DIBSECTION_MARK_INVALID(hdc); 1507 1870 1508 1871 return(success); … … 1512 1875 BOOL WIN32API PaintRgn( HDC hdc, HRGN hrgn) 1513 1876 { 1514 pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc); 1515 if(!pHps) 1516 { 1517 SetLastError(ERROR_INVALID_HANDLE_W); 1518 return FALSE; 1519 } 1520 1521 return FillRgn(hdc, hrgn, (HBRUSH) pHps->lastBrushKey); 1877 return FillRgn(hdc, hrgn, (HBRUSH) GetCurrentObject(hdc, OBJ_BRUSH_W)); 1522 1878 } 1523 1879 //****************************************************************************** -
trunk/src/user32/USER32.DEF
r10256 r10316 1 ; $Id: USER32.DEF,v 1.8 1 2003-10-02 10:35:59sandervl Exp $1 ; $Id: USER32.DEF,v 1.82 2003-11-12 14:10:18 sandervl Exp $ 2 2 3 3 LIBRARY USER32 INITINSTANCE TERMINSTANCE … … 642 642 SetWinEventHook = _SetWinEventHook@28 @608 643 643 644 GetAncestor = _GetAncestor@8 @609 645 GetWindowModuleFileNameA = _GetWindowModuleFileNameA@12 @610 646 644 647 ;------------ 645 648 ; Windows 98 -
trunk/src/user32/dbgwrap.cpp
r10190 r10316 698 698 DEBUGWRAP0(GetForegroundWindow) 699 699 DEBUGWRAP4(GetLastActivePopup) 700 DEBUGWRAP12(GetWindowModuleFileNameA) 700 701 DEBUGWRAP8(GetNextQueueWindow) 701 702 DEBUGWRAP4(GetParent) 702 703 DEBUGWRAP4(GetTopWindow) 703 704 DEBUGWRAP8(GetWindow) 705 DEBUGWRAP8(GetAncestor) 704 706 DEBUGWRAP4(GetWindowContextHelpId) 705 707 DEBUGWRAP8(GetWindowRect) … … 754 756 DEBUGWRAP4(GetDC) 755 757 DEBUGWRAP12(GetDCEx) 756 DEBUGWRAP12(FillRect)757 DEBUGWRAP12(FrameRect)758 758 DEBUGWRAP4(GetWindowDC) 759 759 DEBUGWRAP8(ReleaseDC) … … 764 764 DEBUGWRAP12(InvalidateRect) 765 765 DEBUGWRAP12(InvalidateRgn) 766 DEBUGWRAP8(InvertRect)767 766 DEBUGWRAP8(ValidateRect) 768 767 DEBUGWRAP8(ValidateRgn) -
trunk/src/user32/dc.cpp
r10093 r10316 1 /* $Id: dc.cpp,v 1.12 1 2003-05-15 13:12:52sandervl Exp $ */1 /* $Id: dc.cpp,v 1.122 2003-11-12 14:10:18 sandervl Exp $ */ 2 2 3 3 /* … … 594 594 HDC hdc; 595 595 HPS hps; 596 HRGN hrgnUpdate , hrgnOld, hrgnClip, hrgnCombined;596 HRGN hrgnUpdate; 597 597 RECTL rectl = { 1, 1, 2, 2 }; 598 pDCData pHps = NULLHANDLE; 598 599 599 600 hwnd = wnd->getOS2WindowHandle(); … … 602 603 hrgnUpdate = GpiCreateRegion (hps, 1, &rectl); 603 604 WinQueryUpdateRegion (hwnd, hrgnUpdate); 604 hrgnClip = GpiQueryClipRegion (hps);605 606 if (hrgnClip == NULLHANDLE)607 {608 GpiSetClipRegion (hps, hrgnUpdate, &hrgnOld);609 }610 else611 {612 hrgnCombined = GpiCreateRegion (hps, 1, &rectl);613 GpiCombineRegion (hps, hrgnCombined, hrgnClip, hrgnUpdate, CRGN_AND);614 GpiSetClipRegion (hps, hrgnCombined, &hrgnOld);615 GpiDestroyRegion (hps, hrgnUpdate);616 GpiDestroyRegion (hps, hrgnClip);617 }618 if (hrgnOld != NULLHANDLE)619 GpiDestroyRegion (hps, hrgnOld);620 605 621 606 hdc = HPSToHDC (hwnd, hps, NULL, NULL); 607 608 pHps = (pDCData)GpiQueryDCData(hps); 609 GdiSetVisRgn(pHps, hrgnUpdate); 622 610 623 611 erased = wnd->MsgEraseBackGround (hdc); … … 676 664 return (HDC)0; 677 665 } 678 // bIcon = (IsIconic(hwnd) && GetClassLongA(hWnd, GCL_HICON_W));679 666 bIcon = IsIconic(hwnd); 680 667 … … 725 712 } 726 713 727 HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectl); 728 GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip); 714 //save old clip and visible regions (restored for CS_OWNDC windows in EndPaint) 715 dprintf(("Old visible region %x; old clip region %x", pHps->hrgnWinVis, pHps->hrgnWin32Clip)); 716 wnd->SaveClipRegion(pHps->hrgnWin32Clip); 717 wnd->SaveVisRegion(pHps->hrgnWinVis); 718 719 //clear visible and clip regions 720 pHps->hrgnWin32Clip = NULLHANDLE; 721 pHps->hrgnWinVis = NULLHANDLE; 722 723 HRGN hrgnVis = GpiCreateRegion(pHps->hps, 1, &rectl); 724 GdiSetVisRgn(pHps, hrgnVis); 729 725 730 726 selectClientArea(wnd, pHps); 731 727 732 //save old clip region (restored for CS_OWNDC windows in EndPaint)733 wnd->SetClipRegion(hrgnOldClip);734 728 if(bIcon) { 735 729 lComplexity = RGN_RECT; … … 742 736 743 737 //Query update region 744 HRGN hrgn Clip= GpiCreateRegion(pHps->hps, 1, &rectlClip);745 WinQueryUpdateRegion(hwndClient, hrgn Clip);746 WinValidateRegion(hwndClient, hrgn Clip, FALSE);747 748 dprintfRegion(pHps->hps, wnd->getWindowHandle(), hrgn Clip);738 HRGN hrgnVis = GpiCreateRegion(pHps->hps, 1, &rectlClip); 739 WinQueryUpdateRegion(hwndClient, hrgnVis); 740 WinValidateRegion(hwndClient, hrgnVis, FALSE); 741 742 dprintfRegion(pHps->hps, wnd->getWindowHandle(), hrgnVis); 749 743 750 744 #ifdef DEBUG … … 754 748 #endif 755 749 750 //save old clip and visible regions (restored for CS_OWNDC windows in EndPaint) 751 dprintf(("Old visible region %x; old clip region %x", pHps->hrgnWinVis, pHps->hrgnWin32Clip)); 752 wnd->SaveClipRegion(pHps->hrgnWin32Clip); 753 wnd->SaveVisRegion(pHps->hrgnWinVis); 754 755 //clear visible and clip regions 756 pHps->hrgnWin32Clip = NULLHANDLE; 757 pHps->hrgnWinVis = NULLHANDLE; 758 756 759 //set clip region 757 lComplexity = G piSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);758 759 if(lComplexity == RGN_NULL) {760 lComplexity = GdiSetVisRgn(pHps, hrgnVis); 761 762 if(lComplexity == NULLREGION_W) { 760 763 dprintf (("BeginPaint %x: EMPTY update rectangle (vis=%d/%d show=%d/%d", hWnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()), WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle()))); 761 764 } … … 769 772 dprintf(("ClipBox (%d): (%d,%d)(%d,%d)", lComplexity, rectlClip.xLeft, rectlClip.yBottom, rectlClip.xRight, rectlClip.yTop)); 770 773 #endif 771 //save old clip region (restored for CS_OWNDC windows in EndPaint)772 wnd->SetClipRegion(hrgnOldClip);773 774 } 774 775 … … 783 784 WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE); 784 785 785 if((wnd->needsEraseBkgnd() || wnd-> IsVisibleRegionChanged()) && lComplexity != RGN_NULL) {786 wnd->setEraseBkgnd(FALSE);787 wnd->SetVisibleRegionChanged(FALSE);788 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) == 0);786 if((wnd->needsEraseBkgnd() || wnd->hasPMUpdateRegionChanged()) && lComplexity != RGN_NULL) { 787 wnd->setEraseBkgnd(FALSE); 788 wnd->SetPMUpdateRegionChanged(FALSE); 789 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) == 0); 789 790 } 790 791 else lpps->fErase = TRUE; … … 817 818 { 818 819 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP; 819 HRGN hrgnOld;820 820 pDCData pHps; 821 821 … … 832 832 if (pHps && (pHps->hdcType == TYPE_3)) 833 833 { 834 GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld); 835 wnd->SetClipRegion(0); 836 if(hrgnOld) { 837 GpiDestroyRegion(pHps->hps, hrgnOld); 838 } 834 //restore previous visible and clip regions 835 pHps->hrgnWin32Clip = NULLHANDLE; 836 pHps->hrgnWinVis = NULLHANDLE; 837 838 GdiSetVisRgn(pHps, wnd->GetVisRegion()); 839 GdiCombineVisRgnClipRgn(pHps, wnd->GetClipRegion(), RGN_AND_W); 840 841 wnd->SaveClipRegion(0); 842 wnd->SaveVisRegion(0); 843 839 844 pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails 840 845 ReleaseDC(hwnd, pPaint->hdc); … … 879 884 if(pHps && pHps->psType == MICRO_CACHED) { 880 885 removeClientArea(wnd, pHps); 881 if(pHps->hrgnVis) { 882 GreDestroyRegion(pHps->hps, pHps->hrgnVis); 883 pHps->hrgnVis = 0; 886 if(pHps->hrgnWinVis) { 887 GreDestroyRegion(pHps->hps, pHps->hrgnWinVis); 888 pHps->hrgnWinVis = 0; 889 } 890 if(pHps->hrgnWin32Clip) { 891 GreDestroyRegion(pHps->hps, pHps->hrgnWin32Clip); 892 pHps->hrgnWin32Clip = 0; 884 893 } 885 894 } … … 912 921 } 913 922 //****************************************************************************** 914 // This implementation of GetDCEx supports 923 // This implementation of GetDCEx supports: 924 // 915 925 // DCX_WINDOW 916 926 // DCX_CACHE … … 922 932 // DCX_PARENTCLIP 923 933 // 934 // Not supported: 935 // 936 // DCX_NORESETATTRS_W 937 // DCX_INTERSECTUPDATE_W 938 // DCX_LOCKWINDOWUPDATE_W 939 // DCX_VALIDATE_W 940 // DCX_EXCLUDEUPDATE_W 941 // 924 942 //TODO: WM_SETREDRAW affects drawingAllowed flag!! 925 943 //****************************************************************************** … … 935 953 BOOL creatingOwnDC = FALSE; 936 954 PS_Type psType; 955 956 if(flags & (DCX_NORESETATTRS_W | DCX_INTERSECTUPDATE_W | DCX_LOCKWINDOWUPDATE_W | DCX_VALIDATE_W | DCX_EXCLUDEUPDATE_W)) { 957 dprintf(("ERROR: GetDCEx: unsupported flags %x!!", flags)); 958 DebugInt3(); 959 } 937 960 938 961 if(hwnd == 0) { … … 1066 1089 success = TRUE; 1067 1090 if (flags & DCX_EXCLUDERGN_W) 1068 { 1069 #if 0 //CB: todo 1070 long height; 1071 1072 BytesNeeded = GetRegionData (hrgn, 0, NULL); 1073 RgnData = (PRGNDATA_W)_alloca (BytesNeeded); 1074 if (RgnData == NULL) 1075 goto error; 1076 GetRegionData (hrgn, BytesNeeded, RgnData); 1077 1078 i = RgnData->rdh.nCount; 1079 pr = (PRECT)(RgnData->Buffer); 1080 1081 if (flags & DCX_WINDOW_W) 1082 height = wnd->getWindowHeight(); 1083 else height = wnd->getClientHeight(); 1084 1085 for (; (i > 0) && success; i--, pr++) { 1086 LONG y = pr->yBottom; 1087 1088 pr->yBottom = height - pr->yTop; 1089 pr->yTop = height - y; 1090 success &= GpiExcludeClipRectangle (pHps->hps, pr); 1091 } 1092 #endif 1091 {//exclude specified region from visible region 1092 success = (GdiCombineVisRgn(pHps, hrgn, RGN_DIFF_W) != ERROR_W); 1093 1093 } 1094 1094 else //DCX_INTERSECTRGN_W 1095 { 1096 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx 1097 // with a region that covers the entire window (RealPlayer 7 Update 1) 1098 // Using SelectClipRgn here doesn't make any difference. 1099 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) { 1100 dprintf(("ExtSelectClipRgn failed!!")); 1101 } 1095 {//intersect visible region with specified region 1096 success = (GdiCombineVisRgn(pHps, hrgn, RGN_AND_W) != ERROR_W); 1102 1097 } 1103 1098 if (!success) … … 1292 1287 //already (partly) invalidated 1293 1288 if (!WinQueryUpdateRect (hwnd, NULL)) { 1289 dprintf(("RDW_INVALIDATE: no update rectangle, disable %x WM_ERASEBKGND", wnd->getWindowHandle())); 1294 1290 wnd->setEraseBkgnd(FALSE); 1295 1291 } … … 1332 1328 else if (redraw & RDW_VALIDATE_W) 1333 1329 { 1334 if (redraw & RDW_NOERASE_W) 1330 if (redraw & RDW_NOERASE_W) { 1331 dprintf(("RDW_NOERASE: disable %x WM_ERASEBKGND", wnd->getWindowHandle())); 1335 1332 wnd->setEraseBkgnd(FALSE); 1336 1333 } 1337 1334 if (WinQueryUpdateRect (hwnd, NULL)) 1338 1335 { -
trunk/src/user32/dc.h
r5685 r10316 1 /* $Id: dc.h,v 1.1 7 2001-05-11 08:39:42sandervl Exp $ */1 /* $Id: dc.h,v 1.18 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 /* 3 3 * public dc functions … … 22 22 BOOL GetOS2UpdateRect(Win32BaseWindow *window,LPRECT pRect); 23 23 24 int WIN32API GetUpdateRgnFrame(HWND hwnd, HRGN hrgn); 25 24 26 #ifdef DEBUG 25 27 void dprintfOrigin(HDC hdc); … … 30 32 #ifdef INCLUDED_BY_DC 31 33 /*********************/ 32 typedef struct33 {34 HDC hdc;35 BOOL fErase;36 RECT rcPaint;37 BOOL fRestore;38 BOOL IncUpdate;39 BYTE rgbReserved[32];40 } PAINTSTRUCT_W, *PPAINTSTRUCT_W, *LPPAINTSTRUCT_W;41 42 #define PS_SOLID_W 0x0000000043 #define PS_DASH_W 0x0000000144 #define PS_DOT_W 0x0000000245 #define PS_DASHDOT_W 0x0000000346 #define PS_DASHDOTDOT_W 0x0000000447 #define PS_NULL_W 0x0000000548 #define PS_INSIDEFRAME_W 0x0000000649 #define PS_USERSTYLE_W 0x0000000750 #define PS_ALTERNATE_W 0x0000000851 #define PS_STYLE_MASK_W 0x0000000f52 53 typedef struct54 {55 UINT lopnStyle;56 POINT lopnWidth;57 ULONG lopnColor;58 } LOGPEN_W, *LPLOGPEN_W;59 60 typedef struct tagEXTLOGPEN61 {62 DWORD elpPenStyle;63 DWORD elpWidth;64 DWORD elpBrushStyle;65 DWORD elpColor;66 DWORD elpNumEntries;67 DWORD elpStyleEntry[1];68 } EXTLOGPEN_W, *PEXTLOGPEN_W, *NPEXTLOGPEN_W, *LPEXTLOGPEN_W;69 70 typedef struct71 {72 UINT lbStyle;73 ULONG lbColor;74 INT lbHatch;75 } LOGBRUSH_W, *LPLOGBRUSH_W;76 34 77 35 typedef struct _penobject … … 90 48 } tPenObject, *pPenObject; 91 49 92 /* DC Graphics Mode */93 #define GM_COMPATIBLE_W 194 #define GM_ADVANCED_W 295 96 #define DCX_WINDOW_W 0x00000001L97 #define DCX_CACHE_W 0x00000002L98 #define DCX_NORESETATTRS_W 0x00000004L99 #define DCX_CLIPCHILDREN_W 0x00000008L100 #define DCX_CLIPSIBLINGS_W 0x00000010L101 #define DCX_PARENTCLIP_W 0x00000020L102 #define DCX_EXCLUDERGN_W 0x00000040L103 #define DCX_INTERSECTRGN_W 0x00000080L104 #define DCX_EXCLUDEUPDATE_W 0x00000100L105 #define DCX_INTERSECTUPDATE_W 0x00000200L106 #define DCX_LOCKWINDOWUPDATE_W 0x00000400L107 #define DCX_USESTYLE_W 0x00010000L108 #define DCX_VALIDATE_W 0x00200000L109 110 #define RDW_INVALIDATE_W 0x0001111 #define RDW_INTERNALPAINT_W 0x0002112 #define RDW_ERASE_W 0x0004113 #define RDW_VALIDATE_W 0x0008114 #define RDW_NOINTERNALPAINT_W 0x0010115 #define RDW_NOERASE_W 0x0020116 #define RDW_NOCHILDREN_W 0x0040117 #define RDW_ALLCHILDREN_W 0x0080118 #define RDW_UPDATENOW_W 0x0100119 #define RDW_ERASENOW_W 0x0200120 #define RDW_FRAME_W 0x0400121 #define RDW_NOFRAME_W 0x0800122 /* Xform FLAGS */123 #define MWT_IDENTITY_W 1124 #define MWT_LEFTMULTIPLY_W 2125 #define MWT_RIGHTMULTIPLY_W 3126 127 /* Mapping Modes */128 #define MM_TEXT_W 1129 #define MM_LOMETRIC_W 2130 #define MM_HIMETRIC_W 3131 #define MM_LOENGLISH_W 4132 #define MM_HIENGLISH_W 5133 #define MM_TWIPS_W 6134 #define MM_ISOTROPIC_W 7135 #define MM_ANISOTROPIC_W 8136 137 #define RGN_OR_W 2138 139 /* Window scrolling */140 #define SW_SCROLLCHILDREN_W 0x0001141 #define SW_INVALIDATE_W 0x0002142 #define SW_ERASE_W 0x0004143 #define SW_SMOOTHSCROLL_W 0x0010144 50 145 51 /*********************/ -
trunk/src/user32/dcrgn.cpp
r9933 r10316 1 /* $Id: dcrgn.cpp,v 1. 8 2003-03-22 20:27:11sandervl Exp $ */1 /* $Id: dcrgn.cpp,v 1.9 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 3 3 /* … … 42 42 #include "dbglocal.h" 43 43 44 #ifdef DEBUG 45 //#define dprintfRegion(a,b,c) if(DbgEnabledLvl2USER32[DBG_LOCALLOG] == 1) dprintfRegion1(a,b,c) 46 //#define dprintfRegion(a,b,c) dprintfRegion1(a,b,c) 47 48 static void dprintfRegion(HWND hWnd, HRGN hrgnClip) 49 { 50 RGNRECT rgnRect = {0, 16, 0, RECTDIR_LFRT_TOPBOT}; 51 RECTL rectRegion[16]; 52 APIRET rc; 53 HDC hdc; 54 55 hdc = GetDCEx(hWnd, NULL, DCX_CACHE_W|DCX_USESTYLE_W); 56 dprintf(("dprintfRegion %x %x", hWnd, hdc)); 57 rc = GpiQueryRegionRects(hdc, hrgnClip, NULL, &rgnRect, &rectRegion[0]); 58 for(int i=0;i<rgnRect.crcReturned;i++) { 59 dprintf(("(%d,%d)(%d,%d)", rectRegion[i].xLeft, rectRegion[i].yBottom, rectRegion[i].xRight, rectRegion[i].yTop)); 60 } 61 ReleaseDC(hWnd, hdc); 62 } 63 #else 64 #define dprintfRegion(b,c) 65 #endif 66 44 67 //****************************************************************************** 45 68 //****************************************************************************** … … 134 157 if(lComplexity != RGN_NULL) 135 158 { 159 dprintfRegion(hwnd, hrgn); 136 160 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle())) 137 161 { … … 142 166 } 143 167 if(erase) sendEraseBkgnd(wnd); 168 } 169 RELEASE_WNDOBJ(wnd); 170 return lComplexity; 171 } 172 //****************************************************************************** 173 //TODO: Seems to return region in window coordinates instead of client coordinates 174 //****************************************************************************** 175 int WIN32API GetUpdateRgnFrame(HWND hwnd, HRGN hrgn) 176 { 177 LONG lComplexity; 178 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 179 180 hrgn = ObjWinToOS2Region(hrgn); 181 if(!wnd || !hrgn) 182 { 183 dprintf(("WARNING: GetUpdateRgnFrame %x %x invalid handle", hwnd, hrgn)); 184 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 185 if(wnd) RELEASE_WNDOBJ(wnd); 186 return ERROR_W; 187 } 188 lComplexity = WinQueryUpdateRegion(wnd->getOS2FrameWindowHandle(), hrgn); 189 if(lComplexity == RGN_ERROR) { 190 dprintf(("WARNING: GetUpdateRgnFrame %x %x RGN_ERROR", hwnd, hrgn)); 191 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 192 RELEASE_WNDOBJ(wnd); 193 return ERROR_W; 194 } 195 196 if(lComplexity != RGN_NULL) 197 { 198 dprintfRegion(hwnd, hrgn); 199 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2FrameWindowHandle())) 200 { 201 dprintf(("WARNING: GetUpdateRgnFrame %x %x; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn)); 202 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 203 RELEASE_WNDOBJ(wnd); 204 return ERROR_W; 205 } 144 206 } 145 207 RELEASE_WNDOBJ(wnd); -
trunk/src/user32/inituser32.cpp
r10284 r10316 1 /* $Id: inituser32.cpp,v 1.1 6 2003-10-22 12:43:13sandervl Exp $ */1 /* $Id: inituser32.cpp,v 1.17 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 /* 3 3 * USER32 DLL entry point … … 71 71 extern INT __cdecl wsnprintfA(LPSTR,UINT,LPCSTR,...); 72 72 73 static char PMKBDHK_MODULE[16] = STD_PMKBDHK_MODULE;74 75 static BOOL pmkbdhk_installed = FALSE;76 static HMODULE hmodPMKBDHK;77 78 static PFN_HOOKINIT pfnHookInit = NULL;79 static PFN_HOOKTERM pfnHookTerm = NULL;80 81 // defined initialized in pmwindow.cpp: InitPM()82 extern HAB hab;83 84 //******************************************************************************85 //******************************************************************************86 void WIN32API SetCustomPMHookDll(LPSTR pszKbdDllName)87 {88 strcpy(PMKBDHK_MODULE, pszKbdDllName);89 }90 //******************************************************************************91 //******************************************************************************92 void pmkbdhk_initialize(HAB _hab)93 {94 APIRET rc;95 96 if ((pmkbdhk_installed == FALSE) && PMKBDHK_MODULE[0])97 {98 CHAR szBuf[260];99 100 // load the DLL101 rc = DosLoadModule(szBuf,102 sizeof(szBuf),103 PMKBDHK_MODULE,104 &hmodPMKBDHK);105 if (NO_ERROR != rc)106 {107 dprintf(("USER32: pmkbdhk_initalize(%08xh) failed rc=%d\n",108 _hab,109 rc));110 111 return;112 }113 114 // get the entry points115 rc = DosQueryProcAddr(hmodPMKBDHK,116 0,117 PMKBDHK_HOOK_INIT,118 (PFN*)&pfnHookInit);119 if (NO_ERROR == rc)120 rc = DosQueryProcAddr(hmodPMKBDHK,121 0,122 PMKBDHK_HOOK_TERM,123 (PFN*)&pfnHookTerm);124 125 if (NO_ERROR != rc)126 {127 dprintf(("USER32: pmkbdhk_initalize(%08xh) failed importing functions, rc=%d\n",128 _hab,129 rc));130 131 // free the DLL again132 DosFreeModule(hmodPMKBDHK);133 hmodPMKBDHK = NULLHANDLE;134 135 return;136 }137 138 // now finally call the initializer function139 if(pfnHookInit(_hab, WIN32_STDCLASS) == FALSE) DebugInt3();140 141 // OK, hook is armed142 pmkbdhk_installed = TRUE;143 }144 }145 //******************************************************************************146 //******************************************************************************147 void pmkbdhk_terminate(void)148 {149 if (pmkbdhk_installed == TRUE)150 {151 // call the terminator function152 pfnHookTerm();153 154 // OK, hook is disarmed155 pmkbdhk_installed = FALSE;156 }157 158 // unload the dll159 if (NULLHANDLE != hmodPMKBDHK)160 {161 APIRET rc = DosFreeModule(hmodPMKBDHK);162 if (NO_ERROR != rc)163 {164 dprintf(("USER32: pmkbdhk_terminate() failed rc=%d\n",165 rc));166 167 hmodPMKBDHK = NULLHANDLE;168 }169 }170 }171 73 //****************************************************************************** 172 74 #define FONTSDIRECTORY "Fonts" … … 261 163 return 0UL; 262 164 263 // try to install the keyboard hook264 pmkbdhk_initialize(hab);265 266 165 InitializeWindowHandles(); 267 166 … … 298 197 { 299 198 dprintf(("user32 exit\n")); 300 301 // try to unistall the keyboard hook302 pmkbdhk_terminate();303 199 304 200 //SvL: Causes PM hangs on some (a lot?) machines. Reason unknown. -
trunk/src/user32/pmwindow.cpp
r10285 r10316 1 /* $Id: pmwindow.cpp,v 1.22 3 2003-10-22 12:43:51sandervl Exp $ */1 /* $Id: pmwindow.cpp,v 1.224 2003-11-12 14:10:19 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Managment Code for OS/2 … … 59 59 #include "menu.h" 60 60 #include "user32api.h" 61 #include <kbdhook.h> 61 62 62 63 #define DBG_LOCALLOG DBG_pmwindow 63 64 #include "dbglocal.h" 64 65 66 65 67 #define ODIN_SetExceptionHandler(a) 66 68 #define ODIN_UnsetExceptionHandler(a) 67 68 69 69 70 // Notification that focus change has completed (UNDOCUMENTED) … … 84 85 BOOL fDragDropDisabled = FALSE; 85 86 86 const char WIN32_CDCLASS[] = "Win32CDWindowClass";87 char WIN32_STDCLASS[255] = "Win32WindowClass";87 const char WIN32_CDCLASS[] = ODIN_WIN32_CDCLASS; 88 char WIN32_STDCLASS[255] = ODIN_WIN32_STDCLASS; 88 89 89 90 #define PMMENU_MINBUTTON 0 … … 190 191 SetThreadMessageQueue(hmq); 191 192 193 //initialize keyboard hook for first thread 194 hookInit(hab); 195 192 196 BOOL rc = WinSetCp(hmq, GetDisplayCodepage()); 193 197 dprintf(("InitPM: WinSetCP was %sOK", rc ? "" : "not ")); … … 255 259 // query the font height to find out whether we have small or large fonts 256 260 DevQueryCaps(hdc, CAPS_GRAPHICS_CHAR_HEIGHT, 1, (PLONG)&CapsCharHeight); 261 dprintf(("CAPS_GRAPHICS_CHAR_HEIGHT = %d", CapsCharHeight)); 262 if(CapsCharHeight > 16) { 263 CapsCharHeight = 16; 264 } 265 266 #ifdef DEBUG 267 ULONG temp; 268 DevQueryCaps(hdc, CAPS_GRAPHICS_CHAR_WIDTH, 1, (PLONG)&temp); 269 dprintf(("CAPS_GRAPHICS_CHAR_WIDTH = %d", temp)); 270 DevQueryCaps(hdc, CAPS_CHAR_HEIGHT, 1, (PLONG)&temp); 271 dprintf(("CAPS_CHAR_HEIGTH = %d", temp)); 272 DevQueryCaps(hdc, CAPS_CHAR_WIDTH, 1, (PLONG)&temp); 273 dprintf(("CAPS_CHAR_WIDTH = %d", temp)); 274 DevQueryCaps(hdc, CAPS_SMALL_CHAR_HEIGHT, 1, (PLONG)&temp); 275 dprintf(("CAPS_SMALL_CHAR_HEIGTH = %d", temp)); 276 DevQueryCaps(hdc, CAPS_SMALL_CHAR_WIDTH, 1, (PLONG)&temp); 277 dprintf(("CAPS_SMALL_CHAR_WIDTH = %d", temp)); 278 DevQueryCaps(hdc, CAPS_VERTICAL_FONT_RES, 1,(PLONG)&temp); 279 dprintf(("CAPS_VERTICAL_FONT_RES = %d", temp)); 280 DevQueryCaps(hdc, CAPS_HORIZONTAL_FONT_RES, 1,(PLONG)&temp); 281 dprintf(("CAPS_HORIZONTAL_FONT_RES = %d", temp)); 282 #endif 257 283 258 284 DevCloseDC(hdc); 259 285 260 dprintf(("InitPM: Desktop (%d,%d) bpp %d ", ScreenWidth, ScreenHeight, ScreenBitsPerPel));286 dprintf(("InitPM: Desktop (%d,%d) bpp %d font size %d", ScreenWidth, ScreenHeight, ScreenBitsPerPel, CapsCharHeight)); 261 287 return TRUE; 262 288 } /* End of main */ … … 638 664 639 665 case WM_SHOW: 666 { 640 667 dprintf(("OS2: WM_SHOW %x %d", hwnd, mp1)); 641 668 win32wnd->MsgShow((ULONG)mp1); 642 break; 669 670 //if a child window is hidden, then the update region of the 671 //parent changes and a WM_ERASEBKGND is required during the next 672 //BeginPaint call. 673 if((ULONG)mp1 == FALSE) 674 { 675 Win32BaseWindow *parent = win32wnd->getParent(); 676 if(parent) { 677 dprintf(("PM Update region changed for parent %x", win32wnd->getWindowHandle())); 678 parent->SetPMUpdateRegionChanged(TRUE); 679 } 680 } 681 break; 682 } 643 683 644 684 case WM_ACTIVATE: … … 658 698 { 659 699 dprintf(("OS2: WM_SIZE (%d,%d) (%d,%d)", SHORT1FROMMP(mp2), SHORT2FROMMP(mp2), SHORT1FROMMP(mp1), SHORT2FROMMP(mp1))); 660 win32wnd->Set VisibleRegionChanged(TRUE);700 win32wnd->SetPMUpdateRegionChanged(TRUE); 661 701 goto RunDefWndProc; 662 702 } … … 1267 1307 case WM_PAINT: 1268 1308 { 1269 RECTL rectl; 1309 RECTL rectl; 1310 HRGN hrgn; 1311 1312 hrgn = CreateRectRgn(0, 0, 0, 0); 1313 GetUpdateRgnFrame(win32wnd->getWindowHandle(), hrgn); 1270 1314 1271 1315 HPS hps = WinBeginPaint(hwnd, NULL, &rectl); … … 1285 1329 1286 1330 mapOS2ToWin32Rect(win32wnd->getWindowHeight(), (PRECTLOS2)&rectl, &rectUpdate); 1287 win32wnd->MsgNCPaint(&rectUpdate );1331 win32wnd->MsgNCPaint(&rectUpdate, hrgn); 1288 1332 } 1289 1333 } 1290 1334 WinEndPaint(hps); 1335 1336 DeleteObject(hrgn); 1291 1337 break; 1292 1338 } … … 1599 1645 if ((pswp->fl & SWP_MAXIMIZE) && (win32wnd->getExStyle() & WS_EX_MDICHILD_W)) 1600 1646 { 1601 SendMessageA(win32wnd->getWindowHandle(), WM_SYSCOMMAND_W, SC_MAXIMIZE_W, 0);1602 goto PosChangedEnd;1647 SendMessageA(win32wnd->getWindowHandle(), WM_SYSCOMMAND_W, SC_MAXIMIZE_W, 0); 1648 goto PosChangedEnd; 1603 1649 } 1604 1650 … … 2478 2524 //****************************************************************************** 2479 2525 //****************************************************************************** 2526 char *WIN32API QueryCustomStdClassName() 2527 { 2528 return WIN32_STDCLASS; 2529 } 2530 //****************************************************************************** 2531 //****************************************************************************** 2480 2532 2481 2533 #ifdef DEBUG -
trunk/src/user32/user32.cpp
r10275 r10316 1 /* $Id: user32.cpp,v 1.1 29 2003-10-20 17:17:23sandervl Exp $ */1 /* $Id: user32.cpp,v 1.130 2003-11-12 14:10:20 sandervl Exp $ */ 2 2 3 3 /* … … 1144 1144 /* Filled Shape Functions */ 1145 1145 1146 /* Last COLOR id */ 1147 #define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION 1148 1149 int WIN32API FillRect(HDC hDC, const RECT * lprc, HBRUSH hbr) 1150 { 1151 //SvL: brush 0 means current selected brush (verified in NT4) 1152 if(hbr == 0) { 1153 hbr = GetCurrentObject(hDC, OBJ_BRUSH); 1154 } 1155 else 1156 if (hbr <= (HBRUSH) (COLOR_MAX + 1)) { 1157 hbr = GetSysColorBrush( (INT) hbr - 1 ); 1158 } 1159 dprintf(("USER32: FillRect %x (%d,%d)(%d,%d) brush %X", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom, hbr)); 1160 return O32_FillRect(hDC,lprc,hbr); 1161 } 1162 //****************************************************************************** 1163 //****************************************************************************** 1164 int WIN32API FrameRect( HDC hDC, const RECT * lprc, HBRUSH hbr) 1165 { 1166 dprintf(("USER32: FrameRect %x (%d,%d)(%d,%d) brush %x", hDC, lprc->top, lprc->left, lprc->bottom, lprc->right, hbr)); 1167 return O32_FrameRect(hDC,lprc,hbr); 1168 } 1169 //****************************************************************************** 1170 //****************************************************************************** 1171 BOOL WIN32API InvertRect( HDC hDC, const RECT * lprc) 1172 { 1173 if(lprc) { 1174 dprintf(("USER32: InvertRect %x (%d,%d)(%d,%d)", hDC, lprc->left, lprc->top, lprc->right, lprc->bottom)); 1175 } 1176 else dprintf(("USER32: InvertRect %x NULL", hDC)); 1177 return O32_InvertRect(hDC,lprc); 1178 } 1146 1179 1147 1180 1148 /* System Information Functions */ -
trunk/src/user32/user32api.h
r9791 r10316 1 /* $Id: user32api.h,v 1. 2 2003-02-13 10:12:25sandervl Exp $ */1 /* $Id: user32api.h,v 1.3 2003-11-12 14:10:20 sandervl Exp $ */ 2 2 //Internal user32 functions 3 3 4 4 #ifndef __USER32API_H_ 5 5 #define __USER32API_H_ 6 7 HWND WINAPI GetAncestor( HWND hwnd, UINT type );8 6 9 7 //Notify that focus has changed (necessary for SetFocus(0) handling) -
trunk/src/user32/user32dbg.def
r10256 r10316 1 ; $Id: user32dbg.def,v 1.1 4 2003-10-02 10:36:00 sandervl Exp $1 ; $Id: user32dbg.def,v 1.15 2003-11-12 14:10:20 sandervl Exp $ 2 2 3 3 LIBRARY USER32 INITINSTANCE TERMINSTANCE … … 237 237 ExcludeUpdateRgn = _DbgExcludeUpdateRgn@8 @194 238 238 ExitWindowsEx = _DbgExitWindowsEx@8 @195 239 FillRect = _ DbgFillRect@12@196239 FillRect = _FillRect@12 @196 240 240 FindWindowA = _DbgFindWindowA@8 @197 241 241 FindWindowExA = _DbgFindWindowExA@16 @198 … … 243 243 FindWindowW = _DbgFindWindowW@8 @200 244 244 FlashWindow = _DbgFlashWindow@8 @201 245 FrameRect = _ DbgFrameRect@12@202245 FrameRect = _FrameRect@12 @202 246 246 FreeDDElParam = _DbgFreeDDElParam@8 @203 247 247 GetActiveWindow = _DbgGetActiveWindow@0 @204 … … 374 374 InvalidateRect = _DbgInvalidateRect@12 @328 375 375 InvalidateRgn = _DbgInvalidateRgn@12 @329 376 InvertRect = _ DbgInvertRect@8@330376 InvertRect = _InvertRect@8 @330 377 377 IsCharAlphaA = _IsCharAlphaA@4 @331 378 378 IsCharAlphaNumericA = _IsCharAlphaNumericA@4 @332 … … 642 642 SetWinEventHook = _DbgSetWinEventHook@28 @608 643 643 644 GetAncestor = _DbgGetAncestor@8 @609 645 GetWindowModuleFileNameA = _DbgGetWindowModuleFileNameA@12 @610 646 644 647 ;------------ 645 648 ; Windows 98 -
trunk/src/user32/win32wbase.cpp
r10275 r10316 1 /* $Id: win32wbase.cpp,v 1.3 79 2003-10-20 17:17:23sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.380 2003-11-12 14:10:20 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 117 117 fComingToTop = FALSE; 118 118 fMinMaxChange = FALSE; 119 f VisibleRegionChanged = FALSE;119 fPMUpdateRegionChanged = FALSE; 120 120 fEraseBkgndFlag = TRUE; 121 121 fIsDragDropActive= FALSE; … … 178 178 hWindowRegion = 0; 179 179 hClipRegion = 0; 180 hVisRegion = 0; 180 181 hUpdateRegion = 0; 181 182 … … 1219 1220 HDC hdcErase = hdc; 1220 1221 1221 if (hdcErase == 0) 1222 hdcErase = GetDC(getWindowHandle()); 1222 if (hdcErase == 0) { 1223 DebugInt3(); 1224 return 0; 1225 } 1223 1226 1224 1227 if(IsWindowIconic()) … … 1226 1229 else 1227 1230 rc = SendMessageA(getWindowHandle(),WM_ERASEBKGND, hdcErase, 0); 1228 if (hdc == 0) 1229 ReleaseDC(getWindowHandle(), hdcErase); 1231 1230 1232 return (rc); 1231 1233 } … … 1250 1252 } 1251 1253 //****************************************************************************** 1252 //TODO: Should use update region, not rectangle 1253 //****************************************************************************** 1254 ULONG Win32BaseWindow::MsgNCPaint(PRECT pUpdateRect) 1255 { 1256 HRGN hrgn; 1254 //****************************************************************************** 1255 ULONG Win32BaseWindow::MsgNCPaint(PRECT pUpdateRect, HRGN hrgnUpdate) 1256 { 1257 1257 ULONG rc; 1258 1258 RECT client = rectClient; … … 1267 1267 } 1268 1268 1269 dprintf(("MsgNCPaint (%d,%d)(%d,%d)", pUpdateRect->left, pUpdateRect->top, pUpdateRect->right, pUpdateRect->bottom)); 1270 hrgn = CreateRectRgnIndirect(pUpdateRect); 1271 1272 rc = SendMessageA(getWindowHandle(),WM_NCPAINT, hrgn, 0); 1269 rc = SendMessageA(getWindowHandle(),WM_NCPAINT, hrgnUpdate, 0); 1273 1270 //Send WM_PAINTICON here if minimized, because client window will 1274 1271 //not receive a (valid) WM_PAINT message … … 1277 1274 rc = SendMessageA(getWindowHandle(),WM_PAINTICON, 1, 0); 1278 1275 } 1279 1280 DeleteObject(hrgn);1281 1276 1282 1277 return rc; … … 2919 2914 } 2920 2915 //****************************************************************************** 2921 //Note: does not set last error if no parent (verified in NT4, SP6) 2916 // Win32BaseWindow::GetParent 2917 // 2918 // If the window is a child window, then return the parent window handle. 2919 // If it's a popup window, then return the owner 2920 // 2921 // Returns window handle of parent or owner window 2922 // 2923 // Note: does not set last error if no parent (verified in NT4, SP6) 2922 2924 //****************************************************************************** 2923 2925 HWND Win32BaseWindow::GetParent() -
trunk/src/user32/win32wbase.h
r10190 r10316 1 /* $Id: win32wbase.h,v 1.15 5 2003-07-31 15:56:47sandervl Exp $ */1 /* $Id: win32wbase.h,v 1.156 2003-11-12 14:10:21 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 136 136 ULONG MsgPaint(ULONG tmp1, BOOL select = TRUE); 137 137 ULONG MsgEraseBackGround(HDC hdc); 138 ULONG MsgNCPaint(PRECT pUpdateRect );138 ULONG MsgNCPaint(PRECT pUpdateRect, HRGN hrgnUpdate); 139 139 ULONG MsgFormatFrame(WINDOWPOS *lpWndPos); 140 140 ULONG DispatchMsgA(MSG *msg); … … 231 231 //Save old clip region for CS_OWNDC windows (in BeginPaint) 232 232 HRGN GetClipRegion() { return hClipRegion; }; 233 void SetClipRegion(HRGN hRegion) { hClipRegion = hRegion; }; 233 HRGN GetVisRegion() { return hVisRegion; }; 234 void SaveClipRegion(HRGN hrgnClip) { hClipRegion = hrgnClip; }; 235 void SaveVisRegion(HRGN hrgnVis) { hVisRegion = hrgnVis; }; 234 236 235 237 void saveAndValidateUpdateRegion(); … … 286 288 BOOL IsMixMaxStateChanging() { return fMinMaxChange; }; 287 289 288 void SetVisibleRegionChanged(BOOL changed) { fVisibleRegionChanged = changed; };289 BOOL IsVisibleRegionChanged() { return fVisibleRegionChanged; };290 290 BOOL setVisibleRgnNotifyProc(VISRGN_NOTIFY_PROC lpNotifyProc, DWORD dwUserData); 291 291 void callVisibleRgnNotifyProc(BOOL fDrawingAllowed); … … 415 415 fCXDefault:1, 416 416 fParentDC:1, 417 fComingToTop:1,417 fComingToTop:1, 418 418 isUnicode:1, 419 419 fMinMaxChange:1, //set when switching between min/max/restored state 420 f VisibleRegionChanged:1, //set when visible regionhas changed -> erase background must be sent during next BeginPaint420 fPMUpdateRegionChanged:1, //set when PM update has changed -> erase background must be sent during next BeginPaint 421 421 fEraseBkgndFlag:1, 422 422 fIsDragDropActive:1, … … 426 426 ULONG state; 427 427 HRGN hWindowRegion; 428 HRGN hClipRegion ;428 HRGN hClipRegion, hVisRegion; 429 429 HRGN hUpdateRegion; 430 430 … … 533 533 VOID setEraseBkgnd (BOOL erase) { fEraseBkgndFlag = erase; } 534 534 BOOL needsEraseBkgnd() { return fEraseBkgndFlag; } 535 536 void SetPMUpdateRegionChanged(BOOL changed) { fPMUpdateRegionChanged = changed; }; 537 BOOL hasPMUpdateRegionChanged() { return fPMUpdateRegionChanged; }; 535 538 }; 536 539 -
trunk/src/user32/win32wmisc.h
r9598 r10316 1 /* $Id: win32wmisc.h,v 1. 2 2003-01-03 16:35:58sandervl Exp $ */1 /* $Id: win32wmisc.h,v 1.3 2003-11-12 14:10:21 sandervl Exp $ */ 2 2 /* 3 3 * Misc. functions for window management … … 32 32 INT NC_HandleNCHitTest( HWND hwnd, POINT pt); 33 33 34 HWND WINAPI GetAncestor( HWND hwnd, UINT type );35 36 34 #ifdef __cplusplus 37 35 } -
trunk/src/user32/window.cpp
r10145 r10316 1 /* $Id: window.cpp,v 1.13 6 2003-06-25 17:02:04sandervl Exp $ */1 /* $Id: window.cpp,v 1.137 2003-11-12 14:10:21 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 44 44 #include <winuser32.h> 45 45 #include "hook.h" 46 #include <wprocess.h> 46 47 47 48 #define DBG_LOCALLOG DBG_window … … 711 712 { 712 713 HWND hwndAncestor = 0; 714 Win32BaseWindow *window; 715 716 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 717 if(!window) { 718 dprintf(("GetAncestor, window %x not found", hwnd)); 719 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 720 return FALSE; 721 } 713 722 714 723 if (type == GA_PARENT) … … 719 728 } 720 729 //else no child -> no parent (GetParent returns owner otherwise!) 721 return hwndAncestor; 722 } 723 dprintf(("Unsupported type %d", type)); 724 return 0; 730 } 731 else 732 if (type == GA_ROOT) 733 { 734 hwndAncestor = window->GetTopParent(); 735 } 736 else 737 if (type == GA_ROOTOWNER) 738 { 739 if(hwnd != GetDesktopWindow()) 740 { 741 hwndAncestor = hwnd; 742 for(;;) 743 { 744 HWND parent = GetParent( hwndAncestor ); 745 if (!parent) break; 746 hwndAncestor = parent; 747 } 748 } 749 } 750 else dprintf(("Unsupported type %d", type)); 751 752 RELEASE_WNDOBJ(window); 753 return hwndAncestor; 725 754 } 726 755 //****************************************************************************** … … 760 789 return 0; 761 790 } 791 fIgnoreKeystrokes = TRUE; 762 792 SendMessageA(lastFocus_W, WM_KILLFOCUS, 0, 0); 763 764 fIgnoreKeystrokes = TRUE;765 793 766 794 return lastFocus_W; … … 2151 2179 } 2152 2180 //****************************************************************************** 2181 //The GetWindowModuleFileName function retrieves the full path and file name of 2182 //the module associated with the specified window handle. 2183 //****************************************************************************** 2184 UINT WIN32API GetWindowModuleFileNameA(HWND hwnd, LPTSTR lpszFileName, UINT cchFileNameMax) 2185 { 2186 WNDPROC lpfnWindowProc; 2187 2188 if (!IsWindow(hwnd)) { 2189 dprintf(("warning: GetWindowModuleFileName: window %x not found!", hwnd)); 2190 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 2191 return 0; 2192 } 2193 lpfnWindowProc = (WNDPROC)GetWindowLongA(hwnd, GWL_WNDPROC); 2194 return GetProcModuleFileNameA((ULONG)lpfnWindowProc, lpszFileName, cchFileNameMax); 2195 } 2196 //****************************************************************************** 2153 2197 //****************************************************************************** 2154 2198
Note:
See TracChangeset
for help on using the changeset viewer.