jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
author ohair
Wed, 06 Apr 2011 22:06:11 -0700
changeset 9035 1255eb81cc2f
parent 7932 f4ec6ef455c3
permissions -rw-r--r--
7033660: Update copyright year to 2011 on any files changed in 2011 Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 7932
diff changeset
     2
 * Copyright (c) 1995, 2011, 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: 5275
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: 5275
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: 5275
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5275
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5275
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.motif;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.im.InputMethodHighlight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.im.spi.InputMethodDescriptor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.image.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.peer.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.datatransfer.Clipboard;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.lang.reflect.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.lang.Math;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.security.PrivilegedAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.security.PrivilegedActionException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.security.PrivilegedExceptionAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.util.Properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import java.util.Iterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import sun.awt.AppContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import sun.awt.AWTAutoShutdown;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import sun.awt.SunToolkit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import sun.awt.UNIXToolkit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import sun.awt.GlobalCursorManager;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
import sun.awt.datatransfer.DataTransferer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
import java.awt.dnd.DragSource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
import java.awt.dnd.DragGestureListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
import java.awt.dnd.DragGestureEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
import java.awt.dnd.DragGestureRecognizer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
import java.awt.dnd.MouseDragGestureRecognizer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
import java.awt.dnd.InvalidDnDOperationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
import java.awt.dnd.peer.DragSourceContextPeer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
    62
//import sun.awt.motif.MInputMethod;
3928
be186a33df9b 6795908: Refactor FontManager
rkennke
parents: 2810
diff changeset
    63
import sun.awt.X11FontManager;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
import sun.awt.X11GraphicsConfig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
import sun.awt.X11GraphicsEnvironment;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
import sun.awt.XSettings;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
    68
//import sun.awt.motif.MDragSourceContextPeer;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
import sun.print.PrintJob2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
import sun.misc.PerformanceLogger;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
import sun.misc.Unsafe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
import sun.security.action.GetBooleanAction;
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
    76
import sun.util.logging.PlatformLogger;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
public class MToolkit extends UNIXToolkit implements Runnable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
    80
    private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.motif.MToolkit");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    // the system clipboard - CLIPBOARD selection
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
    83
    //X11Clipboard clipboard;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    // the system selection - PRIMARY selection
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
    85
    //X11Clipboard selection;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    // Dynamic Layout Resize client code setting
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    protected static boolean dynamicLayoutSetting = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * True when the x settings have been loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    private boolean loadedXSettings;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * XSETTINGS for the default screen.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * <strong>XXX:</strong> see <code>MToolkit.parseXSettings</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * and <code>awt_xsettings_update</code> in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * <samp>awt_MToolkit.c</samp>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    private XSettings xs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * Note: The MToolkit object depends on the static initializer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * of X11GraphicsEnvironment to initialize the connection to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * the X11 server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    static final X11GraphicsConfig config;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    private static final boolean motifdnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        if (GraphicsEnvironment.isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            config = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            config = (X11GraphicsConfig) (GraphicsEnvironment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                             getLocalGraphicsEnvironment().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                             getDefaultScreenDevice().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                             getDefaultConfiguration());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        motifdnd = ((Boolean)java.security.AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            new GetBooleanAction("awt.dnd.motifdnd"))).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   127
    //public static final String DATA_TRANSFERER_CLASS_NAME = "sun.awt.motif.MDataTransferer";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    public MToolkit() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        if (PerformanceLogger.loggingEnabled()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            PerformanceLogger.setTime("MToolkit construction");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        if (!GraphicsEnvironment.isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            String mainClassName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            StackTraceElement trace[] = (new Throwable()).getStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            int bottom = trace.length - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            if (bottom >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                mainClassName = trace[bottom].getClassName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            if (mainClassName == null || mainClassName.equals("")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                mainClassName = "AWT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            init(mainClassName);
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   147
            //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            Thread toolkitThread = new Thread(this, "AWT-Motif");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            toolkitThread.setDaemon(true);
5275
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   152
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   153
            PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   154
                public Void run() {
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   155
                    ThreadGroup mainTG = Thread.currentThread().getThreadGroup();
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   156
                    ThreadGroup parentTG = mainTG.getParent();
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   157
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   158
                    while (parentTG != null) {
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   159
                        mainTG = parentTG;
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   160
                        parentTG = mainTG.getParent();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                    }
5275
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   162
                    Thread shutdownThread = new Thread(mainTG, new Runnable() {
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   163
                            public void run() {
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   164
                                shutdown();
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   165
                            }
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   166
                        }, "Shutdown-Thread");
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   167
                    shutdownThread.setContextClassLoader(null);
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   168
                    Runtime.getRuntime().addShutdownHook(shutdownThread);
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   169
                    return null;
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   170
                }
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   171
            };
fa9f5ce2006e 6936389: FontManager.fileCloser may cause memory leak in applets
bae
parents: 3938
diff changeset
   172
            AccessController.doPrivileged(a);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
             * Fix for 4701990.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
             * AWTAutoShutdown state must be changed before the toolkit thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
             * starts to avoid race condition.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            AWTAutoShutdown.notifyToolkitThreadBusy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            toolkitThread.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    public native void init(String mainClassName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    public native void run();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    private native void shutdown();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Create peer objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    public ButtonPeer createButton(Button target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   194
        //ButtonPeer peer = new MButtonPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   195
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   196
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   197
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    public TextFieldPeer createTextField(TextField target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   201
        //TextFieldPeer peer = new MTextFieldPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   202
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   203
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   204
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    public LabelPeer createLabel(Label target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   208
        //LabelPeer peer = new MLabelPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   209
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   210
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   211
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public ListPeer createList(List target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   215
        //ListPeer peer = new MListPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   216
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   217
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   218
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    public CheckboxPeer createCheckbox(Checkbox target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   222
        //CheckboxPeer peer = new MCheckboxPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   223
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   224
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   225
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    public ScrollbarPeer createScrollbar(Scrollbar target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   229
        //ScrollbarPeer peer = new MScrollbarPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   230
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   231
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   232
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    public ScrollPanePeer createScrollPane(ScrollPane target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   236
        //ScrollPanePeer peer = new MScrollPanePeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   237
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   238
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   239
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    public TextAreaPeer createTextArea(TextArea target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   243
        //TextAreaPeer peer = new MTextAreaPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   244
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   245
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   246
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    public ChoicePeer createChoice(Choice target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   250
        //ChoicePeer peer = new MChoicePeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   251
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   252
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   253
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    public FramePeer  createFrame(Frame target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   257
        //FramePeer peer = new MFramePeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   258
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   259
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   260
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    public CanvasPeer createCanvas(Canvas target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   264
        //CanvasPeer peer = (isXEmbedServerRequested() ? new MEmbedCanvasPeer(target) : new MCanvasPeer(target));
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   265
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   266
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   267
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    public PanelPeer createPanel(Panel target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   271
        //PanelPeer peer = new MPanelPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   272
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   273
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   274
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    public WindowPeer createWindow(Window target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   278
        //WindowPeer peer = new MWindowPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   279
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   280
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   281
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    public DialogPeer createDialog(Dialog target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   285
        //DialogPeer peer = new MDialogPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   286
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   287
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   288
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    public FileDialogPeer createFileDialog(FileDialog target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   292
        //FileDialogPeer peer = new MFileDialogPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   293
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   294
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   295
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    public MenuBarPeer createMenuBar(MenuBar target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   299
        //MenuBarPeer peer = new MMenuBarPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   300
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   301
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   302
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    public MenuPeer createMenu(Menu target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   306
        //MenuPeer peer = new MMenuPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   307
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   308
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   309
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    public PopupMenuPeer createPopupMenu(PopupMenu target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   313
        //PopupMenuPeer peer = new MPopupMenuPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   314
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   315
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   316
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    public MenuItemPeer createMenuItem(MenuItem target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   320
        //MenuItemPeer peer = new MMenuItemPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   321
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   322
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   323
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   327
        //CheckboxMenuItemPeer peer = new MCheckboxMenuItemPeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   328
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   329
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   330
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
2465
1a6452b990cf 6815946: regression: failed to build MToolkit
ant
parents: 1175
diff changeset
   333
    public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
1a6452b990cf 6815946: regression: failed to build MToolkit
ant
parents: 1175
diff changeset
   334
        return null;
1a6452b990cf 6815946: regression: failed to build MToolkit
ant
parents: 1175
diff changeset
   335
    }
1a6452b990cf 6815946: regression: failed to build MToolkit
ant
parents: 1175
diff changeset
   336
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   337
    //public MEmbeddedFramePeer createEmbeddedFrame(MEmbeddedFrame target)
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   338
    //{
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   339
        //MEmbeddedFramePeer peer = new MEmbeddedFramePeer(target);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   340
        //targetCreatedPeer(target, peer);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   341
        //return peer;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   342
    //    return null;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   343
    //}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    public FontPeer getFontPeer(String name, int style){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        return new MFontPeer(name, style);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * On X, support for dynamic layout on resizing is governed by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * window manager.  If the window manager supports it, it happens
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * automatically.  The setter method for this property is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * irrelevant on X.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    public void setDynamicLayout(boolean b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        dynamicLayoutSetting = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    protected boolean isDynamicLayoutSet() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        return dynamicLayoutSetting;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    /* Called from isDynamicLayoutActive() and from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * lazilyLoadDynamicLayoutSupportedProperty()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    protected native boolean isDynamicLayoutSupportedNative();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    public boolean isDynamicLayoutActive() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        return isDynamicLayoutSupportedNative();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    public native boolean isFrameStateSupported(int state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    public TrayIconPeer createTrayIcon(TrayIcon target) throws HeadlessException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    public SystemTrayPeer createSystemTray(SystemTray target) throws HeadlessException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    public boolean isTraySupported() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    static native ColorModel makeColorModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    static ColorModel screenmodel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    static ColorModel getStaticColorModel() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        if (screenmodel == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
            screenmodel = config.getColorModel ();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        return screenmodel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    public ColorModel getColorModel() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        return getStaticColorModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    public native int getScreenResolution();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    public Insets getScreenInsets(GraphicsConfiguration gc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        return new Insets(0,0,0,0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    protected native int getScreenWidth();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    protected native int getScreenHeight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    public FontMetrics getFontMetrics(Font font) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        // REMIND: platform font flag should be obsolete soon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        if (!RasterOutputManager.usesPlatformFont()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
            return super.getFontMetrics(font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            return X11FontMetrics.getFontMetrics(font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        return super.getFontMetrics(font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    public PrintJob getPrintJob(final Frame frame, final String doctitle,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
                                final Properties props) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        if (GraphicsEnvironment.isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
            throw new IllegalArgumentException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        PrintJob2D printJob = new PrintJob2D(frame, doctitle, props);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        if (printJob.printDialog() == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
            printJob = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        return printJob;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    public PrintJob getPrintJob(final Frame frame, final String doctitle,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                                final JobAttributes jobAttributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                                final PageAttributes pageAttributes) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        if (GraphicsEnvironment.isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
            throw new IllegalArgumentException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        PrintJob2D printJob = new PrintJob2D(frame, doctitle,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                                             jobAttributes, pageAttributes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        if (printJob.printDialog() == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            printJob = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        return printJob;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    public native void beep();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    public  Clipboard getSystemClipboard() {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   460
        //SecurityManager security = System.getSecurityManager();
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   461
        //if (security != null) {
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   462
        //  security.checkSystemClipboardAccess();
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   463
        //}
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   464
        //synchronized (this) {
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   465
        //    if (clipboard == null) {
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   466
        //        clipboard = new X11Clipboard("System", "CLIPBOARD");
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   467
        //    }
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   468
        //}
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   469
        //return clipboard;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   470
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
    public Clipboard getSystemSelection() {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   474
        //SecurityManager security = System.getSecurityManager();
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   475
        //if (security != null) {
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   476
        //    security.checkSystemClipboardAccess();
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   477
        //}
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   478
        //synchronized (this) {
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   479
        //    if (selection == null) {
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   480
        //        selection = new X11Clipboard("Selection", "PRIMARY");
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   481
        //    }
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   482
        //}
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   483
        //return selection;
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   484
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    public boolean getLockingKeyState(int key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
               key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
            throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        return getLockingKeyStateNative(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    public native boolean getLockingKeyStateNative(int key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    public native void loadSystemColors(int[] systemColors);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * Give native peers the ability to query the native container
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     * given a native component (e.g. the direct parent may be lightweight).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    public static Container getNativeContainer(Component c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        return Toolkit.getNativeContainer(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
    protected static final Object targetToPeer(Object target) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
        return SunToolkit.targetToPeer(target);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    protected static final void targetDisposedPeer(Object target, Object peer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        SunToolkit.targetDisposedPeer(target, peer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
    public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   516
        //if (MToolkit.useMotifDnD()) {
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   517
        //    return MDragSourceContextPeer.createDragSourceContextPeer(dge);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   518
        //} else {
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   519
        //    return X11DragSourceContextPeer.createDragSourceContextPeer(dge);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   520
        //}
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   521
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    public <T extends DragGestureRecognizer> T
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        createDragGestureRecognizer(Class<T> abstractRecognizerClass,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
                                    DragSource ds, Component c, int srcActions,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                                    DragGestureListener dgl)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   529
        //if (MouseDragGestureRecognizer.class.equals(abstractRecognizerClass))
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   530
        //    return (T)new MMouseDragGestureRecognizer(ds, c, srcActions, dgl);
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   531
        //else
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * Returns a new input method adapter descriptor for native input methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
    public InputMethodDescriptor getInputMethodAdapterDescriptor() throws AWTException {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   539
        return null; // return new MInputMethodDescriptor();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * Returns a style map for the input method highlight.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
    public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   546
        return null; //return MInputMethod.mapInputMethodHighlight(highlight);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     * Returns a new custom cursor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
        throws IndexOutOfBoundsException {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   554
        return null; //return new MCustomCursor(cursor, hotSpot, name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * Returns the supported cursor size
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
    public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) {
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   561
        return null; //MCustomCursor.getBestCursorSize(
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   562
            //java.lang.Math.max(1,preferredWidth), java.lang.Math.max(1,preferredHeight));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
    public int getMaximumCursorColors() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        return 2;  // Black and white.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    private final static String prefix  = "DnD.Cursor.";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
    private final static String postfix = ".32x32";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    private static final String dndPrefix  = "DnD.";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    protected Object lazilyLoadDesktopProperty(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
        if (name.startsWith(prefix)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
            String cursorName = name.substring(prefix.length(), name.length()) + postfix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
                return Cursor.getSystemCustomCursor(cursorName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
            } catch (AWTException awte) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
                System.err.println("cannot load system cursor: " + cursorName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        if (name.equals("awt.dynamicLayoutSupported")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
            return lazilyLoadDynamicLayoutSupportedProperty(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
        if (!loadedXSettings &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
            (name.startsWith("gnome.") ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
             name.equals(SunToolkit.DESKTOPFONTHINTS) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
             name.startsWith(dndPrefix))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
            loadedXSettings = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
            if (!GraphicsEnvironment.isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
                loadXSettings();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
                desktopProperties.put(SunToolkit.DESKTOPFONTHINTS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
                                      SunToolkit.getDesktopFontHints());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
                return desktopProperties.get(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
        return super.lazilyLoadDesktopProperty(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * Called from lazilyLoadDesktopProperty because we may not know if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * the user has quit the previous window manager and started another.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
    protected Boolean lazilyLoadDynamicLayoutSupportedProperty(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
        boolean nativeDynamic = isDynamicLayoutSupportedNative();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
   613
        if (log.isLoggable(PlatformLogger.FINER)) {
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 3928
diff changeset
   614
            log.finer("nativeDynamic == " + nativeDynamic);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
        return Boolean.valueOf(nativeDynamic);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    private native int getMulticlickTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    protected void initializeDesktopProperties() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
        desktopProperties.put("DnD.Autoscroll.initialDelay",     Integer.valueOf(50));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
        desktopProperties.put("DnD.Autoscroll.interval",         Integer.valueOf(50));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
        desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        /* As of 1.4, no wheel mice are supported on Solaris
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
         * however, they are on Linux, and there isn't a way to detect them,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
         * so we leave this property unset to indicate we're not sure if there's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
         * a wheel mouse or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
        //desktopProperties.put("awt.wheelMousePresent", Boolean.valueOf(false));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
        // We don't want to call getMultilclickTime() if we're headless
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        if (!GraphicsEnvironment.isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
            desktopProperties.put("awt.multiClickInterval",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
                                  Integer.valueOf(getMulticlickTime()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
            desktopProperties.put("awt.mouse.numButtons",
2810
fa49c6a06baf 6799099: All automatic regression tests that create Robot fail on X11
dav
parents: 2465
diff changeset
   639
                                  Integer.valueOf(getNumberOfButtons()));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
        /* 'target' is unused for now... */
1175
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   645
        //return new MRobotPeer(screen.getDefaultConfiguration());
026b52c440fe 6706121: makefile: unnecessary Motif classes compilation in JDK7
yan
parents: 2
diff changeset
   646
        return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    static boolean useMotifDnD() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
        return motifdnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    // The following support Gnome's equivalent of desktop properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
    // A writeup of this can be found at:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
    // http://www.freedesktop.org/standards/xsettings/xsettings.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     * Triggers a callback to parseXSettings with the x settings values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     * from the window server. Note that this will NOT call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     * parseXSettings if we are not running on a GNOME desktop.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
    private native void loadXSettings();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     * Callback from the native side indicating some, or all, of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     * desktop properties have changed and need to be reloaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * <code>data</code> is the byte array directly from the x server and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     * may be in little endian format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * NB: This could be called from any thread if triggered by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * <code>loadXSettings</code>.  It is called from the toolkit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * thread if triggered by an XSETTINGS change.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
    private void parseXSettings(int screen_XXX_ignored, byte[] data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
        // XXX: notyet: map screen -> per screen XSettings object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
        // for now native code only calls us for default screen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
        // see awt_MToolkit.c awt_xsettings_update().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
        if (xs == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
            xs = new XSettings();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
        Map updatedSettings = xs.update(data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
        if (updatedSettings == null || updatedSettings.isEmpty()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
        Iterator i = updatedSettings.entrySet().iterator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
        while (i.hasNext()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
            Map.Entry e = (Map.Entry)i.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
            String name = (String)e.getKey();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
            name = "gnome." + name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
            setDesktopProperty(name, e.getValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
            // XXX: we probably want to do something smarter.  In
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
            // particular, "Net" properties are of interest to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
            // "core" AWT itself.  E.g.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
            // Net/DndDragThreshold -> ???
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
            // Net/DoubleClickTime  -> awt.multiClickInterval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
        setDesktopProperty(SunToolkit.DESKTOPFONTHINTS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
                           SunToolkit.getDesktopFontHints());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
        Integer dragThreshold = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
        synchronized (this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
            dragThreshold = (Integer)desktopProperties.get("gnome.Net/DndDragThreshold");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
        if (dragThreshold != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
            setDesktopProperty("DnD.gestureMotionThreshold", dragThreshold);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
    protected boolean needsXEmbedImpl() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
    public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
        return (modalityType == Dialog.ModalityType.MODELESS) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
               (modalityType == Dialog.ModalityType.APPLICATION_MODAL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
    public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
        return (exclusionType == Dialog.ModalExclusionType.NO_EXCLUDE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
    private native boolean isSyncUpdated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
    private native boolean isSyncFailed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
    private native int getEventNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    private native void updateSyncSelection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
    private static final long WORKAROUND_SLEEP = 100;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * @inheritDoc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
    protected boolean syncNativeQueue(final long timeout) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
        awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
            long event_number = getEventNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
            updateSyncSelection();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
            // Wait for selection notify for oops on win
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
            long start = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
            while (!isSyncUpdated() && !isSyncFailed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
                    awtLockWait(timeout);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
                } catch (InterruptedException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
                    throw new RuntimeException(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
                // This "while" is a protection from spurious
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
                // wake-ups.  However, we shouldn't wait for too long
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                if (((System.currentTimeMillis() - start) > timeout) && (timeout >= 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
                    throw new OperationTimedOut();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
            if (isSyncFailed() && getEventNumber() - event_number == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
                awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
                    Thread.sleep(WORKAROUND_SLEEP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
                } catch (InterruptedException ie) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
                    throw new RuntimeException(ie);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
                } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
                    awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
            return getEventNumber() - event_number > 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
            awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
    public  void grab(Window w) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
        WindowPeer peer = (WindowPeer)w.getPeer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
        if (peer != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
            nativeGrab(peer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
    public void ungrab(Window w) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
        WindowPeer peer = (WindowPeer)w.getPeer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
        if (peer != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
            nativeUnGrab(peer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
    private native void nativeGrab(WindowPeer peer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
    private native void nativeUnGrab(WindowPeer peer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
    public boolean isDesktopSupported(){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
    public DesktopPeer createDesktopPeer(Desktop target)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
    throws HeadlessException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
    public final static int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
        UNDETERMINED_WM = 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
        NO_WM = 2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
        OTHER_WM = 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
        OPENLOOK_WM = 4,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
        MOTIF_WM = 5,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
        CDE_WM = 6,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
        ENLIGHTEN_WM = 7,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
        KDE2_WM = 8,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
        SAWFISH_WM = 9,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
        ICE_WM = 10,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
        METACITY_WM = 11,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
        COMPIZ_WM = 12,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
        LG3D_WM = 13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
    public static int getWMID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
        String wmName = getWMName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
        if ("NO_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
            return NO_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
        } else if ("OTHER_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
            return OTHER_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
        } else if ("ENLIGHTEN_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
            return ENLIGHTEN_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
        } else if ("KDE2_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
            return KDE2_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
        } else if ("SAWFISH_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
            return SAWFISH_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
        } else if ("ICE_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
            return ICE_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
        } else if ("METACITY_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
            return METACITY_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
        } else if ("OPENLOOK_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
            return OPENLOOK_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
        } else if ("MOTIF_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
            return MOTIF_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
        } else if ("CDE_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
            return CDE_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
        } else if ("COMPIZ_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
            return COMPIZ_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
        } else if ("LG3D_WM".equals(wmName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
            return LG3D_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
        return UNDETERMINED_WM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
    private static native String getWMName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
} // class MToolkit