1 /*
2 * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
35 import java.awt.Font;
36 import java.awt.FontMetrics;
37 import java.awt.Graphics;
38 import java.awt.GraphicsConfiguration;
39 import java.awt.Image;
40 import java.awt.Insets;
41 import java.awt.Rectangle;
42 import java.awt.SystemColor;
43 import java.awt.Toolkit;
44 import java.awt.Window;
45 import java.awt.dnd.DropTarget;
46 import java.awt.dnd.peer.DropTargetPeer;
47 import java.awt.event.FocusEvent;
48 import java.awt.event.InputEvent;
49 import java.awt.event.InputMethodEvent;
50 import java.awt.event.KeyEvent;
51 import java.awt.event.MouseEvent;
52 import java.awt.event.MouseWheelEvent;
53 import java.awt.event.PaintEvent;
54 import java.awt.event.WindowEvent;
55 import java.awt.event.InvocationEvent;
56 import java.awt.image.ImageObserver;
57 import java.awt.image.ImageProducer;
58 import java.awt.image.VolatileImage;
59 import java.awt.peer.ComponentPeer;
60 import java.awt.peer.ContainerPeer;
61 import java.lang.reflect.*;
62 import java.security.*;
63 import java.util.Collection;
64 import java.util.Objects;
65 import java.util.Set;
66 import sun.util.logging.PlatformLogger;
67 import sun.awt.*;
68 import sun.awt.event.IgnorePaintEvent;
69 import sun.awt.image.SunVolatileImage;
70 import sun.awt.image.ToolkitImage;
71 import sun.java2d.BackBufferCapsProvider;
72 import sun.java2d.pipe.Region;
73
74
75 public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer,
76 BackBufferCapsProvider
77 {
78 private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XComponentPeer");
79 private static final PlatformLogger buffersLog = PlatformLogger.getLogger("sun.awt.X11.XComponentPeer.multibuffer");
80 private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XComponentPeer");
81 private static final PlatformLogger fontLog = PlatformLogger.getLogger("sun.awt.X11.font.XComponentPeer");
82 private static final PlatformLogger enableLog = PlatformLogger.getLogger("sun.awt.X11.enable.XComponentPeer");
83 private static final PlatformLogger shapeLog = PlatformLogger.getLogger("sun.awt.X11.shape.XComponentPeer");
84
85 boolean paintPending = false;
165 }
166 public boolean isReparentSupported() {
167 return System.getProperty("sun.awt.X11.XComponentPeer.reparentNotSupported", "false").equals("false");
168 }
169
170 @SuppressWarnings("deprecation")
171 public boolean isObscured() {
172 Container container = (target instanceof Container) ?
173 (Container)target : target.getParent();
174
175 if (container == null) {
176 return true;
177 }
178
179 Container parent;
180 while ((parent = container.getParent()) != null) {
181 container = parent;
182 }
183
184 if (container instanceof Window) {
185 XWindowPeer wpeer = (XWindowPeer)(container.getPeer());
186 if (wpeer != null) {
187 return (wpeer.winAttr.visibilityState !=
188 XWindowAttributesData.AWT_UNOBSCURED);
189 }
190 }
191 return true;
192 }
193
194 public boolean canDetermineObscurity() {
195 return true;
196 }
197
198 /*************************************************
199 * FOCUS STUFF
200 *************************************************/
201
202 /**
203 * Keeps the track of focused state of the _NATIVE_ window
204 */
205 boolean bHasFocus = false;
302 return false;
303 case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
304 // Currently we just generate focus events like we deal with lightweight instead of calling
305 // XSetInputFocus on native window
306 if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
307 focusLog.finer("Proceeding with request to " +
308 lightweightChild + " in " + target);
309 }
310 /**
311 * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight
312 * checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet
313 * been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record
314 * in requests list - and it breaks our requests sequence as first record on WGF should be the last
315 * focus owner which had focus before WLF. So, we should not add request record for such requests
316 * but store this component in mostRecent - and return true as before for compatibility.
317 */
318 Window parentWindow = SunToolkit.getContainingWindow(target);
319 if (parentWindow == null) {
320 return rejectFocusRequestHelper("WARNING: Parent window is null");
321 }
322 XWindowPeer wpeer = (XWindowPeer)parentWindow.getPeer();
323 if (wpeer == null) {
324 return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
325 }
326 /*
327 * Passing null 'actualFocusedWindow' as we don't want to restore focus on it
328 * when a component inside a Frame is requesting focus.
329 * See 6314575 for details.
330 */
331 boolean res = wpeer.requestWindowFocus(null);
332
333 if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
334 focusLog.finer("Requested window focus: " + res);
335 }
336 // If parent window can be made focused and has been made focused(synchronously)
337 // then we can proceed with children, otherwise we retreat.
338 if (!(res && parentWindow.isFocused())) {
339 return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
340 }
341 return XKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
342 target,
373 void handleJavaWindowFocusEvent(AWTEvent e) {
374 }
375
376 /*************************************************
377 * END OF FOCUS STUFF
378 *************************************************/
379
380
381
382 public void setVisible(boolean b) {
383 xSetVisible(b);
384 }
385
386 public void hide() {
387 setVisible(false);
388 }
389
390 /**
391 * @see java.awt.peer.ComponentPeer
392 */
393 @SuppressWarnings("deprecation")
394 public void setEnabled(final boolean value) {
395 if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
396 enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
397 }
398 boolean status = value;
399 // If any of our heavyweight ancestors are disable, we should be too
400 // See 6176875 for more information
401 final Container cp = SunToolkit.getNativeContainer(target);
402 if (cp != null) {
403 status &= ((XComponentPeer) cp.getPeer()).isEnabled();
404 }
405 synchronized (getStateLock()) {
406 if (enabled == status) {
407 return;
408 }
409 enabled = status;
410 }
411
412 if (target instanceof Container) {
413 final Component[] list = ((Container) target).getComponents();
414 for (final Component child : list) {
415 final ComponentPeer p = child.getPeer();
416 if (p != null) {
417 p.setEnabled(status && child.isEnabled());
418 }
419 }
420 }
421 repaint();
422 }
423
424 //
425 // public so aw/Window can call it
426 //
427 public final boolean isEnabled() {
428 synchronized (getStateLock()) {
429 return enabled;
430 }
431 }
432
433 @Override
434 public void paint(final Graphics g) {
435 super.paint(g);
472 }
473 if (true) {
474 switch(e.getID()) {
475 case PaintEvent.UPDATE:
476 if (log.isLoggable(PlatformLogger.Level.FINER)) {
477 log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
478 r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
479 }
480 return;
481 case PaintEvent.PAINT:
482 if (log.isLoggable(PlatformLogger.Level.FINER)) {
483 log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
484 r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
485 }
486 return;
487 }
488 }
489 }
490
491 XWindowPeer getParentTopLevel() {
492 AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
493 Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target));
494 // Search for parent window
495 while (parent != null && !(parent instanceof Window)) {
496 parent = compAccessor.getParent(parent);
497 }
498 if (parent != null) {
499 return (XWindowPeer)compAccessor.getPeer(parent);
500 } else {
501 return null;
502 }
503 }
504
505 /* This method is intended to be over-ridden by peers to perform user interaction */
506 void handleJavaMouseEvent(MouseEvent e) {
507 switch (e.getID()) {
508 case MouseEvent.MOUSE_PRESSED:
509 if (target == e.getSource() &&
510 !target.isFocusOwner() &&
511 XKeyboardFocusManagerPeer.shouldFocusOnClick(target))
512 {
1310 case SET_BOUNDS:
1311 return "SET_BOUNDS";
1312 }
1313 }
1314
1315 /**
1316 * Lowers this component at the bottom of the above HW peer. If the above parameter
1317 * is null then the method places this component at the top of the Z-order.
1318 */
1319 public void setZOrder(ComponentPeer above) {
1320 long aboveWindow = (above != null) ? ((XComponentPeer)above).getWindow() : 0;
1321
1322 XToolkit.awtLock();
1323 try{
1324 XlibWrapper.SetZOrder(XToolkit.getDisplay(), getWindow(), aboveWindow);
1325 }finally{
1326 XToolkit.awtUnlock();
1327 }
1328 }
1329
1330 @SuppressWarnings("deprecation")
1331 private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
1332 for (int i = 0; i < cont.getComponentCount(); i++) {
1333 Component comp = cont.getComponent(i);
1334 ComponentPeer peer = comp.getPeer();
1335 if (peer instanceof XComponentPeer) {
1336 Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
1337 if (!set.contains(window)) {
1338 set.add(window);
1339 order.add(window);
1340 }
1341 } else if (comp instanceof Container) {
1342 // It is lightweight container, it might contain heavyweight components attached to this
1343 // peer
1344 addTree(order, set, (Container)comp);
1345 }
1346 }
1347 }
1348
1349 /****** DropTargetPeer implementation ********************/
1350
1351 @SuppressWarnings("deprecation")
1352 public void addDropTarget(DropTarget dt) {
1353 Component comp = target;
1354 while(!(comp == null || comp instanceof Window)) {
1355 comp = comp.getParent();
1356 }
1357
1358 if (comp instanceof Window) {
1359 XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
1360 if (wpeer != null) {
1361 wpeer.addDropTarget();
1362 }
1363 }
1364 }
1365
1366 @SuppressWarnings("deprecation")
1367 public void removeDropTarget(DropTarget dt) {
1368 Component comp = target;
1369 while(!(comp == null || comp instanceof Window)) {
1370 comp = comp.getParent();
1371 }
1372
1373 if (comp instanceof Window) {
1374 XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
1375 if (wpeer != null) {
1376 wpeer.removeDropTarget();
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();
|
1 /*
2 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
35 import java.awt.Font;
36 import java.awt.FontMetrics;
37 import java.awt.Graphics;
38 import java.awt.GraphicsConfiguration;
39 import java.awt.Image;
40 import java.awt.Insets;
41 import java.awt.Rectangle;
42 import java.awt.SystemColor;
43 import java.awt.Toolkit;
44 import java.awt.Window;
45 import java.awt.dnd.DropTarget;
46 import java.awt.dnd.peer.DropTargetPeer;
47 import java.awt.event.FocusEvent;
48 import java.awt.event.InputEvent;
49 import java.awt.event.InputMethodEvent;
50 import java.awt.event.KeyEvent;
51 import java.awt.event.MouseEvent;
52 import java.awt.event.MouseWheelEvent;
53 import java.awt.event.PaintEvent;
54 import java.awt.event.WindowEvent;
55 import java.awt.image.ImageObserver;
56 import java.awt.image.ImageProducer;
57 import java.awt.image.VolatileImage;
58 import java.awt.peer.ComponentPeer;
59 import java.awt.peer.ContainerPeer;
60 import java.lang.reflect.*;
61 import java.security.*;
62 import java.util.Collection;
63 import java.util.Objects;
64 import java.util.Set;
65
66 import sun.awt.AWTAccessor.ComponentAccessor;
67 import sun.util.logging.PlatformLogger;
68 import sun.awt.*;
69 import sun.awt.event.IgnorePaintEvent;
70 import sun.awt.image.SunVolatileImage;
71 import sun.awt.image.ToolkitImage;
72 import sun.java2d.BackBufferCapsProvider;
73 import sun.java2d.pipe.Region;
74
75
76 public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer,
77 BackBufferCapsProvider
78 {
79 private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XComponentPeer");
80 private static final PlatformLogger buffersLog = PlatformLogger.getLogger("sun.awt.X11.XComponentPeer.multibuffer");
81 private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XComponentPeer");
82 private static final PlatformLogger fontLog = PlatformLogger.getLogger("sun.awt.X11.font.XComponentPeer");
83 private static final PlatformLogger enableLog = PlatformLogger.getLogger("sun.awt.X11.enable.XComponentPeer");
84 private static final PlatformLogger shapeLog = PlatformLogger.getLogger("sun.awt.X11.shape.XComponentPeer");
85
86 boolean paintPending = false;
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) {
182 container = parent;
183 }
184
185 if (container instanceof Window) {
186 XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
187 .getPeer(container);
188 if (wpeer != null) {
189 return (wpeer.winAttr.visibilityState !=
190 XWindowAttributesData.AWT_UNOBSCURED);
191 }
192 }
193 return true;
194 }
195
196 public boolean canDetermineObscurity() {
197 return true;
198 }
199
200 /*************************************************
201 * FOCUS STUFF
202 *************************************************/
203
204 /**
205 * Keeps the track of focused state of the _NATIVE_ window
206 */
207 boolean bHasFocus = false;
304 return false;
305 case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
306 // Currently we just generate focus events like we deal with lightweight instead of calling
307 // XSetInputFocus on native window
308 if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
309 focusLog.finer("Proceeding with request to " +
310 lightweightChild + " in " + target);
311 }
312 /**
313 * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight
314 * checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet
315 * been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record
316 * in requests list - and it breaks our requests sequence as first record on WGF should be the last
317 * focus owner which had focus before WLF. So, we should not add request record for such requests
318 * but store this component in mostRecent - and return true as before for compatibility.
319 */
320 Window parentWindow = SunToolkit.getContainingWindow(target);
321 if (parentWindow == null) {
322 return rejectFocusRequestHelper("WARNING: Parent window is null");
323 }
324 XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
325 .getPeer(parentWindow);
326 if (wpeer == null) {
327 return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
328 }
329 /*
330 * Passing null 'actualFocusedWindow' as we don't want to restore focus on it
331 * when a component inside a Frame is requesting focus.
332 * See 6314575 for details.
333 */
334 boolean res = wpeer.requestWindowFocus(null);
335
336 if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
337 focusLog.finer("Requested window focus: " + res);
338 }
339 // If parent window can be made focused and has been made focused(synchronously)
340 // then we can proceed with children, otherwise we retreat.
341 if (!(res && parentWindow.isFocused())) {
342 return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
343 }
344 return XKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
345 target,
376 void handleJavaWindowFocusEvent(AWTEvent e) {
377 }
378
379 /*************************************************
380 * END OF FOCUS STUFF
381 *************************************************/
382
383
384
385 public void setVisible(boolean b) {
386 xSetVisible(b);
387 }
388
389 public void hide() {
390 setVisible(false);
391 }
392
393 /**
394 * @see java.awt.peer.ComponentPeer
395 */
396 public void setEnabled(final boolean value) {
397 if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
398 enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
399 }
400 boolean status = value;
401 // If any of our heavyweight ancestors are disable, we should be too
402 // See 6176875 for more information
403 final Container cp = SunToolkit.getNativeContainer(target);
404 final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
405 if (cp != null) {
406 status &= acc.<XComponentPeer>getPeer(cp).isEnabled();
407 }
408 synchronized (getStateLock()) {
409 if (enabled == status) {
410 return;
411 }
412 enabled = status;
413 }
414
415 if (target instanceof Container) {
416 final Component[] list = ((Container) target).getComponents();
417 for (final Component child : list) {
418 final ComponentPeer p = acc.getPeer(child);
419 if (p != null) {
420 p.setEnabled(status && child.isEnabled());
421 }
422 }
423 }
424 repaint();
425 }
426
427 //
428 // public so aw/Window can call it
429 //
430 public final boolean isEnabled() {
431 synchronized (getStateLock()) {
432 return enabled;
433 }
434 }
435
436 @Override
437 public void paint(final Graphics g) {
438 super.paint(g);
475 }
476 if (true) {
477 switch(e.getID()) {
478 case PaintEvent.UPDATE:
479 if (log.isLoggable(PlatformLogger.Level.FINER)) {
480 log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
481 r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
482 }
483 return;
484 case PaintEvent.PAINT:
485 if (log.isLoggable(PlatformLogger.Level.FINER)) {
486 log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
487 r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
488 }
489 return;
490 }
491 }
492 }
493
494 XWindowPeer getParentTopLevel() {
495 ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
496 Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target));
497 // Search for parent window
498 while (parent != null && !(parent instanceof Window)) {
499 parent = compAccessor.getParent(parent);
500 }
501 if (parent != null) {
502 return (XWindowPeer)compAccessor.getPeer(parent);
503 } else {
504 return null;
505 }
506 }
507
508 /* This method is intended to be over-ridden by peers to perform user interaction */
509 void handleJavaMouseEvent(MouseEvent e) {
510 switch (e.getID()) {
511 case MouseEvent.MOUSE_PRESSED:
512 if (target == e.getSource() &&
513 !target.isFocusOwner() &&
514 XKeyboardFocusManagerPeer.shouldFocusOnClick(target))
515 {
1313 case SET_BOUNDS:
1314 return "SET_BOUNDS";
1315 }
1316 }
1317
1318 /**
1319 * Lowers this component at the bottom of the above HW peer. If the above parameter
1320 * is null then the method places this component at the top of the Z-order.
1321 */
1322 public void setZOrder(ComponentPeer above) {
1323 long aboveWindow = (above != null) ? ((XComponentPeer)above).getWindow() : 0;
1324
1325 XToolkit.awtLock();
1326 try{
1327 XlibWrapper.SetZOrder(XToolkit.getDisplay(), getWindow(), aboveWindow);
1328 }finally{
1329 XToolkit.awtUnlock();
1330 }
1331 }
1332
1333 private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
1334 for (int i = 0; i < cont.getComponentCount(); i++) {
1335 Component comp = cont.getComponent(i);
1336 Object peer = AWTAccessor.getComponentAccessor().getPeer(comp);
1337 if (peer instanceof XComponentPeer) {
1338 Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
1339 if (!set.contains(window)) {
1340 set.add(window);
1341 order.add(window);
1342 }
1343 } else if (comp instanceof Container) {
1344 // It is lightweight container, it might contain heavyweight components attached to this
1345 // peer
1346 addTree(order, set, (Container)comp);
1347 }
1348 }
1349 }
1350
1351 /****** DropTargetPeer implementation ********************/
1352
1353 public void addDropTarget(DropTarget dt) {
1354 Component comp = target;
1355 while(!(comp == null || comp instanceof Window)) {
1356 comp = comp.getParent();
1357 }
1358
1359 if (comp instanceof Window) {
1360 XWindowPeer wpeer = AWTAccessor.getComponentAccessor().getPeer(comp);
1361 if (wpeer != null) {
1362 wpeer.addDropTarget();
1363 }
1364 }
1365 }
1366
1367 public void removeDropTarget(DropTarget dt) {
1368 Component comp = target;
1369 while(!(comp == null || comp instanceof Window)) {
1370 comp = comp.getParent();
1371 }
1372
1373 if (comp instanceof Window) {
1374 XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
1375 .getPeer(comp);
1376 if (wpeer != null) {
1377 wpeer.removeDropTarget();
1378 }
1379 }
1380 }
1381
1382 /**
1383 * Applies the shape to the X-window.
1384 * @since 1.7
1385 */
1386 public void applyShape(Region shape) {
1387 if (XlibUtil.isShapingSupported()) {
1388 if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
1389 shapeLog.finer(
1390 "*** INFO: Setting shape: PEER: " + this
1391 + "; WINDOW: " + getWindow()
1392 + "; TARGET: " + target
1393 + "; SHAPE: " + shape);
1394 }
1395 XToolkit.awtLock();
|