141 if (isInitialReshape()) {
142 Rectangle r = target.getBounds();
143 reshape(r.x, r.y, r.width, r.height);
144 }
145
146 setEnabled(target.isEnabled());
147
148 if (target.isVisible()) {
149 setVisible(true);
150 }
151 }
152
153 protected boolean isInitialReshape() {
154 return true;
155 }
156
157 public void reparent(ContainerPeer newNativeParent) {
158 XComponentPeer newPeer = (XComponentPeer)newNativeParent;
159 XToolkit.awtLock();
160 try {
161 XlibWrapper.XReparentWindow(XToolkit.getDisplay(), getWindow(), newPeer.getContentWindow(), x, y);
162 parentWindow = newPeer;
163 } finally {
164 XToolkit.awtUnlock();
165 }
166 }
167 public boolean isReparentSupported() {
168 return System.getProperty("sun.awt.X11.XComponentPeer.reparentNotSupported", "false").equals("false");
169 }
170
171 @SuppressWarnings("deprecation")
172 public boolean isObscured() {
173 Container container = (target instanceof Container) ?
174 (Container)target : target.getParent();
175
176 if (container == null) {
177 return true;
178 }
179
180 Container parent;
181 while ((parent = container.getParent()) != null) {
1377 }
1378 }
1379 }
1380
1381 /**
1382 * Applies the shape to the X-window.
1383 * @since 1.7
1384 */
1385 public void applyShape(Region shape) {
1386 if (XlibUtil.isShapingSupported()) {
1387 if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
1388 shapeLog.finer(
1389 "*** INFO: Setting shape: PEER: " + this
1390 + "; WINDOW: " + getWindow()
1391 + "; TARGET: " + target
1392 + "; SHAPE: " + shape);
1393 }
1394 XToolkit.awtLock();
1395 try {
1396 if (shape != null) {
1397 XlibWrapper.SetRectangularShape(
1398 XToolkit.getDisplay(),
1399 getWindow(),
1400 shape.getLoX(), shape.getLoY(),
1401 shape.getHiX(), shape.getHiY(),
1402 (shape.isRectangular() ? null : shape)
1403 );
1404 } else {
1405 XlibWrapper.SetRectangularShape(
1406 XToolkit.getDisplay(),
1407 getWindow(),
1408 0, 0,
1409 0, 0,
1410 null
1411 );
1412 }
1413 } finally {
1414 XToolkit.awtUnlock();
1415 }
1416 } else {
|
141 if (isInitialReshape()) {
142 Rectangle r = target.getBounds();
143 reshape(r.x, r.y, r.width, r.height);
144 }
145
146 setEnabled(target.isEnabled());
147
148 if (target.isVisible()) {
149 setVisible(true);
150 }
151 }
152
153 protected boolean isInitialReshape() {
154 return true;
155 }
156
157 public void reparent(ContainerPeer newNativeParent) {
158 XComponentPeer newPeer = (XComponentPeer)newNativeParent;
159 XToolkit.awtLock();
160 try {
161 XlibWrapper.XReparentWindow(XToolkit.getDisplay(),
162 getWindow(), newPeer.getContentWindow(),
163 scaleUp(x), scaleUp(y));
164 parentWindow = newPeer;
165 } finally {
166 XToolkit.awtUnlock();
167 }
168 }
169 public boolean isReparentSupported() {
170 return System.getProperty("sun.awt.X11.XComponentPeer.reparentNotSupported", "false").equals("false");
171 }
172
173 @SuppressWarnings("deprecation")
174 public boolean isObscured() {
175 Container container = (target instanceof Container) ?
176 (Container)target : target.getParent();
177
178 if (container == null) {
179 return true;
180 }
181
182 Container parent;
183 while ((parent = container.getParent()) != null) {
1379 }
1380 }
1381 }
1382
1383 /**
1384 * Applies the shape to the X-window.
1385 * @since 1.7
1386 */
1387 public void applyShape(Region shape) {
1388 if (XlibUtil.isShapingSupported()) {
1389 if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
1390 shapeLog.finer(
1391 "*** INFO: Setting shape: PEER: " + this
1392 + "; WINDOW: " + getWindow()
1393 + "; TARGET: " + target
1394 + "; SHAPE: " + shape);
1395 }
1396 XToolkit.awtLock();
1397 try {
1398 if (shape != null) {
1399
1400 int scale = getScale();
1401 if (scale != 1) {
1402 shape = shape.getScaledRegion(scale, scale);
1403 }
1404
1405 XlibWrapper.SetRectangularShape(
1406 XToolkit.getDisplay(),
1407 getWindow(),
1408 shape.getLoX(), shape.getLoY(),
1409 shape.getHiX(), shape.getHiY(),
1410 (shape.isRectangular() ? null : shape)
1411 );
1412 } else {
1413 XlibWrapper.SetRectangularShape(
1414 XToolkit.getDisplay(),
1415 getWindow(),
1416 0, 0,
1417 0, 0,
1418 null
1419 );
1420 }
1421 } finally {
1422 XToolkit.awtUnlock();
1423 }
1424 } else {
|