jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java
author chegar
Sun, 17 Aug 2014 15:54:13 +0100
changeset 25859 3317bb8137f4
parent 24553 jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java@6c9c0f5b07e0
child 30456 2a753e3fc714
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
22584
eed64ee05369 8032733: Fix cast lint warnings in client libraries
darcy
parents: 20471
diff changeset
     2
 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3938
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3938
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3938
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3938
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3938
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
20434
19c5cdb0d7a2 8025652: [macos] build failed
malenkov
parents: 20433
diff changeset
    28
import java.awt.AWTError;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.GraphicsDevice;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.Point;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.Rectangle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.io.BufferedReader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.io.FileReader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.io.FileNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.io.StreamTokenizer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.net.InetAddress;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.net.NetworkInterface;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.net.SocketException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.net.UnknownHostException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import sun.awt.motif.MFontConfiguration;
883
c3e81f0acd3d 6378099: RFE: Use libfontconfig to create/synthesise a fontconfig.properties
prr
parents: 557
diff changeset
    47
import sun.font.FcFontConfiguration;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import sun.font.Font2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import sun.font.FontManager;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import sun.font.NativeFont;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import sun.java2d.SunGraphicsEnvironment;
557
800259d3792b 6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents: 2
diff changeset
    52
import sun.java2d.SurfaceManagerFactory;
800259d3792b 6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents: 2
diff changeset
    53
import sun.java2d.UnixSurfaceManagerFactory;
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
    54
import sun.util.logging.PlatformLogger;
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
    55
import sun.java2d.xr.XRSurfaceData;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * This is an implementation of a GraphicsEnvironment object for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * default local GraphicsEnvironment used by the Java Runtime Environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * for X11 environments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * @see GraphicsDevice
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * @see GraphicsConfiguration
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
public class X11GraphicsEnvironment
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    extends SunGraphicsEnvironment
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
{
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
    68
    private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11GraphicsEnvironment");
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
    69
    private static final PlatformLogger screenLog = PlatformLogger.getLogger("sun.awt.screen.X11GraphicsEnvironment");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    private static Boolean xinerState;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        java.security.AccessController.doPrivileged(
24538
25bf8153fbfe 8039642: Fix raw and unchecked warnings in sun.awt.*
henryjen
parents: 22584
diff changeset
    75
                          new java.security.PrivilegedAction<Object>() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                System.loadLibrary("awt");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                 * Note: The MToolkit object depends on the static initializer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                 * of X11GraphicsEnvironment to initialize the connection to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                 * the X11 server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                if (!isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                    // first check the OGL system property
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                    boolean glxRequested = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                    String prop = System.getProperty("sun.java2d.opengl");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                    if (prop != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                        if (prop.equals("true") || prop.equals("t")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                            glxRequested = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                        } else if (prop.equals("True") || prop.equals("T")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                            glxRequested = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                            glxVerbose = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
    97
                    // Now check for XRender system property
10312
4df16d1321e9 7077423: Enable Xrender by default
prr
parents: 9760
diff changeset
    98
                    boolean xRenderRequested = true;
20416
c09e67746b08 8007386: On physical machine (video card is Intel Q45) the text is blank.
prr
parents: 18178
diff changeset
    99
                    boolean xRenderIgnoreLinuxVersion = false;
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   100
                    String xProp = System.getProperty("sun.java2d.xrender");
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   101
                        if (xProp != null) {
10312
4df16d1321e9 7077423: Enable Xrender by default
prr
parents: 9760
diff changeset
   102
                        if (xProp.equals("false") || xProp.equals("f")) {
4df16d1321e9 7077423: Enable Xrender by default
prr
parents: 9760
diff changeset
   103
                            xRenderRequested = false;
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   104
                        } else if (xProp.equals("True") || xProp.equals("T")) {
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   105
                            xRenderRequested = true;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   106
                            xRenderVerbose = true;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   107
                        }
20416
c09e67746b08 8007386: On physical machine (video card is Intel Q45) the text is blank.
prr
parents: 18178
diff changeset
   108
c09e67746b08 8007386: On physical machine (video card is Intel Q45) the text is blank.
prr
parents: 18178
diff changeset
   109
                        if(xProp.equalsIgnoreCase("t") || xProp.equalsIgnoreCase("true")) {
c09e67746b08 8007386: On physical machine (video card is Intel Q45) the text is blank.
prr
parents: 18178
diff changeset
   110
                            xRenderIgnoreLinuxVersion = true;
c09e67746b08 8007386: On physical machine (video card is Intel Q45) the text is blank.
prr
parents: 18178
diff changeset
   111
                        }
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   112
                    }
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   113
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                    // initialize the X11 display connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                    initDisplay(glxRequested);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                    // only attempt to initialize GLX if it was requested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                    if (glxRequested) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                        glxAvailable = initGLX();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                        if (glxVerbose && !glxAvailable) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                            System.out.println(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                                "Could not enable OpenGL " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                                "pipeline (GLX 1.3 not available)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                    }
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   126
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   127
                    // only attempt to initialize Xrender if it was requested
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   128
                    if (xRenderRequested) {
20416
c09e67746b08 8007386: On physical machine (video card is Intel Q45) the text is blank.
prr
parents: 18178
diff changeset
   129
                        xRenderAvailable = initXRender(xRenderVerbose, xRenderIgnoreLinuxVersion);
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   130
                        if (xRenderVerbose && !xRenderAvailable) {
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   131
                            System.out.println(
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   132
                                         "Could not enable XRender pipeline");
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   133
                        }
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   134
                    }
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   135
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   136
                    if (xRenderAvailable) {
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   137
                        XRSurfaceData.initXRSurfaceData();
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   138
                    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
         });
557
800259d3792b 6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents: 2
diff changeset
   144
800259d3792b 6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents: 2
diff changeset
   145
        // Install the correct surface manager factory.
800259d3792b 6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents: 2
diff changeset
   146
        SurfaceManagerFactory.setInstance(new UnixSurfaceManagerFactory());
800259d3792b 6675596: SurfaceManagerFactory should allow plugging in different implementations
tdv
parents: 2
diff changeset
   147
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   150
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    private static boolean glxAvailable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    private static boolean glxVerbose;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    private static native boolean initGLX();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    public static boolean isGLXAvailable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        return glxAvailable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    public static boolean isGLXVerbose() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        return glxVerbose;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   164
    private static boolean xRenderVerbose;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   165
    private static boolean xRenderAvailable;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   166
20416
c09e67746b08 8007386: On physical machine (video card is Intel Q45) the text is blank.
prr
parents: 18178
diff changeset
   167
    private static native boolean initXRender(boolean verbose, boolean ignoreLinuxVersion);
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   168
    public static boolean isXRenderAvailable() {
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   169
        return xRenderAvailable;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   170
    }
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   171
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   172
    public static boolean isXRenderVerbose() {
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   173
        return xRenderVerbose;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   174
    }
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3938
diff changeset
   175
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * Checks if Shared Memory extension can be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * Returns:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     *   -1 if server doesn't support MITShm
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *    1 if server supports it and it can be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *    0 otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    private static native int checkShmExt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    private static  native String getDisplayString();
1724
a22a286aa16f 6748082: remove platform-specific code from SwingUtilities2.isDisplayLocal
tdv
parents: 889
diff changeset
   186
    private Boolean isDisplayLocal;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * This should only be called from the static initializer, so no need for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * the synchronized keyword.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    private static native void initDisplay(boolean glxRequested);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    public X11GraphicsEnvironment() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    protected native int getNumScreens();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    protected GraphicsDevice makeScreenDevice(int screennum) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        return new X11GraphicsDevice(screennum);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    protected native int getDefaultScreenNum();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * Returns the default screen graphics device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    public GraphicsDevice getDefaultScreenDevice() {
20433
f6d501f12376 7117595: ArrayIndexOutOfBoundsException in Win32GraphicsEnvironment if display is removed
malenkov
parents: 18178
diff changeset
   208
        GraphicsDevice[] screens = getScreenDevices();
f6d501f12376 7117595: ArrayIndexOutOfBoundsException in Win32GraphicsEnvironment if display is removed
malenkov
parents: 18178
diff changeset
   209
        if (screens.length == 0) {
f6d501f12376 7117595: ArrayIndexOutOfBoundsException in Win32GraphicsEnvironment if display is removed
malenkov
parents: 18178
diff changeset
   210
            throw new AWTError("no screen devices");
f6d501f12376 7117595: ArrayIndexOutOfBoundsException in Win32GraphicsEnvironment if display is removed
malenkov
parents: 18178
diff changeset
   211
        }
f6d501f12376 7117595: ArrayIndexOutOfBoundsException in Win32GraphicsEnvironment if display is removed
malenkov
parents: 18178
diff changeset
   212
        int index = getDefaultScreenNum();
f6d501f12376 7117595: ArrayIndexOutOfBoundsException in Win32GraphicsEnvironment if display is removed
malenkov
parents: 18178
diff changeset
   213
        return screens[0 < index && index < screens.length ? index : 0];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
1724
a22a286aa16f 6748082: remove platform-specific code from SwingUtilities2.isDisplayLocal
tdv
parents: 889
diff changeset
   216
    public boolean isDisplayLocal() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        if (isDisplayLocal == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            SunToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                if (isDisplayLocal == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                    isDisplayLocal = Boolean.valueOf(_isDisplayLocal());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                SunToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        return isDisplayLocal.booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    private static boolean _isDisplayLocal() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        if (isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
22584
eed64ee05369 8032733: Fix cast lint warnings in client libraries
darcy
parents: 20471
diff changeset
   235
        String isRemote = java.security.AccessController.doPrivileged(
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            new sun.security.action.GetPropertyAction("sun.java2d.remote"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        if (isRemote != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            return isRemote.equals("false");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        int shm = checkShmExt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        if (shm != -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
            return (shm == 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        // If XServer doesn't support ShMem extension,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        // try the other way
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        String display = getDisplayString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        int ind = display.indexOf(':');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        final String hostName = display.substring(0, ind);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        if (ind <= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            // ':0' case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
24538
25bf8153fbfe 8039642: Fix raw and unchecked warnings in sun.awt.*
henryjen
parents: 22584
diff changeset
   257
        Boolean result = java.security.AccessController.doPrivileged(
25bf8153fbfe 8039642: Fix raw and unchecked warnings in sun.awt.*
henryjen
parents: 22584
diff changeset
   258
            new java.security.PrivilegedAction<Boolean>() {
25bf8153fbfe 8039642: Fix raw and unchecked warnings in sun.awt.*
henryjen
parents: 22584
diff changeset
   259
            public Boolean run() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                InetAddress remAddr[] = null;
24538
25bf8153fbfe 8039642: Fix raw and unchecked warnings in sun.awt.*
henryjen
parents: 22584
diff changeset
   261
                Enumeration<InetAddress> locals = null;
25bf8153fbfe 8039642: Fix raw and unchecked warnings in sun.awt.*
henryjen
parents: 22584
diff changeset
   262
                Enumeration<NetworkInterface> interfaces = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                    interfaces = NetworkInterface.getNetworkInterfaces();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                    remAddr = InetAddress.getAllByName(hostName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                    if (remAddr == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                        return Boolean.FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                } catch (UnknownHostException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                    System.err.println("Unknown host: " + hostName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                    return Boolean.FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                } catch (SocketException e1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                    System.err.println(e1.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                    return Boolean.FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
                for (; interfaces.hasMoreElements();) {
24538
25bf8153fbfe 8039642: Fix raw and unchecked warnings in sun.awt.*
henryjen
parents: 22584
diff changeset
   278
                    locals = interfaces.nextElement().getInetAddresses();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
                    for (; locals.hasMoreElements();) {
24553
6c9c0f5b07e0 8042416: X11GraphicsEnvironment.isDisplayLocal() throws NoSuchElementException if DISPLAY host has more IP addresses than a local interface
simonis
parents: 24538
diff changeset
   280
                        final InetAddress localAddr = locals.nextElement();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                        for (int i = 0; i < remAddr.length; i++) {
24553
6c9c0f5b07e0 8042416: X11GraphicsEnvironment.isDisplayLocal() throws NoSuchElementException if DISPLAY host has more IP addresses than a local interface
simonis
parents: 24538
diff changeset
   282
                            if (localAddr.equals(remAddr[i])) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                                return Boolean.TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                return Boolean.FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            }});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        return result.booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * Returns face name for default font, or null if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * no face names are used for CompositeFontDescriptors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * for this platform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    public String getDefaultFontFaceName() {
883
c3e81f0acd3d 6378099: RFE: Use libfontconfig to create/synthesise a fontconfig.properties
prr
parents: 557
diff changeset
   301
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    private static native boolean pRunningXinerama();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    private static native Point getXineramaCenterPoint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * Override for Xinerama case: call new Solaris API for getting the correct
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * centering point from the windowing system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    public Point getCenterPoint() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        if (runningXinerama()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            Point p = getXineramaCenterPoint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            if (p != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                return p;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        return super.getCenterPoint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * Override for Xinerama case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    public Rectangle getMaximumWindowBounds() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        if (runningXinerama()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            return getXineramaWindowBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            return super.getMaximumWindowBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    public boolean runningXinerama() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        if (xinerState == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            // pRunningXinerama() simply returns a global boolean variable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
            // so there is no need to synchronize here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
            xinerState = Boolean.valueOf(pRunningXinerama());
18178
ee71c923891d 8016747: Replace deprecated PlatformLogger isLoggable(int) with isLoggable(Level)
chegar
parents: 10312
diff changeset
   338
            if (screenLog.isLoggable(PlatformLogger.Level.FINER)) {
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
   339
                screenLog.finer("Running Xinerama: " + xinerState);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        return xinerState.booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * Return the bounds for a centered Window on a system running in Xinerama
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * Calculations are based on the assumption of a perfectly rectangular
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * display area (display edges line up with one another, and displays
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * have consistent width and/or height).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * The bounds to return depend on the arrangement of displays and on where
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * Windows are to be centered.  There are two common situations:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * 1) The center point lies at the center of the combined area of all the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     *    displays.  In this case, the combined area of all displays is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *    returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * 2) The center point lies at the center of a single display.  In this case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     *    the user most likely wants centered Windows to be constrained to that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *    single display.  The boundaries of the one display are returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * It is possible for the center point to be at both the center of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * entire display space AND at the center of a single monitor (a square of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * 9 monitors, for instance).  In this case, the entire display area is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * Because the center point is arbitrarily settable by the user, it could
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * fit neither of the cases above.  The fallback case is to simply return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * the combined area for all screens.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    protected Rectangle getXineramaWindowBounds() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        Point center = getCenterPoint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        Rectangle unionRect, tempRect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        GraphicsDevice[] gds = getScreenDevices();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        Rectangle centerMonitorRect = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        // if center point is at the center of all monitors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        // return union of all bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        //  MM*MM     MMM       M
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        //            M*M       *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        //            MMM       M
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        // if center point is at center of a single monitor (but not of all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        // monitors)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        // return bounds of single monitor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        // MMM         MM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        // MM*         *M
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        // else, center is in some strange spot (such as on the border between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        // monitors), and we should just return the union of all monitors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        // MM          MMM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        // MM          MMM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        unionRect = getUsableBounds(gds[0]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        for (i = 0; i < gds.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
            tempRect = getUsableBounds(gds[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            if (centerMonitorRect == null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
                // add a pixel or two for fudge-factor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
                (tempRect.width / 2) + tempRect.x > center.x - 1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
                (tempRect.height / 2) + tempRect.y > center.y - 1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
                (tempRect.width / 2) + tempRect.x < center.x + 1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                (tempRect.height / 2) + tempRect.y < center.y + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
                centerMonitorRect = tempRect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
            unionRect = unionRect.union(tempRect);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        // first: check for center of all monitors (video wall)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        // add a pixel or two for fudge-factor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        if ((unionRect.width / 2) + unionRect.x > center.x - 1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
            (unionRect.height / 2) + unionRect.y > center.y - 1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
            (unionRect.width / 2) + unionRect.x < center.x + 1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
            (unionRect.height / 2) + unionRect.y < center.y + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
18178
ee71c923891d 8016747: Replace deprecated PlatformLogger isLoggable(int) with isLoggable(Level)
chegar
parents: 10312
diff changeset
   422
            if (screenLog.isLoggable(PlatformLogger.Level.FINER)) {
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
   423
                screenLog.finer("Video Wall: center point is at center of all displays.");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            return unionRect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        // next, check if at center of one monitor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        if (centerMonitorRect != null) {
18178
ee71c923891d 8016747: Replace deprecated PlatformLogger isLoggable(int) with isLoggable(Level)
chegar
parents: 10312
diff changeset
   430
            if (screenLog.isLoggable(PlatformLogger.Level.FINER)) {
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
   431
                screenLog.finer("Center point at center of a particular " +
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
   432
                                "monitor, but not of the entire virtual display.");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            return centerMonitorRect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        // otherwise, the center is at some weird spot: return unionRect
18178
ee71c923891d 8016747: Replace deprecated PlatformLogger isLoggable(int) with isLoggable(Level)
chegar
parents: 10312
diff changeset
   438
        if (screenLog.isLoggable(PlatformLogger.Level.FINER)) {
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
   439
            screenLog.finer("Center point is somewhere strange - return union of all bounds.");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        return unionRect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * From the DisplayChangedListener interface; devices do not need
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * to react to this event.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    public void paletteChanged() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
}