JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
X11GraphicsScreen.java
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright (c) 2010 JogAmp Community. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * - Redistribution of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * - Redistribution in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of Sun Microsystems, Inc. or the names of
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * This software is provided "AS IS," without a warranty of any kind. ALL
21 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
22 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
23 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
24 * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
25 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
26 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
27 * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
28 * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
29 * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
30 * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
31 * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 */
33
34package com.jogamp.nativewindow.x11;
35
36import com.jogamp.nativewindow.AbstractGraphicsDevice;
37import com.jogamp.nativewindow.AbstractGraphicsScreen;
38import com.jogamp.nativewindow.DefaultGraphicsScreen;
39import com.jogamp.nativewindow.NativeWindowException;
40
41import jogamp.nativewindow.x11.X11Lib;
42
43/** Encapsulates a screen index on X11
44 platforms. Objects of this type are passed to {@link
45 com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration
46 GraphicsConfigurationFactory.chooseGraphicsConfiguration()} on X11
47 platforms when toolkits other than the AWT are being used. */
48
49public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneable {
50
51 /** Constructs a new X11GraphicsScreen corresponding to the given native screen index. */
52 public X11GraphicsScreen(final X11GraphicsDevice device, final int screen) {
53 super(device, device.isXineramaEnabled() ? 0 : screen);
54 }
55
56 public static AbstractGraphicsScreen createScreenDevice(final long display, final int screenIdx, final boolean owner) {
57 if(0==display) throw new NativeWindowException("display is null");
58 return new X11GraphicsScreen(new X11GraphicsDevice(display, AbstractGraphicsDevice.DEFAULT_UNIT, owner), screenIdx);
59 }
60
61 public int getVisualID() {
62 // It still could be an AWT hold handle ..
63 return X11Lib.DefaultVisualID(getDevice().getHandle(), getIndex());
64 }
65
66 @Override
67 public Object clone() {
68 return super.clone();
69 }
70}
AbstractGraphicsDevice getDevice()
Return the device this graphics configuration is valid for.
int getIndex()
Returns the screen index this graphics screen is valid for.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Encapsulates a graphics device on X11 platforms.
Encapsulates a screen index on X11 platforms.
static AbstractGraphicsScreen createScreenDevice(final long display, final int screenIdx, final boolean owner)
X11GraphicsScreen(final X11GraphicsDevice device, final int screen)
Constructs a new X11GraphicsScreen corresponding to the given native screen index.
A interface describing a graphics device in a toolkit-independent manner.
static int DEFAULT_UNIT
Default unit id for the 1st device: 0.
A interface describing a graphics screen in a toolkit-independent manner.