< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java

Print this page




 283         }
 284         params.putIfNull(PARENT_WINDOW, Long.valueOf(XToolkit.getDefaultRootWindow()));
 285         params.putIfNull(BOUNDS, new Rectangle(DEF_LOCATION, DEF_LOCATION, MIN_SIZE, MIN_SIZE));
 286         params.putIfNull(DEPTH, Integer.valueOf((int)XConstants.CopyFromParent));
 287         params.putIfNull(VISUAL, Long.valueOf(XConstants.CopyFromParent));
 288         params.putIfNull(VISUAL_CLASS, Integer.valueOf(XConstants.InputOnly));
 289         params.putIfNull(VALUE_MASK, Long.valueOf(XConstants.CWEventMask));
 290         Rectangle bounds = (Rectangle)params.get(BOUNDS);
 291         bounds.width = Math.max(MIN_SIZE, bounds.width);
 292         bounds.height = Math.max(MIN_SIZE, bounds.height);
 293 
 294         Long eventMaskObj = (Long)params.get(EVENT_MASK);
 295         long eventMask = eventMaskObj != null ? eventMaskObj.longValue() : 0;
 296         // We use our own synthetic grab see XAwtState.getGrabWindow()
 297         // (see X vol. 1, 8.3.3.2)
 298         eventMask |= XConstants.PropertyChangeMask | XConstants.OwnerGrabButtonMask;
 299         params.put(EVENT_MASK, Long.valueOf(eventMask));
 300     }
 301 
 302     /**
















 303      * Creates window with parameters specified by <code>params</code>
 304      * @see #init
 305      */
 306     private final void create(XCreateWindowParams params) {
 307         XToolkit.awtLock();
 308         try {
 309             XSetWindowAttributes xattr = new XSetWindowAttributes();
 310             try {
 311                 checkParams(params);
 312 
 313                 long value_mask = ((Long)params.get(VALUE_MASK)).longValue();
 314 
 315                 Long eventMask = (Long)params.get(EVENT_MASK);
 316                 xattr.set_event_mask(eventMask.longValue());
 317                 value_mask |= XConstants.CWEventMask;
 318 
 319                 Long border_pixel = (Long)params.get(BORDER_PIXEL);
 320                 if (border_pixel != null) {
 321                     xattr.set_border_pixel(border_pixel.longValue());
 322                     value_mask |= XConstants.CWBorderPixel;


 350                     value_mask |= XConstants.CWSaveUnder;
 351                 }
 352 
 353                 Integer backingStore = (Integer)params.get(BACKING_STORE);
 354                 if (backingStore != null) {
 355                     xattr.set_backing_store(backingStore.intValue());
 356                     value_mask |= XConstants.CWBackingStore;
 357                 }
 358 
 359                 Integer bitGravity = (Integer)params.get(BIT_GRAVITY);
 360                 if (bitGravity != null) {
 361                     xattr.set_bit_gravity(bitGravity.intValue());
 362                     value_mask |= XConstants.CWBitGravity;
 363                 }
 364 
 365                 if (log.isLoggable(PlatformLogger.Level.FINE)) {
 366                     log.fine("Creating window for " + this + " with the following attributes: \n" + params);
 367                 }
 368                 window = XlibWrapper.XCreateWindow(XToolkit.getDisplay(),
 369                                    parentWindow.longValue(),
 370                                    bounds.x, bounds.y, // location
 371                                    bounds.width, bounds.height, // size


 372                                    0, // border
 373                                    depth.intValue(), // depth
 374                                    visual_class.intValue(), // class
 375                                    visual.longValue(), // visual
 376                                    value_mask,  // value mask
 377                                    xattr.pData); // attributes
 378 
 379                 if (window == 0) {
 380                     throw new IllegalStateException("Couldn't create window because of wrong parameters. Run with NOISY_AWT to see details");
 381                 }
 382                 XToolkit.addToWinMap(window, this);
 383             } finally {
 384                 xattr.dispose();
 385             }
 386         } finally {
 387             XToolkit.awtUnlock();
 388         }
 389     }
 390 
 391     public XCreateWindowParams getDelayedParams() {


 475         if (hints == null) {
 476             long p_hints = XlibWrapper.XAllocSizeHints();
 477             hints = new XSizeHints(p_hints);
 478 //              XlibWrapper.XGetWMNormalHints(XToolkit.getDisplay(), getWindow(), p_hints, XlibWrapper.larg1);
 479             // TODO: Shouldn't we listen for WM updates on this property?
 480         }
 481         return hints;
 482     }
 483 
 484     public void setSizeHints(long flags, int x, int y, int width, int height) {
 485         if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 486             insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags));
 487         }
 488         XToolkit.awtLock();
 489         try {
 490             XSizeHints hints = getHints();
 491             // Note: if PPosition is not set in flags this means that
 492             // we want to reset PPosition in hints.  This is necessary
 493             // for locationByPlatform functionality
 494             if ((flags & XUtilConstants.PPosition) != 0) {
 495                 hints.set_x(x);
 496                 hints.set_y(y);
 497             }
 498             if ((flags & XUtilConstants.PSize) != 0) {
 499                 hints.set_width(width);
 500                 hints.set_height(height);
 501             } else if ((hints.get_flags() & XUtilConstants.PSize) != 0) {
 502                 flags |= XUtilConstants.PSize;
 503             }
 504             if ((flags & XUtilConstants.PMinSize) != 0) {
 505                 hints.set_min_width(width);
 506                 hints.set_min_height(height);
 507             } else if ((hints.get_flags() & XUtilConstants.PMinSize) != 0) {
 508                 flags |= XUtilConstants.PMinSize;
 509                 //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
 510                 //We don't need to reset minimum size if it's already set
 511             }
 512             if ((flags & XUtilConstants.PMaxSize) != 0) {
 513                 if (maxBounds != null) {
 514                     if (maxBounds.width != Integer.MAX_VALUE) {
 515                         hints.set_max_width(maxBounds.width);
 516                     } else {
 517                         hints.set_max_width(XToolkit.getDefaultScreenWidth());
 518                     }
 519                     if (maxBounds.height != Integer.MAX_VALUE) {
 520                         hints.set_max_height(maxBounds.height);
 521                     } else {
 522                         hints.set_max_height(XToolkit.getDefaultScreenHeight());
 523                     }
 524                 } else {
 525                     hints.set_max_width(width);
 526                     hints.set_max_height(height);
 527                 }
 528             } else if ((hints.get_flags() & XUtilConstants.PMaxSize) != 0) {
 529                 flags |= XUtilConstants.PMaxSize;
 530                 if (maxBounds != null) {
 531                     if (maxBounds.width != Integer.MAX_VALUE) {
 532                         hints.set_max_width(maxBounds.width);
 533                     } else {
 534                         hints.set_max_width(XToolkit.getDefaultScreenWidth());
 535                     }
 536                     if (maxBounds.height != Integer.MAX_VALUE) {
 537                         hints.set_max_height(maxBounds.height);
 538                     } else {
 539                         hints.set_max_height(XToolkit.getDefaultScreenHeight());
 540                     }
 541                 } else {
 542                     // Leave intact
 543                 }
 544             }
 545             flags |= XUtilConstants.PWinGravity;
 546             hints.set_flags(flags);
 547             hints.set_win_gravity(XConstants.NorthWestGravity);
 548             if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 549                 insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +
 550                              ", values " + hints);
 551             }
 552             XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData);
 553         } finally {
 554             XToolkit.awtUnlock();
 555         }
 556     }
 557 
 558     public boolean isMinSizeSet() {
 559         XSizeHints hints = getHints();


 706         }
 707         return screen;
 708     }
 709 
 710     public void xSetBounds(Rectangle bounds) {
 711         xSetBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 712     }
 713 
 714     public void xSetBounds(int x, int y, int width, int height) {
 715         if (getWindow() == 0) {
 716             insLog.warning("Attempt to resize uncreated window");
 717             throw new IllegalStateException("Attempt to resize uncreated window");
 718         }
 719         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
 720             insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);
 721         }
 722         width = Math.max(MIN_SIZE, width);
 723         height = Math.max(MIN_SIZE, height);
 724         XToolkit.awtLock();
 725         try {
 726              XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getWindow(), x,y,width,height);


 727         } finally {
 728             XToolkit.awtUnlock();
 729         }
 730     }
 731 
 732     /**
 733      * Translate coordinates from one window into another.  Optimized
 734      * for XAWT - uses cached data when possible.  Preferable over
 735      * pure XTranslateCoordinates.
 736      * @return coordinates relative to dst, or null if error happened
 737      */
 738     static Point toOtherWindow(long src, long dst, int x, int y) {
 739         Point rpt = new Point(0, 0);
 740 
 741         // Check if both windows belong to XAWT - then no X calls are necessary
 742 
 743         XBaseWindow srcPeer = XToolkit.windowToXWindow(src);
 744         XBaseWindow dstPeer = XToolkit.windowToXWindow(dst);
 745 
 746         if (srcPeer != null && dstPeer != null) {
 747             // (x, y) is relative to src
 748             rpt.x = x + srcPeer.getAbsoluteX() - dstPeer.getAbsoluteX();
 749             rpt.y = y + srcPeer.getAbsoluteY() - dstPeer.getAbsoluteY();
 750         } else if (dstPeer != null && XlibUtil.isRoot(src, dstPeer.getScreenNumber())) {
 751             // from root into peer
 752             rpt.x = x - dstPeer.getAbsoluteX();
 753             rpt.y = y - dstPeer.getAbsoluteY();
 754         } else if (srcPeer != null && XlibUtil.isRoot(dst, srcPeer.getScreenNumber())) {
 755             // from peer into root
 756             rpt.x = x + srcPeer.getAbsoluteX();
 757             rpt.y = y + srcPeer.getAbsoluteY();
 758         } else {
 759             rpt = XlibUtil.translateCoordinates(src, dst, new Point(x, y));

 760         }
 761         return rpt;
 762     }
 763 
 764     /*
 765      * Convert to global coordinates.
 766      */
 767     Rectangle toGlobal(Rectangle rec) {
 768         Point p = toGlobal(rec.getLocation());
 769         Rectangle newRec = new Rectangle(rec);
 770         if (p != null) {
 771             newRec.setLocation(p);
 772         }
 773         return newRec;
 774     }
 775 
 776     Point toGlobal(Point pt) {
 777         Point p = toGlobal(pt.x, pt.y);
 778         if (p != null) {
 779             return p;


1025                 }
1026                 XAwtState.setAutoGrabWindow(this);
1027             }
1028             break;
1029         case XConstants.ButtonRelease:
1030             if (isFullRelease(buttonState, xbe.get_button())) {
1031                 XAwtState.setAutoGrabWindow(null);
1032             }
1033             break;
1034         }
1035     }
1036     public void handleMotionNotify(XEvent xev) {
1037     }
1038     public void handleXCrossingEvent(XEvent xev) {
1039     }
1040     public void handleConfigureNotifyEvent(XEvent xev) {
1041         XConfigureEvent xe = xev.get_xconfigure();
1042         if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
1043             insLog.finer("Configure, {0}", xe);
1044         }
1045         x = xe.get_x();
1046         y = xe.get_y();
1047         width = xe.get_width();
1048         height = xe.get_height();

1049     }
1050     /**
1051      * Checks ButtonRelease released all Mouse buttons
1052      */
1053     static boolean isFullRelease(int buttonState, int button) {
1054         final int buttonsNumber = XToolkit.getNumberOfButtonsForMask();
1055 
1056         if (button < 0 || button > buttonsNumber) {
1057             return buttonState == 0;
1058         } else {
1059             return buttonState == XlibUtil.getButtonMask(button);
1060         }
1061     }
1062 
1063     static boolean isGrabbedEvent(XEvent ev, XBaseWindow target) {
1064         switch (ev.get_type()) {
1065           case XConstants.ButtonPress:
1066           case XConstants.ButtonRelease:
1067           case XConstants.MotionNotify:
1068           case XConstants.KeyPress:




 283         }
 284         params.putIfNull(PARENT_WINDOW, Long.valueOf(XToolkit.getDefaultRootWindow()));
 285         params.putIfNull(BOUNDS, new Rectangle(DEF_LOCATION, DEF_LOCATION, MIN_SIZE, MIN_SIZE));
 286         params.putIfNull(DEPTH, Integer.valueOf((int)XConstants.CopyFromParent));
 287         params.putIfNull(VISUAL, Long.valueOf(XConstants.CopyFromParent));
 288         params.putIfNull(VISUAL_CLASS, Integer.valueOf(XConstants.InputOnly));
 289         params.putIfNull(VALUE_MASK, Long.valueOf(XConstants.CWEventMask));
 290         Rectangle bounds = (Rectangle)params.get(BOUNDS);
 291         bounds.width = Math.max(MIN_SIZE, bounds.width);
 292         bounds.height = Math.max(MIN_SIZE, bounds.height);
 293 
 294         Long eventMaskObj = (Long)params.get(EVENT_MASK);
 295         long eventMask = eventMaskObj != null ? eventMaskObj.longValue() : 0;
 296         // We use our own synthetic grab see XAwtState.getGrabWindow()
 297         // (see X vol. 1, 8.3.3.2)
 298         eventMask |= XConstants.PropertyChangeMask | XConstants.OwnerGrabButtonMask;
 299         params.put(EVENT_MASK, Long.valueOf(eventMask));
 300     }
 301 
 302     /**
 303      * Returns scale factor of the window. It is used to convert native
 304      * coordinates to local and vice verse.
 305      */
 306     protected int getScale() {
 307         return 1;
 308     }
 309 
 310     protected int scaleUp(int x) {
 311         return x;
 312     }
 313 
 314     protected int scaleDown(int x) {
 315         return x;
 316     }
 317 
 318     /**
 319      * Creates window with parameters specified by <code>params</code>
 320      * @see #init
 321      */
 322     private final void create(XCreateWindowParams params) {
 323         XToolkit.awtLock();
 324         try {
 325             XSetWindowAttributes xattr = new XSetWindowAttributes();
 326             try {
 327                 checkParams(params);
 328 
 329                 long value_mask = ((Long)params.get(VALUE_MASK)).longValue();
 330 
 331                 Long eventMask = (Long)params.get(EVENT_MASK);
 332                 xattr.set_event_mask(eventMask.longValue());
 333                 value_mask |= XConstants.CWEventMask;
 334 
 335                 Long border_pixel = (Long)params.get(BORDER_PIXEL);
 336                 if (border_pixel != null) {
 337                     xattr.set_border_pixel(border_pixel.longValue());
 338                     value_mask |= XConstants.CWBorderPixel;


 366                     value_mask |= XConstants.CWSaveUnder;
 367                 }
 368 
 369                 Integer backingStore = (Integer)params.get(BACKING_STORE);
 370                 if (backingStore != null) {
 371                     xattr.set_backing_store(backingStore.intValue());
 372                     value_mask |= XConstants.CWBackingStore;
 373                 }
 374 
 375                 Integer bitGravity = (Integer)params.get(BIT_GRAVITY);
 376                 if (bitGravity != null) {
 377                     xattr.set_bit_gravity(bitGravity.intValue());
 378                     value_mask |= XConstants.CWBitGravity;
 379                 }
 380 
 381                 if (log.isLoggable(PlatformLogger.Level.FINE)) {
 382                     log.fine("Creating window for " + this + " with the following attributes: \n" + params);
 383                 }
 384                 window = XlibWrapper.XCreateWindow(XToolkit.getDisplay(),
 385                                                    parentWindow.longValue(),
 386                                                    scaleUp(bounds.x),
 387                                                    scaleUp(bounds.y),
 388                                                    scaleUp(bounds.width),
 389                                                    scaleUp(bounds.height),
 390                                                    0, // border
 391                                                    depth.intValue(), // depth
 392                                                    visual_class.intValue(), // class
 393                                                    visual.longValue(), // visual
 394                                                    value_mask,  // value mask
 395                                                    xattr.pData); // attributes
 396 
 397                 if (window == 0) {
 398                     throw new IllegalStateException("Couldn't create window because of wrong parameters. Run with NOISY_AWT to see details");
 399                 }
 400                 XToolkit.addToWinMap(window, this);
 401             } finally {
 402                 xattr.dispose();
 403             }
 404         } finally {
 405             XToolkit.awtUnlock();
 406         }
 407     }
 408 
 409     public XCreateWindowParams getDelayedParams() {


 493         if (hints == null) {
 494             long p_hints = XlibWrapper.XAllocSizeHints();
 495             hints = new XSizeHints(p_hints);
 496 //              XlibWrapper.XGetWMNormalHints(XToolkit.getDisplay(), getWindow(), p_hints, XlibWrapper.larg1);
 497             // TODO: Shouldn't we listen for WM updates on this property?
 498         }
 499         return hints;
 500     }
 501 
 502     public void setSizeHints(long flags, int x, int y, int width, int height) {
 503         if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 504             insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags));
 505         }
 506         XToolkit.awtLock();
 507         try {
 508             XSizeHints hints = getHints();
 509             // Note: if PPosition is not set in flags this means that
 510             // we want to reset PPosition in hints.  This is necessary
 511             // for locationByPlatform functionality
 512             if ((flags & XUtilConstants.PPosition) != 0) {
 513                 hints.set_x(scaleUp(x));
 514                 hints.set_y(scaleUp(y));
 515             }
 516             if ((flags & XUtilConstants.PSize) != 0) {
 517                 hints.set_width(scaleUp(width));
 518                 hints.set_height(scaleUp(height));
 519             } else if ((hints.get_flags() & XUtilConstants.PSize) != 0) {
 520                 flags |= XUtilConstants.PSize;
 521             }
 522             if ((flags & XUtilConstants.PMinSize) != 0) {
 523                 hints.set_min_width(scaleUp(width));
 524                 hints.set_min_height(scaleUp(height));
 525             } else if ((hints.get_flags() & XUtilConstants.PMinSize) != 0) {
 526                 flags |= XUtilConstants.PMinSize;
 527                 //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
 528                 //We don't need to reset minimum size if it's already set
 529             }
 530             if ((flags & XUtilConstants.PMaxSize) != 0) {
 531                 if (maxBounds != null) {
 532                     if (maxBounds.width != Integer.MAX_VALUE) {
 533                         hints.set_max_width(scaleUp(maxBounds.width));
 534                     } else {
 535                         hints.set_max_width(XToolkit.getDefaultScreenWidth());
 536                     }
 537                     if (maxBounds.height != Integer.MAX_VALUE) {
 538                         hints.set_max_height(scaleUp(maxBounds.height));
 539                     } else {
 540                         hints.set_max_height(XToolkit.getDefaultScreenHeight());
 541                     }
 542                 } else {
 543                     hints.set_max_width(scaleUp(width));
 544                     hints.set_max_height(scaleUp(height));
 545                 }
 546             } else if ((hints.get_flags() & XUtilConstants.PMaxSize) != 0) {
 547                 flags |= XUtilConstants.PMaxSize;
 548                 if (maxBounds != null) {
 549                     if (maxBounds.width != Integer.MAX_VALUE) {
 550                         hints.set_max_width(scaleUp(maxBounds.width));
 551                     } else {
 552                         hints.set_max_width(scaleUp(XToolkit.getDefaultScreenWidth()));
 553                     }
 554                     if (maxBounds.height != Integer.MAX_VALUE) {
 555                         hints.set_max_height(scaleUp(maxBounds.height));
 556                     } else {
 557                         hints.set_max_height(scaleUp(XToolkit.getDefaultScreenHeight()));
 558                     }
 559                 } else {
 560                     // Leave intact
 561                 }
 562             }
 563             flags |= XUtilConstants.PWinGravity;
 564             hints.set_flags(flags);
 565             hints.set_win_gravity(XConstants.NorthWestGravity);
 566             if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
 567                 insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +
 568                              ", values " + hints);
 569             }
 570             XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData);
 571         } finally {
 572             XToolkit.awtUnlock();
 573         }
 574     }
 575 
 576     public boolean isMinSizeSet() {
 577         XSizeHints hints = getHints();


 724         }
 725         return screen;
 726     }
 727 
 728     public void xSetBounds(Rectangle bounds) {
 729         xSetBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 730     }
 731 
 732     public void xSetBounds(int x, int y, int width, int height) {
 733         if (getWindow() == 0) {
 734             insLog.warning("Attempt to resize uncreated window");
 735             throw new IllegalStateException("Attempt to resize uncreated window");
 736         }
 737         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
 738             insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);
 739         }
 740         width = Math.max(MIN_SIZE, width);
 741         height = Math.max(MIN_SIZE, height);
 742         XToolkit.awtLock();
 743         try {
 744             XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getWindow(),
 745                                           scaleUp(x), scaleUp(y),
 746                                           scaleUp(width), scaleUp(height));
 747         } finally {
 748             XToolkit.awtUnlock();
 749         }
 750     }
 751 
 752     /**
 753      * Translate coordinates from one window into another.  Optimized
 754      * for XAWT - uses cached data when possible.  Preferable over
 755      * pure XTranslateCoordinates.
 756      * @return coordinates relative to dst, or null if error happened
 757      */
 758     static Point toOtherWindow(long src, long dst, int x, int y) {
 759         Point rpt = new Point(0, 0);
 760 
 761         // Check if both windows belong to XAWT - then no X calls are necessary
 762 
 763         XBaseWindow srcPeer = XToolkit.windowToXWindow(src);
 764         XBaseWindow dstPeer = XToolkit.windowToXWindow(dst);
 765 
 766         if (srcPeer != null && dstPeer != null) {
 767             // (x, y) is relative to src
 768             rpt.x = x + srcPeer.getAbsoluteX() - dstPeer.getAbsoluteX();
 769             rpt.y = y + srcPeer.getAbsoluteY() - dstPeer.getAbsoluteY();
 770         } else if (dstPeer != null && XlibUtil.isRoot(src, dstPeer.getScreenNumber())) {
 771             // from root into peer
 772             rpt.x = x - dstPeer.getAbsoluteX();
 773             rpt.y = y - dstPeer.getAbsoluteY();
 774         } else if (srcPeer != null && XlibUtil.isRoot(dst, srcPeer.getScreenNumber())) {
 775             // from peer into root
 776             rpt.x = x + srcPeer.getAbsoluteX();
 777             rpt.y = y + srcPeer.getAbsoluteY();
 778         } else {
 779             int scale = srcPeer == null ? 1 : srcPeer.getScale();
 780             rpt = XlibUtil.translateCoordinates(src, dst, new Point(x, y), scale);
 781         }
 782         return rpt;
 783     }
 784 
 785     /*
 786      * Convert to global coordinates.
 787      */
 788     Rectangle toGlobal(Rectangle rec) {
 789         Point p = toGlobal(rec.getLocation());
 790         Rectangle newRec = new Rectangle(rec);
 791         if (p != null) {
 792             newRec.setLocation(p);
 793         }
 794         return newRec;
 795     }
 796 
 797     Point toGlobal(Point pt) {
 798         Point p = toGlobal(pt.x, pt.y);
 799         if (p != null) {
 800             return p;


1046                 }
1047                 XAwtState.setAutoGrabWindow(this);
1048             }
1049             break;
1050         case XConstants.ButtonRelease:
1051             if (isFullRelease(buttonState, xbe.get_button())) {
1052                 XAwtState.setAutoGrabWindow(null);
1053             }
1054             break;
1055         }
1056     }
1057     public void handleMotionNotify(XEvent xev) {
1058     }
1059     public void handleXCrossingEvent(XEvent xev) {
1060     }
1061     public void handleConfigureNotifyEvent(XEvent xev) {
1062         XConfigureEvent xe = xev.get_xconfigure();
1063         if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
1064             insLog.finer("Configure, {0}", xe);
1065         }
1066 
1067         x = scaleDown(xe.get_x());
1068         y = scaleDown(xe.get_y());
1069         width = scaleDown(xe.get_width());
1070         height = scaleDown(xe.get_height());
1071     }
1072     /**
1073      * Checks ButtonRelease released all Mouse buttons
1074      */
1075     static boolean isFullRelease(int buttonState, int button) {
1076         final int buttonsNumber = XToolkit.getNumberOfButtonsForMask();
1077 
1078         if (button < 0 || button > buttonsNumber) {
1079             return buttonState == 0;
1080         } else {
1081             return buttonState == XlibUtil.getButtonMask(button);
1082         }
1083     }
1084 
1085     static boolean isGrabbedEvent(XEvent ev, XBaseWindow target) {
1086         switch (ev.get_type()) {
1087           case XConstants.ButtonPress:
1088           case XConstants.ButtonRelease:
1089           case XConstants.MotionNotify:
1090           case XConstants.KeyPress:


< prev index next >