src/solaris/classes/sun/awt/X11/XWindowPeer.java

Print this page
rev 6882 : fix of 8012586
   1 /*
   2  * Copyright (c) 2002, 2010, 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


1870     }
1871 
1872     // This method is to be overriden in XDecoratedPeer.
1873     void setActualFocusedWindow(XWindowPeer actualFocusedWindow) {
1874     }
1875 
1876     /**
1877      * Applies the current window type.
1878      */
1879     private void applyWindowType() {
1880         XNETProtocol protocol = XWM.getWM().getNETProtocol();
1881         if (protocol == null) {
1882             return;
1883         }
1884 
1885         XAtom typeAtom = null;
1886 
1887         switch (getWindowType())
1888         {
1889             case NORMAL:
1890                 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_NORMAL;


1891                 break;
1892             case UTILITY:
1893                 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY;
1894                 break;
1895             case POPUP:
1896                 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_POPUP_MENU;
1897                 break;
1898         }
1899 
1900         if (typeAtom != null) {
1901             XAtomList wtype = new XAtomList();
1902             wtype.add(typeAtom);
1903             protocol.XA_NET_WM_WINDOW_TYPE.
1904                 setAtomListProperty(getWindow(), wtype);
1905         } else {
1906             protocol.XA_NET_WM_WINDOW_TYPE.
1907                 DeleteProperty(getWindow());
1908         }
1909     }
1910 


   1 /*
   2  * Copyright (c) 2002, 2013, 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


1870     }
1871 
1872     // This method is to be overriden in XDecoratedPeer.
1873     void setActualFocusedWindow(XWindowPeer actualFocusedWindow) {
1874     }
1875 
1876     /**
1877      * Applies the current window type.
1878      */
1879     private void applyWindowType() {
1880         XNETProtocol protocol = XWM.getWM().getNETProtocol();
1881         if (protocol == null) {
1882             return;
1883         }
1884 
1885         XAtom typeAtom = null;
1886 
1887         switch (getWindowType())
1888         {
1889             case NORMAL:
1890                 typeAtom = (ownerPeer == null) ? 
1891                                protocol.XA_NET_WM_WINDOW_TYPE_NORMAL : 
1892                                protocol.XA_NET_WM_WINDOW_TYPE_DIALOG;
1893                 break;
1894             case UTILITY:
1895                 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY;
1896                 break;
1897             case POPUP:
1898                 typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_POPUP_MENU;
1899                 break;
1900         }
1901 
1902         if (typeAtom != null) {
1903             XAtomList wtype = new XAtomList();
1904             wtype.add(typeAtom);
1905             protocol.XA_NET_WM_WINDOW_TYPE.
1906                 setAtomListProperty(getWindow(), wtype);
1907         } else {
1908             protocol.XA_NET_WM_WINDOW_TYPE.
1909                 DeleteProperty(getWindow());
1910         }
1911     }
1912