6447N/A * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 877N/A //There is 400 ms is set by default on Windows and 500 by default on KDE and GNOME. 877N/A //We use the same hardcoded constant. 0N/A // the system clipboard - CLIPBOARD selection 0N/A // the system selection - PRIMARY selection 0N/A // Dynamic Layout Resize client code setting 870N/A //Is it allowed to generate events assigned to extra mouse buttons. 870N/A //Set to true by default. 0N/A * True when the x settings have been loaded. 0N/A * XSETTINGS for the default screen. 3876N/A * Return (potentially) platform specific display timeout for the 0N/A // Enable warning only for internal builds 0N/A // Load Defaults from MotifLookAndFeel 0N/A // This dummy load is necessary to get SystemColor initialized. !!!!!! 0N/A log.
finer(
"X locale modifiers are not supported, using default");
870N/A //set system property if not yet assigned 0N/A * Returns whether there is last remembered cursor position. The 0N/A * position is remembered from X mouse events on our peers. The 0N/A * position is stored in <code>p</code>. 0N/A * @return true, if there is remembered last cursor position, 0N/A // Only our windows guaranteely generate MotionNotify, so we 0N/A // switch to XQueryPointer 0N/A // Leave from our window 0N/A // Entrance into our window 1975N/A // The 'window' field in this event is unused. 1975N/A // This application itself does nothing to initiate such an event 1975N/A // (no calls of XChangeKeyboardMapping etc.). 1975N/A // SunRay server sends this event to the application once on every 1975N/A // keyboard (not just layout) change which means, quite seldom. 1165N/A // Fix for 6829923: we should gracefully handle toolkit thread interruption 1165N/A // We expect interruption from the AppContext.dispose() method only. 1165N/A // If the thread is interrupted from another place, let's skip it 1165N/A // for compatibility reasons. Probably some time later we'll remove 1165N/A // the check for AppContext.isDisposed() and will unconditionally 0N/A // In the secondary loop we may have already aquired awt_lock 0N/A // several times, so waitForEvents() might be unable to release 0N/A // the awt_lock and this causes lock up. 0N/A // For now, we just avoid waitForEvents in the secondary loop. 0N/A // If no events are queued, waitForEvents() causes calls to 0N/A // awtUnlock(), awtJNI_ThreadYield, poll, awtLock(), 0N/A // so it spends most of its time in poll, without holding the lock. 0N/A // Check if input method consumes the event 0N/A * If we're running in non-Xinerama environment and the current 0N/A * window manager supports _NET protocol then the screen insets 0N/A * are calculated using _NET_WM_WORKAREA property of the root 0N/A * Otherwise, i. e. if Xinerama is on or _NET_WM_WORKAREA is 0N/A * not set, we try to calculate the insets ourselves using 0N/A * getScreenInsetsManually method. 0N/A * Manual calculation of screen insets: get all the windows with 0N/A * _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL hints and add these 0N/A * hints' values to screen insets. 0N/A * This method should be called under XToolkit.awtLock() 0N/A * During the manual calculation of screen insets we iterate 0N/A * all the X windows hierarchy starting from root window. This 0N/A * constant is the max level inspected in this hierarchy. 0N/A * 3 is a heuristic value: I suppose any the toolbar-like 0N/A * window is a child of either root or desktop window. 0N/A * Note that most of the modern window managers unmap 0N/A * application window if it is iconified. Thus, any 0N/A * _NET_WM_STRUT[_PARTIAL] hints for iconified windows 0N/A * are not included to the screen insets. 0N/A // first, check if _NET_WM_STRUT or _NET_WM_STRUT_PARTIAL are present 0N/A // if both are set on the window, _NET_WM_STRUT_PARTIAL is used (see _NET spec) 0N/A // second, verify that window is located on the proper screen 0N/A // if _NET_WM_STRUT_PARTIAL is present, we should use its values to detect 0N/A // if the struts area intersects with screenBounds, however some window 0N/A // managers don't set this hint correctly, so we just get intersection with windowBounds 0N/A * The current implementation of disabling background erasing for 0N/A * canvases is that we don't set any native background color 0N/A * (with XSetWindowBackground) for the canvas window. However, 0N/A * this color is set in the peer constructor - see 0N/A * XWindow.postInit() for details. That's why this method from 0N/A * SunToolkit is not overridden in XToolkit: it's too late to 0N/A * disable background erasing :( 0N/A public void disableBackgroundErase(Canvas canvas) { 0N/A XCanvasPeer peer = (XCanvasPeer)canvas.getPeer(); 0N/A throw new IllegalStateException("Canvas must have a valid peer"); 0N/A peer.disableBackgroundErase(); 0N/A // Need this for XMenuItemPeer. 0N/A // Need this for XMenuItemPeer. 0N/A * On X, support for dynamic layout on resizing is governed by the 0N/A * window manager. If the window manager supports it, it happens 0N/A * automatically. The setter method for this property is 0N/A /* Called from isDynamicLayoutActive() and from 0N/A * lazilyLoadDynamicLayoutSupportedProperty() 0N/A //vb157120: looks like we don't need to map menu items 0N/A //in new menus implementation 0N/A //targetCreatedPeer(target, peer); 0N/A //vb157120: looks like we don't need to map menu items 0N/A //in new menus implementation 0N/A //targetCreatedPeer(target, peer); 2520N/A * Returns the value of "sun.awt.disableGtkFileDialogs" property. Default 2328N/A // The current GtkFileChooser is available from GTK+ 2.4 0N/A //vb157120: looks like we don't need to map menu items 0N/A //in new menus implementation 0N/A //targetCreatedPeer(target, peer); 0N/A * Returns a new custom cursor. 0N/A * Returns the supported cursor size 0N/A return 2;
// Black and white. 0N/A synchronized (
this) {
0N/A synchronized (
this) {
0N/A * Returns a new input method adapter descriptor for native input methods. 5527N/A * Returns whether enableInputMethods should be set to true for peered 5527N/A * TextComponent instances on this platform. True by default. 0N/A "OpenWindows",
"MultiClickTimeout");
0N/A /* Note: OpenWindows.MultiClickTimeout is in tenths of 0N/A a second, so we need to multiply by 100 to convert to 0N/A /* Protected with awt_lock. */ 0N/A // Note: the returned timeStamp can be incorrect in this case. 1338N/A "sun.awt.shell.ShellFolderManager");
0N/A // Don't want to call getMultiClickTime() if we are headless 1224N/A * This method runs through the XPointer and XExtendedPointer array. 1224N/A * XExtendedPointer has priority because on some systems XPointer 1224N/A * (which is assigned to the virtual pointer) reports the maximum 1224N/A * capabilities of the mouse pointer (i.e. 32 physical buttons). 2773N/A //4th and 5th buttons are for wheel and shouldn't be reported as buttons. 2773N/A //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. 2773N/A //If we have 3 physical buttons and a wheel, we report 3 buttons. 2773N/A //If we have 1,2,3 physical buttons, we report it as is i.e. 1,2 or 3 respectively. 2773N/A //Assume don't have to re-query the number again and again. 4363N/A // See JavaDoc for the Toolkit.addPropertyChangeListener() method 0N/A * Initializes XAWTXSettings if a property for a given property name is provided by 0N/A * XSettings and they are not initialized yet. 0N/A * @return true if the method has initialized XAWTXSettings. 0N/A /* If no desktop font hint could be retrieved, check for 0N/A * KDE running KWin and retrieve settings from fontconfig. 0N/A * If that isn't found let SunToolkit will see if there's a 0N/A * system property set by a user. 0N/A * getDesktopHints() below will see it 0N/A * and set the public property. 0N/A * Callback from the native side indicating some, or all, of the 0N/A * desktop properties have changed and need to be reloaded. 0N/A * <code>data</code> is the byte array directly from the x server and 0N/A * may be in little endian format. 0N/A * NB: This could be called from any thread if triggered by 0N/A * <code>loadXSettings</code>. It is called from the System EDT 0N/A * if triggered by an XSETTINGS change. 0N/A // XXX: we probably want to do something smarter. In 0N/A // particular, "Net" properties are of interest to the 0N/A // "core" AWT itself. E.g. 0N/A synchronized (
this) {
0N/A /* Like XKeysymToKeycode, but ensures that keysym is the primary 0N/A * symbol on the keycode returned. Returns zero otherwise. 874N/A for(
int k =
0; k <
8; k++ ) {
874N/A continue;
// ignore zero keycode 874N/A // Now we know to which modifier is assigned the keycode 874N/A // correspondent to the keysym correspondent to the java 874N/A // keycode. We are going to check a state of this modifier. 874N/A // If a modifier is a weird one, we cannot help it. 874N/A // get any application window 0N/A /* Assign meaning - alt, meta, etc. - to X modifiers mod1 ... mod5. 0N/A * Only consider primary symbols on keycodes attached to modifiers. 0N/A /* for each keycode attached to this modifier */ 0N/A * Removed the task from the list of waiting-to-be called tasks. 0N/A * If the task has been scheduled several times removes only first one. 0N/A * Registers a Runnable which <code>run()</code> method will be called 0N/A * once on the toolkit thread when a specified interval of time elapses. 0N/A * @param task a Runnable which <code>run</code> method will be called 0N/A * on the toolkit thread when <code>interval</code> milliseconds 0N/A * @param interval an interal in milliseconds 0N/A * @throws NullPointerException if <code>task</code> is <code>null</code> 0N/A * @throws IllegalArgumentException if <code>interval</code> is not positive 1696N/A "; task being added={2}" +
"; tasks before addition={3}",
0N/A // Added task became first task - poll won't know 0N/A // about it so we need to wake it up 0N/A * Executes mature timeout tasks registered with schedule(). 0N/A * Called from run() under awtLock. 0N/A * This function converts between the X server time (number of milliseconds 0N/A * since the last server reset) and the UTC time for the 'when' field of an 0N/A * InputEvent (or another event type with a timestamp). 0N/A // ported from awt_util.c 0N/A * Because Time is of type 'unsigned long', it is possible that Time will 0N/A * never wrap when using 64-bit Xlib. However, if a 64-bit client 0N/A * connects to a 32-bit server, I suspect the values will still wrap. So 0N/A * we should not attempt to remove the wrap checking even if _LP64 is 0N/A * @see sun.awt.SunToolkit#needsXEmbedImpl 0N/A // XToolkit implements supports for XEmbed-client protocol and 0N/A // requires the supports from the embedding host for it to work. 0N/A * Returns one of XConstants: NotUseful, WhenMapped or Always. 0N/A * If backing store is not available on at least one screen, or 0N/A * java2d uses DGA(which conflicts with backing store) on at least one screen, 0N/A * or the string system property "sun.awt.backingStore" is neither "Always" 0N/A * nor "WhenMapped", then the method returns XConstants.NotUseful. 0N/A * Otherwise, if the system property "sun.awt.backingStore" is "WhenMapped", 0N/A * then the method returns XConstants.WhenMapped. 0N/A * Otherwise (i.e., if the system property "sun.awt.backingStore" is "Always"), 0N/A * the method returns XConstants.Always. 0N/A ", by default backingStore=NotUseful");
0N/A "WhenMapped" :
"Always") );
0N/A i +
", backingStore=NotUseful");
0N/A * One of XConstants: NotUseful, WhenMapped or Always. 1342N/A * Check for Xsun convention regarding numpad keys. 1342N/A * Xsun and some other servers (i.e. derived from Xsun) 1342N/A * under certain conditions process numpad keys unlike Xorg. 1067N/A If possible, initialize xkb library. 1067N/A // First, if there is extension at all. 1067N/A // There is a keyboard extension. Check if a client library is compatible. 1067N/A // If not, don't use xkb calls. 1067N/A // In this case we still may be Xkb-capable application. 1067N/A //XConstants.XkbStateNotifyMask, 1067N/A //XConstants.XkbStateNotifyMask); 1067N/A //XXX ? XkbGroupLockMask last, XkbAllStateComponentsMask before last? 1067N/A // mapping change --> refresh kbd map 1067N/A // state change --> get a new effective group; do I really need it 1067N/A // or that should be left for XkbTranslateKeyCode? 1067N/A //System.out.println("XkbNewKeyboard:"+(xke.get_new_kbd())); 1067N/A //TODO: provide a simple unit test. 1067N/A //System.out.println("XkbMap:"+(xke.get_map())); 1067N/A // May use it later e.g. to obtain an effective group etc. 1067N/A //System.out.println("XkbState:"+(xke.get_state())); 1067N/A //System.out.println("XkbEvent of xkb_type "+xkb_type); 0N/A // WM forgot to acquire selection or there is no WM 0N/A // Wait for selection notify for oops on win 0N/A // This "while" is a protection from spurious 0N/A // wake-ups. However, we shouldn't wait for too long 0N/A // If selection update failed we can simply wait some time 0N/A // hoping some events will arrive 0N/A * Returns if the java.awt.Desktop class is supported on the current 0N/A * The methods of java.awt.Desktop class are supported on the Gnome desktop. 0N/A * Check if the running desktop is Gnome by checking the window manager. 1045N/A //NOTE: it may not be supported. The actual check is being performed 1045N/A // at com.sun.awt.AWTUtilities(). In X11 we need to check 1045N/A // whether there's any translucency-capable GC available. 1065N/A * Returns the value of "sun.awt.disablegrab" property. Default