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 */ 728 static Point toOtherWindow(long src, long dst, int x, int y) { 729 Point rpt = new Point(0, 0); 730 731 // Check if both windows belong to XAWT - then no X calls are necessary 732 733 XBaseWindow srcPeer = XToolkit.windowToXWindow(src); | 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 width = Math.max(MIN_SIZE, width); 709 height = Math.max(MIN_SIZE, height); 710 XToolkit.awtLock(); 711 try { 712 XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getWindow(), x,y,width,height); 713 } finally { 714 XToolkit.awtUnlock(); 715 } 716 } 717 718 /** 719 * Translate coordinates from one window into another. Optimized 720 * for XAWT - uses cached data when possible. Preferable over 721 * pure XTranslateCoordinates. 722 * @return coordinates relative to dst, or null if error happened 723 */ 724 static Point toOtherWindow(long src, long dst, int x, int y) { 725 Point rpt = new Point(0, 0); 726 727 // Check if both windows belong to XAWT - then no X calls are necessary 728 729 XBaseWindow srcPeer = XToolkit.windowToXWindow(src); |