< prev index next >

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

Print this page




  49 import java.awt.peer.WindowPeer;
  50 import java.io.UnsupportedEncodingException;
  51 import java.security.AccessController;
  52 import java.security.PrivilegedAction;
  53 import java.util.ArrayList;
  54 import java.util.HashSet;
  55 import java.util.Iterator;
  56 import java.util.Set;
  57 import java.util.Vector;
  58 import java.util.concurrent.atomic.AtomicBoolean;
  59 
  60 import sun.awt.AWTAccessor;
  61 import sun.awt.AWTAccessor.ComponentAccessor;
  62 import sun.awt.DisplayChangedListener;
  63 import sun.awt.IconInfo;
  64 import sun.awt.SunToolkit;
  65 import sun.awt.X11GraphicsDevice;
  66 import sun.awt.X11GraphicsEnvironment;
  67 import sun.java2d.pipe.Region;
  68 import sun.util.logging.PlatformLogger;

  69 
  70 class XWindowPeer extends XPanelPeer implements WindowPeer,
  71                                                 DisplayChangedListener {
  72 
  73     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWindowPeer");
  74     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XWindowPeer");
  75     private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XWindowPeer");
  76     private static final PlatformLogger grabLog = PlatformLogger.getLogger("sun.awt.X11.grab.XWindowPeer");
  77     private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XWindowPeer");
  78 
  79     // should be synchronized on awtLock
  80     private static Set<XWindowPeer> windows = new HashSet<XWindowPeer>();
  81 
  82 
  83     private boolean cachedFocusableWindow;
  84     XWarningWindow warningWindow;
  85 
  86     private boolean alwaysOnTop;
  87     private boolean locationByPlatform;
  88 


2006         if (typeAtom != null) {
2007             XAtomList wtype = new XAtomList();
2008             wtype.add(typeAtom);
2009             protocol.XA_NET_WM_WINDOW_TYPE.
2010                 setAtomListProperty(getWindow(), wtype);
2011         } else {
2012             protocol.XA_NET_WM_WINDOW_TYPE.
2013                 DeleteProperty(getWindow());
2014         }
2015     }
2016 
2017     @Override
2018     public void xSetVisible(boolean visible) {
2019         if (log.isLoggable(PlatformLogger.Level.FINE)) {
2020             log.fine("Setting visible on " + this + " to " + visible);
2021         }
2022         XToolkit.awtLock();
2023         try {
2024             this.visible = visible;
2025             if (visible) {

















2026                 applyWindowType();
2027                 XlibWrapper.XMapRaised(XToolkit.getDisplay(), getWindow());
2028             } else {
2029                 XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), getWindow());
2030             }
2031             XlibWrapper.XFlush(XToolkit.getDisplay());
2032         }
2033         finally {
2034             XToolkit.awtUnlock();
2035         }
2036     }
2037 
2038     // should be synchronized on awtLock
2039     private int dropTargetCount = 0;
2040 
2041     public void addDropTarget() {
2042         XToolkit.awtLock();
2043         try {
2044             if (dropTargetCount == 0) {
2045                 long window = getWindow();




  49 import java.awt.peer.WindowPeer;
  50 import java.io.UnsupportedEncodingException;
  51 import java.security.AccessController;
  52 import java.security.PrivilegedAction;
  53 import java.util.ArrayList;
  54 import java.util.HashSet;
  55 import java.util.Iterator;
  56 import java.util.Set;
  57 import java.util.Vector;
  58 import java.util.concurrent.atomic.AtomicBoolean;
  59 
  60 import sun.awt.AWTAccessor;
  61 import sun.awt.AWTAccessor.ComponentAccessor;
  62 import sun.awt.DisplayChangedListener;
  63 import sun.awt.IconInfo;
  64 import sun.awt.SunToolkit;
  65 import sun.awt.X11GraphicsDevice;
  66 import sun.awt.X11GraphicsEnvironment;
  67 import sun.java2d.pipe.Region;
  68 import sun.util.logging.PlatformLogger;
  69 import sun.font.FontUtilities;
  70 
  71 class XWindowPeer extends XPanelPeer implements WindowPeer,
  72                                                 DisplayChangedListener {
  73 
  74     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XWindowPeer");
  75     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XWindowPeer");
  76     private static final PlatformLogger insLog = PlatformLogger.getLogger("sun.awt.X11.insets.XWindowPeer");
  77     private static final PlatformLogger grabLog = PlatformLogger.getLogger("sun.awt.X11.grab.XWindowPeer");
  78     private static final PlatformLogger iconLog = PlatformLogger.getLogger("sun.awt.X11.icon.XWindowPeer");
  79 
  80     // should be synchronized on awtLock
  81     private static Set<XWindowPeer> windows = new HashSet<XWindowPeer>();
  82 
  83 
  84     private boolean cachedFocusableWindow;
  85     XWarningWindow warningWindow;
  86 
  87     private boolean alwaysOnTop;
  88     private boolean locationByPlatform;
  89 


2007         if (typeAtom != null) {
2008             XAtomList wtype = new XAtomList();
2009             wtype.add(typeAtom);
2010             protocol.XA_NET_WM_WINDOW_TYPE.
2011                 setAtomListProperty(getWindow(), wtype);
2012         } else {
2013             protocol.XA_NET_WM_WINDOW_TYPE.
2014                 DeleteProperty(getWindow());
2015         }
2016     }
2017 
2018     @Override
2019     public void xSetVisible(boolean visible) {
2020         if (log.isLoggable(PlatformLogger.Level.FINE)) {
2021             log.fine("Setting visible on " + this + " to " + visible);
2022         }
2023         XToolkit.awtLock();
2024         try {
2025             this.visible = visible;
2026             if (visible) {
2027                 if (FontUtilities.isAIX) {
2028                     /* On Motif Window Manager, non-focusable window should not set WM_TAKE_FOCUS */
2029                     XAtomList currentWMProtocols = wm_protocols.getAtomListPropertyList(this);
2030                     if (isFocusableWindow()) {
2031                         if (!currentWMProtocols.contains(wm_take_focus)) {
2032                             currentWMProtocols.add(wm_take_focus);
2033                             wm_protocols.setAtomListProperty(this, currentWMProtocols);
2034                         }
2035                     } else {
2036                         if (XWM.isMotif()) {
2037                             if (currentWMProtocols.contains(wm_take_focus)) {
2038                                 currentWMProtocols.remove(wm_take_focus);
2039                                 wm_protocols.setAtomListProperty(this, currentWMProtocols);
2040                             }
2041                         }
2042                     }
2043                 }
2044                 applyWindowType();
2045                 XlibWrapper.XMapRaised(XToolkit.getDisplay(), getWindow());
2046             } else {
2047                 XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), getWindow());
2048             }
2049             XlibWrapper.XFlush(XToolkit.getDisplay());
2050         }
2051         finally {
2052             XToolkit.awtUnlock();
2053         }
2054     }
2055 
2056     // should be synchronized on awtLock
2057     private int dropTargetCount = 0;
2058 
2059     public void addDropTarget() {
2060         XToolkit.awtLock();
2061         try {
2062             if (dropTargetCount == 0) {
2063                 long window = getWindow();


< prev index next >