- Timestamp:
- Sep 14, 2009, 8:18:41 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Composite.java
r87 r188 505 505 int widgetStyle () { 506 506 /* Temporary code to force SWT.CLIP_SIBLINGS */ 507 return super.widgetStyle (); // | OS.WS_CLIPCHILDREN;507 return super.widgetStyle (); // | OS.WS_CLIPCHILDREN; 508 508 } 509 509 … … 523 523 // And may be better to move this code to Decorations class... 524 524 MRESULT WM_ERASEBACKGROUND (int mp1, int mp2) { 525 // System.out.println("Composite::WM_ERASEBACKGROUND -> HANDLE = " + Integer.toHexString(handle)); 525 526 if ((state & CANVAS) != 0) { 527 //@@TODO(lpino): This invalidation forces a whole window repaint to prevent clipping errors when window is partially obscure 528 //it has a negative impact on performance. As my understanding improves maybe this problem can be solved 529 OS.WinInvalidateRect(handle, null, true); 530 // OS.WinUpdateWindow(handle); 526 531 return super.WM_ERASEBACKGROUND (mp1, mp2); 527 532 } … … 529 534 OS.objcpy (rcl, mp2); 530 535 drawBackground (mp1, rcl); 531 return MRESULT. FALSE;536 return MRESULT.TRUE; 532 537 } 533 538 … … 556 561 // return new LRESULT (font); 557 562 //} 558 // 559 //LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {560 // LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);561 // 562 ///* Set focus for a canvas with no children */563 //if ((state & CANVAS) != 0) {564 //if ((style & SWT.NO_FOCUS) != 0) return result;565 // if (OS.GetWindow (handle, OS.GW_CHILD) == 0) setFocus ();566 //}567 //return result;568 //}569 // 563 564 MRESULT WM_BUTTON1DOWN (int mp1, int mp2) { 565 MRESULT result = super.WM_BUTTON1DOWN (mp1, mp2); 566 567 /* Set focus for a canvas with no children */ 568 if ((state & CANVAS) != 0) { 569 if ((style & SWT.NO_FOCUS) != 0) return result; 570 if (OS.WinQueryWindow (handle, OS.QW_TOP) == 0) setFocus (); 571 } 572 return result; 573 } 574 570 575 //LRESULT WM_NOTIFY (int wParam, int lParam) { 571 576 // if (!OS.IsWinCE) { … … 627 632 if ((state & CANVAS) == 0) { 628 633 return super.WM_PAINT (mp1, mp2); 629 } 630 634 } 631 635 /* 632 636 * This code is intentionally commented. Don't exit … … 639 643 // if (!hooks (SWT.Paint)) return null; 640 644 /* lazily obtain a long-term cached micro presentation space */ 641 GCData data = new GCData (); 645 // System.out.println("Composite::WM_PAINT -> HANDLE = " + Integer.toHexString(handle)); 646 GCData data = new GCData (); 642 647 if (hps == 0) { 643 648 hps = internal_new_GC (data); … … 645 650 data.doInit = true; 646 651 } 647 648 /* Get the damage */ 649 int [] rgnRects = null; 652 // /* Get the damage */ 653 int [] rgnRects = null; 650 654 boolean isComplex = false; 651 655 boolean exposeRegion = false; 652 656 if ((style & SWT.NO_MERGE_PAINTS) != 0) { 653 int hrgn = OS.GpiCreateRegion (hps, 0, null); 654 isComplex = OS.WinQueryUpdateRegion (handle, hrgn) == OS.RGN_COMPLEX; 655 if (isComplex) { 656 RGNRECT rgnctl = new RGNRECT(); 657 rgnctl.ircStart = 1; 658 rgnctl.ulDirection = OS.RECTDIR_LFRT_TOPBOT; 659 exposeRegion = OS.GpiQueryRegionRects (hps, hrgn, null, rgnctl, null); 660 if (exposeRegion) { 661 rgnRects = new int [rgnctl.crcReturned * 4]; 662 rgnctl.crc = rgnctl.crcReturned; 663 exposeRegion = OS.GpiQueryRegionRects (hps, hrgn, null, rgnctl, rgnRects); 657 int hrgn = OS.GpiCreateRegion (hps, 0, null); 658 isComplex = OS.WinQueryUpdateRegion (handle, hrgn) == OS.RGN_COMPLEX; 659 if (isComplex) { 660 RGNRECT rgnctl = new RGNRECT(); 661 rgnctl.ircStart = 1; 662 rgnctl.ulDirection = OS.RECTDIR_LFRT_TOPBOT; 663 exposeRegion = OS.GpiQueryRegionRects (hps, hrgn, null, rgnctl, null); 664 if (exposeRegion) { 665 rgnRects = new int [rgnctl.crcReturned * 4]; 666 rgnctl.crc = rgnctl.crcReturned; 667 exposeRegion = OS.GpiQueryRegionRects (hps, hrgn, null, rgnctl, rgnRects); 668 } 664 669 } 670 OS.GpiDestroyRegion (hps, hrgn); 665 671 } 666 OS.GpiDestroyRegion (hps, hrgn); 667 } 668 669 /* Set the clipping bits */ 670 int oldBits = 0; 672 673 // /* Set the clipping bits */ 674 int oldBits = 0; 671 675 oldBits = OS.WinQueryWindowULong (handle, OS.QWL_STYLE); 672 676 int newBits = oldBits | OS.WS_CLIPSIBLINGS | OS.WS_CLIPCHILDREN; 673 677 OS.WinSetWindowULong (handle, OS.QWL_STYLE, newBits); 674 678 675 /* Create the paint GC */679 // /* Create the paint GC */ 676 680 data.rcl = new RECTL (); 677 681 data.hps = hps; … … 681 685 // int ahps = gc.handle; 682 686 int height = getHeight (); 683 684 687 /* 685 688 * Feature in OS/2. When resizing a window that doesn't have the … … 688 691 * situation and don't send an SWT.Paint event. 689 692 */ 690 if ((style & SWT.NO_REDRAW_RESIZE) == 0 || 691 (data.rcl.xRight != data.rcl.xLeft) || 692 (data.rcl.yTop != data.rcl.yBottom)) 693 { 693 if ((style & SWT.NO_REDRAW_RESIZE) == 0 || (data.rcl.xRight != data.rcl.xLeft) || (data.rcl.yTop != data.rcl.yBottom)) { 694 694 /* Send the paint event */ 695 695 Event event = new Event (); … … 711 711 rcl.xRight = rgnRects [(i << 2) + 2]; 712 712 rcl.yTop = rgnRects [(i << 2) + 3]; 713 drawBackground (0, rcl); 713 // System.out.println("Control::drawBackground -> xLeft = " + rcl.xLeft); 714 // System.out.println("Control::drawBackground -> xRight = " + rcl.xRight); 715 // System.out.println("Control::drawBackground -> yBottom = " + rcl.yBottom); 716 // System.out.println("Control::drawBackground -> yTop = " + rcl.yTop); 717 drawBackground (0, rcl); 714 718 event.x = rcl.xLeft; 715 719 event.y = height - rcl.yTop; 716 720 event.width = rcl.xRight - rcl.xLeft; 717 721 event.height = rcl.yTop - rcl.yBottom; 718 722 event.count = nCount - 1 - i; 719 723 /* 720 724 * Restore the clip region if was set by the last paint listener. … … 765 769 OS.WinSetWindowULong (handle, OS.QWL_STYLE, oldBits); 766 770 } 767 771 return MRESULT.ZERO; 768 772 } 769 773
Note:
See TracChangeset
for help on using the changeset viewer.