Changeset 188 for trunk/src/plugins


Ignore:
Timestamp:
Sep 14, 2009, 8:18:41 PM (16 years ago)
Author:
lpino
Message:
  • Fix to redraw clipped background (partially)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Composite.java

    r87 r188  
    505505int widgetStyle () {
    506506        /* Temporary code to force SWT.CLIP_SIBLINGS */
    507         return super.widgetStyle ();// | OS.WS_CLIPCHILDREN;
     507        return super.widgetStyle (); // | OS.WS_CLIPCHILDREN;
    508508}
    509509
     
    523523//  And may be better to move this code to Decorations class...
    524524MRESULT WM_ERASEBACKGROUND (int mp1, int mp2) {
     525//    System.out.println("Composite::WM_ERASEBACKGROUND -> HANDLE = " + Integer.toHexString(handle));
    525526    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);
    526531        return super.WM_ERASEBACKGROUND (mp1, mp2);
    527532    }
     
    529534    OS.objcpy (rcl, mp2);
    530535    drawBackground (mp1, rcl);
    531     return MRESULT.FALSE;
     536    return MRESULT.TRUE;
    532537}
    533538
     
    556561//      return new LRESULT (font);
    557562//}
    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
     564MRESULT 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
    570575//LRESULT WM_NOTIFY (int wParam, int lParam) {
    571576//      if (!OS.IsWinCE) {
     
    627632    if ((state & CANVAS) == 0) {
    628633                return super.WM_PAINT (mp1, mp2);
    629         }
    630 
     634    }
    631635    /*
    632636        * This code is intentionally commented.  Don't exit
     
    639643//      if (!hooks (SWT.Paint)) return null;
    640644    /* 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 ();
    642647    if (hps == 0) {
    643648        hps = internal_new_GC (data);
     
    645650        data.doInit = true;
    646651    }
    647 
    648         /* Get the damage */
    649     int [] rgnRects = null;
     652//      /* Get the damage */
     653        int [] rgnRects = null;
    650654        boolean isComplex = false;
    651655        boolean exposeRegion = false;
    652656        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                }
    664669            }
     670            OS.GpiDestroyRegion (hps, hrgn);
    665671        }
    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;
    671675    oldBits = OS.WinQueryWindowULong (handle, OS.QWL_STYLE);
    672676    int newBits = oldBits | OS.WS_CLIPSIBLINGS | OS.WS_CLIPCHILDREN;   
    673677    OS.WinSetWindowULong (handle, OS.QWL_STYLE, newBits);
    674678
    675         /* Create the paint GC */
     679//      /* Create the paint GC */
    676680    data.rcl = new RECTL ();
    677681    data.hps = hps;
     
    681685//    int ahps = gc.handle;
    682686    int height = getHeight ();
    683        
    684687    /*
    685688     *  Feature in OS/2. When resizing a window that doesn't have the
     
    688691     *  situation and don't send an SWT.Paint event.
    689692     */
    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)) {
    694694        /* Send the paint event */
    695695        Event event = new Event ();
     
    711711                rcl.xRight = rgnRects [(i << 2) + 2];
    712712                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);
    714718                event.x = rcl.xLeft;
    715719                event.y = height - rcl.yTop;
    716720                event.width = rcl.xRight - rcl.xLeft;
    717721                event.height = rcl.yTop - rcl.yBottom;
    718                         event.count = nCount - 1 - i;
     722                  event.count = nCount - 1 - i;
    719723                /*
    720724                 *  Restore the clip region if was set by the last paint listener.
     
    765769        OS.WinSetWindowULong (handle, OS.QWL_STYLE, oldBits);
    766770    }
    767         return MRESULT.ZERO;
     771    return MRESULT.ZERO;
    768772}
    769773
Note: See TracChangeset for help on using the changeset viewer.