< prev index next >

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

Print this page


   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


 157         if (params.containsKey(EVENT_MASK)) {
 158             eventMask = ((Long)params.get(EVENT_MASK));
 159         }
 160         eventMask |= XConstants.VisibilityChangeMask;
 161         params.put(EVENT_MASK, eventMask);
 162 
 163         XA_NET_WM_STATE = XAtom.get("_NET_WM_STATE");
 164 
 165 
 166         params.put(OVERRIDE_REDIRECT, Boolean.valueOf(isOverrideRedirect()));
 167 
 168         SunToolkit.awtLock();
 169         try {
 170             windows.add(this);
 171         } finally {
 172             SunToolkit.awtUnlock();
 173         }
 174 
 175         cachedFocusableWindow = isFocusableWindow();
 176 
 177         Font f = target.getFont();
 178         if (f == null) {
 179             f = XWindow.getDefaultFont();
 180             target.setFont(f);
 181             // we should not call setFont because it will call a repaint
 182             // which the peer may not be ready to do yet.
 183         }
 184         Color c = target.getBackground();
 185         if (c == null) {
 186             Color background = SystemColor.window;
 187             target.setBackground(background);
 188             // we should not call setBackGround because it will call a repaint
 189             // which the peer may not be ready to do yet.

 190         }
 191         c = target.getForeground();
 192         if (c == null) {
 193             target.setForeground(SystemColor.windowText);
 194             // we should not call setForeGround because it will call a repaint
 195             // which the peer may not be ready to do yet.
 196         }

 197 
 198         alwaysOnTop = ((Window)target).isAlwaysOnTop() && ((Window)target).isAlwaysOnTopSupported();
 199 
 200         GraphicsConfiguration gc = getGraphicsConfiguration();
 201         ((X11GraphicsDevice)gc.getDevice()).addDisplayChangedListener(this);
 202     }
 203 
 204     protected String getWMName() {
 205         String name = target.getName();
 206         if (name == null || name.trim().equals("")) {
 207             name = " ";
 208         }
 209         return name;
 210     }
 211 
 212     private static native String getLocalHostname();
 213     private static native int getJvmPID();
 214 
 215     @SuppressWarnings("deprecation")
 216     void postInit(XCreateWindowParams params) {


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


 157         if (params.containsKey(EVENT_MASK)) {
 158             eventMask = ((Long)params.get(EVENT_MASK));
 159         }
 160         eventMask |= XConstants.VisibilityChangeMask;
 161         params.put(EVENT_MASK, eventMask);
 162 
 163         XA_NET_WM_STATE = XAtom.get("_NET_WM_STATE");
 164 
 165 
 166         params.put(OVERRIDE_REDIRECT, Boolean.valueOf(isOverrideRedirect()));
 167 
 168         SunToolkit.awtLock();
 169         try {
 170             windows.add(this);
 171         } finally {
 172             SunToolkit.awtUnlock();
 173         }
 174 
 175         cachedFocusableWindow = isFocusableWindow();
 176 
 177         if (!target.isFontSet()) {
 178                target.setFont(XWindow.getDefaultFont());


 179                // we should not call setFont because it will call a repaint
 180                // which the peer may not be ready to do yet.
 181         }
 182         if (!target.isBackgroundSet()) {
 183                target.setBackground(SystemColor.window);


 184                // we should not call setBackGround because it will call a repaint
 185                // which the peer may not be ready to do yet.
 186 
 187         }
 188         if (!target.isForegroundSet()) {

 189                target.setForeground(SystemColor.windowText);
 190                // we should not call setForeGround because it will call a repaint
 191                // which the peer may not be ready to do yet.
 192         }
 193 
 194 
 195         alwaysOnTop = ((Window)target).isAlwaysOnTop() && ((Window)target).isAlwaysOnTopSupported();
 196 
 197         GraphicsConfiguration gc = getGraphicsConfiguration();
 198         ((X11GraphicsDevice)gc.getDevice()).addDisplayChangedListener(this);
 199     }
 200 
 201     protected String getWMName() {
 202         String name = target.getName();
 203         if (name == null || name.trim().equals("")) {
 204             name = " ";
 205         }
 206         return name;
 207     }
 208 
 209     private static native String getLocalHostname();
 210     private static native int getJvmPID();
 211 
 212     @SuppressWarnings("deprecation")
 213     void postInit(XCreateWindowParams params) {


< prev index next >