jdk/src/java.desktop/unix/classes/sun/awt/X11/XlibWrapper.java
changeset 26037 508779ce6619
parent 26021 847033cb0339
parent 25859 3317bb8137f4
child 32865 f9cb6e427f9e
equal deleted inserted replaced
25992:e9b05e933ddd 26037:508779ce6619
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    24  */
    24  */
    25 
    25 
    26 package sun.awt.X11;
    26 package sun.awt.X11;
    27 
    27 
    28 import java.security.AccessController;
    28 import java.security.AccessController;
    29 import java.security.PrivilegedAction;
    29 
       
    30 import sun.misc.Unsafe;
    30 import sun.security.action.GetPropertyAction;
    31 import sun.security.action.GetPropertyAction;
    31 import sun.misc.*;
    32 
    32 
    33 final class XlibWrapper {
    33 final public class XlibWrapper
    34 
    34 {
       
    35     static Unsafe unsafe = Unsafe.getUnsafe();
    35     static Unsafe unsafe = Unsafe.getUnsafe();
    36     // strange constants
    36     // strange constants
    37     static final int MAXSIZE = 32767;
    37     static final int MAXSIZE = 32767;
    38     static final int MINSIZE = 1;
    38     static final int MINSIZE = 1;
    39 
    39 
    46 /*
    46 /*
    47    Display *XOpenDisplay(display_name)
    47    Display *XOpenDisplay(display_name)
    48    char *display_name;
    48    char *display_name;
    49 
    49 
    50 */
    50 */
    51     public final static String eventToString[]=
    51     static final String[] eventToString =
    52     {"<none:0>", "<none:1>", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease",
    52     {"<none:0>", "<none:1>", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease",
    53      "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut",
    53      "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut",
    54      "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify",
    54      "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify",
    55      "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",
    55      "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",
    56      "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify",
    56      "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify",
    64     static native void copyIntArray(long dest_ptr, Object array, int size_bytes);
    64     static native void copyIntArray(long dest_ptr, Object array, int size_bytes);
    65     static native void copyLongArray(long dest_ptr, Object array, int size_bytes);
    65     static native void copyLongArray(long dest_ptr, Object array, int size_bytes);
    66 
    66 
    67     /**
    67     /**
    68      * Gets byte string from str_ptr and copies it into byte array
    68      * Gets byte string from str_ptr and copies it into byte array
    69      * String should be NULL terminated
    69      * String should be NULL terminated.
    70      */
    70      */
    71     static native byte[] getStringBytes(long str_ptr);
    71     static native byte[] getStringBytes(long str_ptr);
    72 
    72 
    73     static  native long XOpenDisplay(long display);
    73     static  native long XOpenDisplay(long display);
    74 
    74 
   527     /*
   527     /*
   528       int (*XSynchronize(Display *display, Bool onoff))();
   528       int (*XSynchronize(Display *display, Bool onoff))();
   529           display   Specifies the connection to the X server.
   529           display   Specifies the connection to the X server.
   530           onoff     Specifies a Boolean value that indicates whether to enable or disable synchronization.
   530           onoff     Specifies a Boolean value that indicates whether to enable or disable synchronization.
   531      */
   531      */
   532     public static native int XSynchronize(long display, boolean onoff);
   532     static native int XSynchronize(long display, boolean onoff);
   533 
   533 
   534     /**
   534     /**
   535      * Extracts an X event that can be processed in a secondary loop.
   535      * Extracts an X event that can be processed in a secondary loop.
   536      * Should only be called on the toolkit thread.
   536      * Should only be called on the toolkit thread.
   537      * Returns false if this secondary event was terminated.
   537      * Returns false if this secondary event was terminated.