modules/graphics/src/main/java/com/sun/glass/ui/monocle/x11/X11Screen.java

Print this page




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.glass.ui.monocle.x11;
  27 
  28 import com.sun.glass.ui.Pixels;
  29 import com.sun.glass.ui.monocle.NativeScreen;
  30 
  31 import java.nio.Buffer;
  32 import java.nio.IntBuffer;
  33 import java.security.AccessController;
  34 import java.security.PrivilegedAction;
  35 
  36 public class X11Screen implements NativeScreen {
  37 
  38     private int depth;
  39     private int nativeFormat;
  40     private int width;
  41     private int height;
  42     private long nativeHandle;
  43     private long display;
  44 
  45     public X11Screen(boolean showCursor) {
  46         display = X.XOpenDisplay(null);
  47         if (display == 0l) {
  48             throw new NullPointerException("Cannot open X11 display");
  49         }
  50         long screen = X.DefaultScreenOfDisplay(display);
  51         X.XSetWindowAttributes attrs = new X.XSetWindowAttributes();
  52         attrs.setEventMask(attrs.p,
  53                            X.ButtonPressMask | X.ButtonReleaseMask
  54                                    | X.PointerMotionMask);
  55         long cwMask = X.CWEventMask;
  56         if (!showCursor) {




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.glass.ui.monocle.x11;
  27 
  28 import com.sun.glass.ui.Pixels;
  29 import com.sun.glass.ui.monocle.NativeScreen;
  30 
  31 import java.nio.Buffer;
  32 import java.nio.IntBuffer;
  33 import java.security.AccessController;
  34 import java.security.PrivilegedAction;
  35 
  36 public class X11Screen extends NativeScreen {
  37 
  38     private int depth;
  39     private int nativeFormat;
  40     private int width;
  41     private int height;
  42     private long nativeHandle;
  43     private long display;
  44 
  45     public X11Screen(boolean showCursor) {
  46         display = X.XOpenDisplay(null);
  47         if (display == 0l) {
  48             throw new NullPointerException("Cannot open X11 display");
  49         }
  50         long screen = X.DefaultScreenOfDisplay(display);
  51         X.XSetWindowAttributes attrs = new X.XSetWindowAttributes();
  52         attrs.setEventMask(attrs.p,
  53                            X.ButtonPressMask | X.ButtonReleaseMask
  54                                    | X.PointerMotionMask);
  55         long cwMask = X.CWEventMask;
  56         if (!showCursor) {