< prev index next >

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

Print this page




 421             XToolkit.awtUnlock();
 422         }
 423     }
 424 
 425     static XRootWindow getXAWTRootWindow() {
 426         return XRootWindow.getInstance();
 427     }
 428 
 429     void destroy() {
 430         XToolkit.awtLock();
 431         try {
 432             if (hints != null) {
 433                 XlibWrapper.XFree(hints.pData);
 434                 hints = null;
 435             }
 436             XToolkit.removeFromWinMap(getWindow(), this);
 437             XlibWrapper.XDestroyWindow(XToolkit.getDisplay(), getWindow());
 438             if (XPropertyCache.isCachingSupported()) {
 439                 XPropertyCache.clearCache(window);
 440             }
 441             window = -1;
 442             if( !isDisposed() ) {
 443                 setDisposed( true );
 444             }
 445 
 446             XAwtState.getGrabWindow(); // Magic - getGrabWindow clear state if grabbing window is disposed of.
 447         } finally {
 448             XToolkit.awtUnlock();
 449         }
 450     }
 451 
 452     void flush() {
 453         XToolkit.awtLock();
 454         try {
 455             XlibWrapper.XFlush(XToolkit.getDisplay());
 456         } finally {
 457             XToolkit.awtUnlock();
 458         }
 459     }
 460 
 461     /**


 709         XToolkit.awtLock();
 710         try {
 711             return XlibWrapper.XScreenNumberOfScreen(getScreen());
 712         } finally {
 713             XToolkit.awtUnlock();
 714         }
 715     }
 716 
 717     long getScreen() {
 718         if (screen == -1) { // Not initialized
 719             screen = getScreenOfWindow(window);
 720         }
 721         return screen;
 722     }
 723 
 724     public void xSetBounds(Rectangle bounds) {
 725         xSetBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 726     }
 727 
 728     public void xSetBounds(int x, int y, int width, int height) {



 729         if (getWindow() == 0) {
 730             insLog.warning("Attempt to resize uncreated window");
 731             throw new IllegalStateException("Attempt to resize uncreated window");
 732         }
 733         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
 734             insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);
 735         }
 736         width = Math.max(MIN_SIZE, width);
 737         height = Math.max(MIN_SIZE, height);
 738         XToolkit.awtLock();
 739         try {
 740             XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getWindow(),
 741                                           scaleUp(x), scaleUp(y),
 742                                           scaleUp(width), scaleUp(height));
 743         } finally {
 744             XToolkit.awtUnlock();
 745         }
 746     }
 747 
 748     /**




 421             XToolkit.awtUnlock();
 422         }
 423     }
 424 
 425     static XRootWindow getXAWTRootWindow() {
 426         return XRootWindow.getInstance();
 427     }
 428 
 429     void destroy() {
 430         XToolkit.awtLock();
 431         try {
 432             if (hints != null) {
 433                 XlibWrapper.XFree(hints.pData);
 434                 hints = null;
 435             }
 436             XToolkit.removeFromWinMap(getWindow(), this);
 437             XlibWrapper.XDestroyWindow(XToolkit.getDisplay(), getWindow());
 438             if (XPropertyCache.isCachingSupported()) {
 439                 XPropertyCache.clearCache(window);
 440             }
 441             window = 0;
 442             if( !isDisposed() ) {
 443                 setDisposed( true );
 444             }
 445 
 446             XAwtState.getGrabWindow(); // Magic - getGrabWindow clear state if grabbing window is disposed of.
 447         } finally {
 448             XToolkit.awtUnlock();
 449         }
 450     }
 451 
 452     void flush() {
 453         XToolkit.awtLock();
 454         try {
 455             XlibWrapper.XFlush(XToolkit.getDisplay());
 456         } finally {
 457             XToolkit.awtUnlock();
 458         }
 459     }
 460 
 461     /**


 709         XToolkit.awtLock();
 710         try {
 711             return XlibWrapper.XScreenNumberOfScreen(getScreen());
 712         } finally {
 713             XToolkit.awtUnlock();
 714         }
 715     }
 716 
 717     long getScreen() {
 718         if (screen == -1) { // Not initialized
 719             screen = getScreenOfWindow(window);
 720         }
 721         return screen;
 722     }
 723 
 724     public void xSetBounds(Rectangle bounds) {
 725         xSetBounds(bounds.x, bounds.y, bounds.width, bounds.height);
 726     }
 727 
 728     public void xSetBounds(int x, int y, int width, int height) {
 729         if (isDisposed()) {
 730             return;
 731         }
 732         if (getWindow() == 0) {
 733             insLog.warning("Attempt to resize uncreated window");
 734             throw new IllegalStateException("Attempt to resize uncreated window");
 735         }
 736         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
 737             insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);
 738         }
 739         width = Math.max(MIN_SIZE, width);
 740         height = Math.max(MIN_SIZE, height);
 741         XToolkit.awtLock();
 742         try {
 743             XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getWindow(),
 744                                           scaleUp(x), scaleUp(y),
 745                                           scaleUp(width), scaleUp(height));
 746         } finally {
 747             XToolkit.awtUnlock();
 748         }
 749     }
 750 
 751     /**


< prev index next >