< prev index next >

src/solaris/classes/sun/awt/X11/XBaseWindow.java

Print this page
rev 1571 : 8010297: Missing isLoggable() checks in logging code
Summary: Add isLoggable() checks
Reviewed-by: anthony, mchung, serb
Contributed-by: Laurent Bourges <bourges.laurent@gmail.com>


 143             if (parentWindowID != null) {
 144                 parentWindow = XToolkit.windowToXWindow(parentWindowID);
 145             }
 146         }
 147 
 148         Long eventMask = (Long)params.get(EVENT_MASK);
 149         if (eventMask != null) {
 150             long mask = eventMask.longValue();
 151             mask |= SubstructureNotifyMask;
 152             params.put(EVENT_MASK, mask);
 153         }
 154 
 155         screen = -1;
 156     }
 157 
 158     /**
 159      * Called after window creation, descendants should override to initialize Window
 160      * with class-specific values and perform post-initialization actions.
 161      */
 162     void postInit(XCreateWindowParams params) {
 163         if (log.isLoggable(Level.FINE)) log.fine("WM name is " + getWMName());


 164         updateWMName();
 165 
 166         // Set WM_CLIENT_LEADER property
 167         initClientLeader();
 168     }
 169 
 170     /**
 171      * Creates window using parameters <code>params</code>
 172      * If params contain flag DELAYED doesn't do anything.
 173      * Note: Descendants can call this method to create the window
 174      * at the time different to instance construction.
 175      */
 176     protected final void init(XCreateWindowParams params) {
 177         awtLock();
 178         initialising = InitialiseState.INITIALISING;
 179         awtUnlock();
 180 
 181         try {
 182             if (!Boolean.TRUE.equals(params.get(DELAYED))) {
 183                 preInit(params);
 184                 create(params);
 185                 postInit(params);
 186             } else {
 187                 instantPreInit(params);
 188                 delayedParams = params;
 189             }
 190             awtLock();
 191             initialising = InitialiseState.INITIALISED;
 192             awtLockNotifyAll();
 193             awtUnlock();
 194         } catch (RuntimeException re) {
 195             awtLock();
 196             initialising = InitialiseState.FAILED_INITIALISATION;
 197             awtLockNotifyAll();
 198             awtUnlock();
 199             throw re;
 200         } catch (Throwable t) {

 201             log.log(Level.WARNING, "Exception during peer initialization", t);

 202             awtLock();
 203             initialising = InitialiseState.FAILED_INITIALISATION;
 204             awtLockNotifyAll();
 205             awtUnlock();
 206         }
 207     }
 208 
 209     public boolean checkInitialised() {
 210         awtLock();
 211         try {
 212             switch (initialising) {
 213               case INITIALISED:
 214                   return true;
 215               case INITIALISING:
 216                   try {
 217                       while (initialising != InitialiseState.INITIALISED) {
 218                           awtLockWait();
 219                       }
 220                   } catch (InterruptedException ie) {
 221                       return false;


 463         }
 464         return wmHints;
 465     }
 466 
 467 
 468     /*
 469      * Call this method under AWTLock.
 470      * The lock should be acquired untill all operations with XSizeHints are completed.
 471      */
 472     public XSizeHints getHints() {
 473         if (hints == null) {
 474             long p_hints = XlibWrapper.XAllocSizeHints();
 475             hints = new XSizeHints(p_hints);
 476 //              XlibWrapper.XGetWMNormalHints(XToolkit.getDisplay(), getWindow(), p_hints, XlibWrapper.larg1);
 477             // TODO: Shouldn't we listen for WM updates on this property?
 478         }
 479         return hints;
 480     }
 481 
 482     public void setSizeHints(long flags, int x, int y, int width, int height) {
 483         if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags));


 484         XToolkit.awtLock();
 485         try {
 486             XSizeHints hints = getHints();
 487             // Note: if PPosition is not set in flags this means that
 488             // we want to reset PPosition in hints.  This is necessary
 489             // for locationByPlatform functionality
 490             if ((flags & XlibWrapper.PPosition) != 0) {
 491                 hints.set_x(x);
 492                 hints.set_y(y);
 493             }
 494             if ((flags & XlibWrapper.PSize) != 0) {
 495                 hints.set_width(width);
 496                 hints.set_height(height);
 497             } else if ((hints.get_flags() & XlibWrapper.PSize) != 0) {
 498                 flags |= XlibWrapper.PSize;
 499             }
 500             if ((flags & XlibWrapper.PMinSize) != 0) {
 501                 hints.set_min_width(width);
 502                 hints.set_min_height(height);
 503             } else if ((hints.get_flags() & XlibWrapper.PMinSize) != 0) {


 524             } else if ((hints.get_flags() & XlibWrapper.PMaxSize) != 0) {
 525                 flags |= XlibWrapper.PMaxSize;
 526                 if (maxBounds != null) {
 527                     if (maxBounds.width != Integer.MAX_VALUE) {
 528                         hints.set_max_width(maxBounds.width);
 529                     } else {
 530                         hints.set_max_width(XToolkit.getDefaultScreenWidth());
 531                     }
 532                     if (maxBounds.height != Integer.MAX_VALUE) {
 533                         hints.set_max_height(maxBounds.height);
 534                     } else {
 535                         hints.set_max_height(XToolkit.getDefaultScreenHeight());
 536                     }
 537                 } else {
 538                     // Leave intact
 539                 }
 540             }
 541             flags |= XlibWrapper.PWinGravity;
 542             hints.set_flags(flags);
 543             hints.set_win_gravity((int)XlibWrapper.NorthWestGravity);
 544             if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +

 545                                                              ", values " + hints);

 546             XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData);
 547         } finally {
 548             XToolkit.awtUnlock();
 549         }
 550     }
 551 
 552     public boolean isMinSizeSet() {
 553         XSizeHints hints = getHints();
 554         long flags = hints.get_flags();
 555         return ((flags & XlibWrapper.PMinSize) == XlibWrapper.PMinSize);
 556     }
 557 
 558     /**
 559      * This lock object can be used to protect instance data from concurrent access
 560      * by two threads. If both state lock and AWT lock are taken, AWT Lock should be taken first.
 561      */
 562     Object getStateLock() {
 563         return state_lock;
 564     }
 565 


 576 
 577     public Rectangle getBounds() {
 578         return new Rectangle(x, y, width, height);
 579     }
 580     public Dimension getSize() {
 581         return new Dimension(width, height);
 582     }
 583 
 584 
 585     public void toFront() {
 586         XToolkit.awtLock();
 587         try {
 588             XlibWrapper.XRaiseWindow(XToolkit.getDisplay(), getWindow());
 589         } finally {
 590             XToolkit.awtUnlock();
 591         }
 592     }
 593     public void xRequestFocus(long time) {
 594         XToolkit.awtLock();
 595         try {
 596             if (focusLog.isLoggable(Level.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()) + " with time " + time);


 597             XlibWrapper.XSetInputFocus2(XToolkit.getDisplay(), getWindow(), time);
 598         } finally {
 599             XToolkit.awtUnlock();
 600         }
 601     }
 602     public void xRequestFocus() {
 603         XToolkit.awtLock();
 604         try {
 605             if (focusLog.isLoggable(Level.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()));


 606              XlibWrapper.XSetInputFocus(XToolkit.getDisplay(), getWindow());
 607         } finally {
 608             XToolkit.awtUnlock();
 609         }
 610     }
 611 
 612     public static long xGetInputFocus() {
 613         XToolkit.awtLock();
 614         try {
 615             return XlibWrapper.XGetInputFocus(XToolkit.getDisplay());
 616         } finally {
 617             XToolkit.awtUnlock();
 618         }
 619     }
 620 
 621     public void xSetVisible(boolean visible) {
 622         if (log.isLoggable(Level.FINE)) log.fine("Setting visible on " + this + " to " + visible);


 623         XToolkit.awtLock();
 624         try {
 625             this.visible = visible;
 626             if (visible) {
 627                 XlibWrapper.XMapWindow(XToolkit.getDisplay(), getWindow());
 628             }
 629             else {
 630                 XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), getWindow());
 631             }
 632             XlibWrapper.XFlush(XToolkit.getDisplay());
 633         } finally {
 634             XToolkit.awtUnlock();
 635         }
 636     }
 637 
 638     boolean isMapped() {
 639         return mapped;
 640     }
 641 
 642     void updateWMName() {


 687             XToolkit.awtUnlock();
 688         }
 689     }
 690 
 691     long getScreen() {
 692         if (screen == -1) { // Not initialized
 693             screen = getScreenOfWindow(window);
 694         }
 695         return screen;
 696     }
 697 
 698     public void xSetBounds(Rectangle bounds) {
 699         xSetBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 700     }
 701 
 702     public void xSetBounds(int x, int y, int width, int height) {
 703         if (getWindow() == 0) {
 704             insLog.warning("Attempt to resize uncreated window");
 705             throw new IllegalStateException("Attempt to resize uncreated window");
 706         }

 707         insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);

 708         if (width <= 0) {
 709             width = 1;
 710         }
 711         if (height <= 0) {
 712             height = 1;
 713         }
 714         XToolkit.awtLock();
 715         try {
 716              XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getWindow(), x,y,width,height);
 717         } finally {
 718             XToolkit.awtUnlock();
 719         }
 720     }
 721 
 722     /**
 723      * Translate coordinates from one window into another.  Optimized
 724      * for XAWT - uses cached data when possible.  Preferable over
 725      * pure XTranslateCoordinates.
 726      * @return coordinates relative to dst, or null if error happened
 727      */


 889                 grabWindow.ungrabInputImpl();
 890                 XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime);
 891                 XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), CurrentTime);
 892                 XAwtState.setGrabWindow(null);
 893                 // we need to call XFlush() here to force ungrab
 894                 // see 6384219 for details
 895                 XlibWrapper.XFlush(XToolkit.getDisplay());
 896             }
 897         } finally {
 898             XToolkit.awtUnlock();
 899         }
 900     }
 901 
 902     // called from ungrabInput, used in popup windows to hide theirselfs in ungrabbing
 903     void ungrabInputImpl() {
 904     }
 905 
 906     static void checkSecurity() {
 907         if (XToolkit.isSecurityWarningEnabled() && XToolkit.isToolkitThread()) {
 908             StackTraceElement stack[] = (new Throwable()).getStackTrace();

 909             log.warning(stack[1] + ": Security violation: calling user code on toolkit thread");
 910         }
 911     }

 912 
 913     public Set<Long> getChildren() {
 914         synchronized (getStateLock()) {
 915             return new HashSet<Long>(children);
 916         }
 917     }
 918 
 919     // -------------- Event handling ----------------
 920     public void handleMapNotifyEvent(XEvent xev) {
 921         mapped = true;
 922     }
 923     public void handleUnmapNotifyEvent(XEvent xev) {
 924         mapped = false;
 925     }
 926     public void handleReparentNotifyEvent(XEvent xev) {
 927         if (eventLog.isLoggable(Level.FINER)) {
 928             XReparentEvent msg = xev.get_xreparent();
 929             eventLog.finer(msg.toString());
 930         }
 931     }


1048               return (target instanceof XWindowPeer);
1049           default:
1050               return false;
1051         }
1052     }
1053     /**
1054      * Dispatches event to the grab Window or event source window depending
1055      * on whether the grab is active and on the event type
1056      */
1057     static void dispatchToWindow(XEvent ev) {
1058         XBaseWindow target = XAwtState.getGrabWindow();
1059         if (target == null || !isGrabbedEvent(ev, target)) {
1060             target = XToolkit.windowToXWindow(ev.get_xany().get_window());
1061         }
1062         if (target != null && target.checkInitialised()) {
1063             target.dispatchEvent(ev);
1064         }
1065     }
1066 
1067     public void dispatchEvent(XEvent xev) {
1068         if (eventLog.isLoggable(Level.FINEST)) eventLog.finest(xev.toString());


1069         int type = xev.get_type();
1070 
1071         if (isDisposed()) {
1072             return;
1073         }
1074 
1075         switch (type)
1076         {
1077           case VisibilityNotify:
1078               handleVisibilityEvent(xev);
1079               break;
1080           case ClientMessage:
1081               handleClientMessage(xev);
1082               break;
1083           case Expose :
1084           case GraphicsExpose :
1085               handleExposeEvent(xev);
1086               break;
1087           case ButtonPress:
1088           case ButtonRelease:




 143             if (parentWindowID != null) {
 144                 parentWindow = XToolkit.windowToXWindow(parentWindowID);
 145             }
 146         }
 147 
 148         Long eventMask = (Long)params.get(EVENT_MASK);
 149         if (eventMask != null) {
 150             long mask = eventMask.longValue();
 151             mask |= SubstructureNotifyMask;
 152             params.put(EVENT_MASK, mask);
 153         }
 154 
 155         screen = -1;
 156     }
 157 
 158     /**
 159      * Called after window creation, descendants should override to initialize Window
 160      * with class-specific values and perform post-initialization actions.
 161      */
 162     void postInit(XCreateWindowParams params) {
 163         if (log.isLoggable(Level.FINE)) {
 164             log.fine("WM name is " + getWMName());
 165         }
 166         updateWMName();
 167 
 168         // Set WM_CLIENT_LEADER property
 169         initClientLeader();
 170     }
 171 
 172     /**
 173      * Creates window using parameters <code>params</code>
 174      * If params contain flag DELAYED doesn't do anything.
 175      * Note: Descendants can call this method to create the window
 176      * at the time different to instance construction.
 177      */
 178     protected final void init(XCreateWindowParams params) {
 179         awtLock();
 180         initialising = InitialiseState.INITIALISING;
 181         awtUnlock();
 182 
 183         try {
 184             if (!Boolean.TRUE.equals(params.get(DELAYED))) {
 185                 preInit(params);
 186                 create(params);
 187                 postInit(params);
 188             } else {
 189                 instantPreInit(params);
 190                 delayedParams = params;
 191             }
 192             awtLock();
 193             initialising = InitialiseState.INITIALISED;
 194             awtLockNotifyAll();
 195             awtUnlock();
 196         } catch (RuntimeException re) {
 197             awtLock();
 198             initialising = InitialiseState.FAILED_INITIALISATION;
 199             awtLockNotifyAll();
 200             awtUnlock();
 201             throw re;
 202         } catch (Throwable t) {
 203             if (log.isLoggable(Level.WARNING)) {
 204                 log.log(Level.WARNING, "Exception during peer initialization", t);
 205             }
 206             awtLock();
 207             initialising = InitialiseState.FAILED_INITIALISATION;
 208             awtLockNotifyAll();
 209             awtUnlock();
 210         }
 211     }
 212 
 213     public boolean checkInitialised() {
 214         awtLock();
 215         try {
 216             switch (initialising) {
 217               case INITIALISED:
 218                   return true;
 219               case INITIALISING:
 220                   try {
 221                       while (initialising != InitialiseState.INITIALISED) {
 222                           awtLockWait();
 223                       }
 224                   } catch (InterruptedException ie) {
 225                       return false;


 467         }
 468         return wmHints;
 469     }
 470 
 471 
 472     /*
 473      * Call this method under AWTLock.
 474      * The lock should be acquired untill all operations with XSizeHints are completed.
 475      */
 476     public XSizeHints getHints() {
 477         if (hints == null) {
 478             long p_hints = XlibWrapper.XAllocSizeHints();
 479             hints = new XSizeHints(p_hints);
 480 //              XlibWrapper.XGetWMNormalHints(XToolkit.getDisplay(), getWindow(), p_hints, XlibWrapper.larg1);
 481             // TODO: Shouldn't we listen for WM updates on this property?
 482         }
 483         return hints;
 484     }
 485 
 486     public void setSizeHints(long flags, int x, int y, int width, int height) {
 487         if (insLog.isLoggable(Level.FINER)) {
 488             insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags));
 489         }
 490         XToolkit.awtLock();
 491         try {
 492             XSizeHints hints = getHints();
 493             // Note: if PPosition is not set in flags this means that
 494             // we want to reset PPosition in hints.  This is necessary
 495             // for locationByPlatform functionality
 496             if ((flags & XlibWrapper.PPosition) != 0) {
 497                 hints.set_x(x);
 498                 hints.set_y(y);
 499             }
 500             if ((flags & XlibWrapper.PSize) != 0) {
 501                 hints.set_width(width);
 502                 hints.set_height(height);
 503             } else if ((hints.get_flags() & XlibWrapper.PSize) != 0) {
 504                 flags |= XlibWrapper.PSize;
 505             }
 506             if ((flags & XlibWrapper.PMinSize) != 0) {
 507                 hints.set_min_width(width);
 508                 hints.set_min_height(height);
 509             } else if ((hints.get_flags() & XlibWrapper.PMinSize) != 0) {


 530             } else if ((hints.get_flags() & XlibWrapper.PMaxSize) != 0) {
 531                 flags |= XlibWrapper.PMaxSize;
 532                 if (maxBounds != null) {
 533                     if (maxBounds.width != Integer.MAX_VALUE) {
 534                         hints.set_max_width(maxBounds.width);
 535                     } else {
 536                         hints.set_max_width(XToolkit.getDefaultScreenWidth());
 537                     }
 538                     if (maxBounds.height != Integer.MAX_VALUE) {
 539                         hints.set_max_height(maxBounds.height);
 540                     } else {
 541                         hints.set_max_height(XToolkit.getDefaultScreenHeight());
 542                     }
 543                 } else {
 544                     // Leave intact
 545                 }
 546             }
 547             flags |= XlibWrapper.PWinGravity;
 548             hints.set_flags(flags);
 549             hints.set_win_gravity((int)XlibWrapper.NorthWestGravity);
 550             if (insLog.isLoggable(Level.FINER)) {
 551                 insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +
 552                              ", values " + hints);
 553             }
 554             XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData);
 555         } finally {
 556             XToolkit.awtUnlock();
 557         }
 558     }
 559 
 560     public boolean isMinSizeSet() {
 561         XSizeHints hints = getHints();
 562         long flags = hints.get_flags();
 563         return ((flags & XlibWrapper.PMinSize) == XlibWrapper.PMinSize);
 564     }
 565 
 566     /**
 567      * This lock object can be used to protect instance data from concurrent access
 568      * by two threads. If both state lock and AWT lock are taken, AWT Lock should be taken first.
 569      */
 570     Object getStateLock() {
 571         return state_lock;
 572     }
 573 


 584 
 585     public Rectangle getBounds() {
 586         return new Rectangle(x, y, width, height);
 587     }
 588     public Dimension getSize() {
 589         return new Dimension(width, height);
 590     }
 591 
 592 
 593     public void toFront() {
 594         XToolkit.awtLock();
 595         try {
 596             XlibWrapper.XRaiseWindow(XToolkit.getDisplay(), getWindow());
 597         } finally {
 598             XToolkit.awtUnlock();
 599         }
 600     }
 601     public void xRequestFocus(long time) {
 602         XToolkit.awtLock();
 603         try {
 604             if (focusLog.isLoggable(Level.FINER)) {
 605                 focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()) + " with time " + time);
 606             }
 607             XlibWrapper.XSetInputFocus2(XToolkit.getDisplay(), getWindow(), time);
 608         } finally {
 609             XToolkit.awtUnlock();
 610         }
 611     }
 612     public void xRequestFocus() {
 613         XToolkit.awtLock();
 614         try {
 615             if (focusLog.isLoggable(Level.FINER)) {
 616                 focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()));
 617             }
 618             XlibWrapper.XSetInputFocus(XToolkit.getDisplay(), getWindow());
 619         } finally {
 620             XToolkit.awtUnlock();
 621         }
 622     }
 623 
 624     public static long xGetInputFocus() {
 625         XToolkit.awtLock();
 626         try {
 627             return XlibWrapper.XGetInputFocus(XToolkit.getDisplay());
 628         } finally {
 629             XToolkit.awtUnlock();
 630         }
 631     }
 632 
 633     public void xSetVisible(boolean visible) {
 634         if (log.isLoggable(Level.FINE)) {
 635             log.fine("Setting visible on " + this + " to " + visible);
 636         }
 637         XToolkit.awtLock();
 638         try {
 639             this.visible = visible;
 640             if (visible) {
 641                 XlibWrapper.XMapWindow(XToolkit.getDisplay(), getWindow());
 642             }
 643             else {
 644                 XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), getWindow());
 645             }
 646             XlibWrapper.XFlush(XToolkit.getDisplay());
 647         } finally {
 648             XToolkit.awtUnlock();
 649         }
 650     }
 651 
 652     boolean isMapped() {
 653         return mapped;
 654     }
 655 
 656     void updateWMName() {


 701             XToolkit.awtUnlock();
 702         }
 703     }
 704 
 705     long getScreen() {
 706         if (screen == -1) { // Not initialized
 707             screen = getScreenOfWindow(window);
 708         }
 709         return screen;
 710     }
 711 
 712     public void xSetBounds(Rectangle bounds) {
 713         xSetBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 714     }
 715 
 716     public void xSetBounds(int x, int y, int width, int height) {
 717         if (getWindow() == 0) {
 718             insLog.warning("Attempt to resize uncreated window");
 719             throw new IllegalStateException("Attempt to resize uncreated window");
 720         }
 721         if (insLog.isLoggable(Level.FINE)) {
 722             insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);
 723         }
 724         if (width <= 0) {
 725             width = 1;
 726         }
 727         if (height <= 0) {
 728             height = 1;
 729         }
 730         XToolkit.awtLock();
 731         try {
 732              XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getWindow(), x,y,width,height);
 733         } finally {
 734             XToolkit.awtUnlock();
 735         }
 736     }
 737 
 738     /**
 739      * Translate coordinates from one window into another.  Optimized
 740      * for XAWT - uses cached data when possible.  Preferable over
 741      * pure XTranslateCoordinates.
 742      * @return coordinates relative to dst, or null if error happened
 743      */


 905                 grabWindow.ungrabInputImpl();
 906                 XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime);
 907                 XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), CurrentTime);
 908                 XAwtState.setGrabWindow(null);
 909                 // we need to call XFlush() here to force ungrab
 910                 // see 6384219 for details
 911                 XlibWrapper.XFlush(XToolkit.getDisplay());
 912             }
 913         } finally {
 914             XToolkit.awtUnlock();
 915         }
 916     }
 917 
 918     // called from ungrabInput, used in popup windows to hide theirselfs in ungrabbing
 919     void ungrabInputImpl() {
 920     }
 921 
 922     static void checkSecurity() {
 923         if (XToolkit.isSecurityWarningEnabled() && XToolkit.isToolkitThread()) {
 924             StackTraceElement stack[] = (new Throwable()).getStackTrace();
 925             if (log.isLoggable(Level.WARNING)) {
 926                 log.warning(stack[1] + ": Security violation: calling user code on toolkit thread");
 927             }
 928         }
 929     }
 930 
 931     public Set<Long> getChildren() {
 932         synchronized (getStateLock()) {
 933             return new HashSet<Long>(children);
 934         }
 935     }
 936 
 937     // -------------- Event handling ----------------
 938     public void handleMapNotifyEvent(XEvent xev) {
 939         mapped = true;
 940     }
 941     public void handleUnmapNotifyEvent(XEvent xev) {
 942         mapped = false;
 943     }
 944     public void handleReparentNotifyEvent(XEvent xev) {
 945         if (eventLog.isLoggable(Level.FINER)) {
 946             XReparentEvent msg = xev.get_xreparent();
 947             eventLog.finer(msg.toString());
 948         }
 949     }


1066               return (target instanceof XWindowPeer);
1067           default:
1068               return false;
1069         }
1070     }
1071     /**
1072      * Dispatches event to the grab Window or event source window depending
1073      * on whether the grab is active and on the event type
1074      */
1075     static void dispatchToWindow(XEvent ev) {
1076         XBaseWindow target = XAwtState.getGrabWindow();
1077         if (target == null || !isGrabbedEvent(ev, target)) {
1078             target = XToolkit.windowToXWindow(ev.get_xany().get_window());
1079         }
1080         if (target != null && target.checkInitialised()) {
1081             target.dispatchEvent(ev);
1082         }
1083     }
1084 
1085     public void dispatchEvent(XEvent xev) {
1086         if (eventLog.isLoggable(Level.FINEST)) {
1087             eventLog.finest(xev.toString());
1088         }
1089         int type = xev.get_type();
1090 
1091         if (isDisposed()) {
1092             return;
1093         }
1094 
1095         switch (type)
1096         {
1097           case VisibilityNotify:
1098               handleVisibilityEvent(xev);
1099               break;
1100           case ClientMessage:
1101               handleClientMessage(xev);
1102               break;
1103           case Expose :
1104           case GraphicsExpose :
1105               handleExposeEvent(xev);
1106               break;
1107           case ButtonPress:
1108           case ButtonRelease:


< prev index next >