Search in sources :

Example 1 with Screen

use of org.lwjgl.opengl.XRandR.Screen in project lwjgl by LWJGL.

the class LinuxDisplay method createWindow.

public void createWindow(final DrawableLWJGL drawable, DisplayMode mode, Canvas parent, int x, int y) throws LWJGLException {
    lockAWT();
    try {
        incDisplay();
        try {
            if (drawable instanceof DrawableGLES)
                peer_info = new LinuxDisplayPeerInfo();
            ByteBuffer handle = peer_info.lockAndGetHandle();
            try {
                current_window_mode = getWindowMode(Display.isFullscreen());
                // we may have trouble with stuff overlapping our fullscreen window.
                if (current_window_mode != WINDOWED)
                    Compiz.setLegacyFullscreenSupport(true);
                // Setting _MOTIF_WM_HINTS in fullscreen mode is problematic for certain window
                // managers. We do not set MWM_HINTS_DECORATIONS in fullscreen mode anymore,
                // unless org.lwjgl.opengl.Window.undecorated_fs has been specified.
                // See native/linux/org_lwjgl_opengl_Display.c, createWindow function.
                boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || (current_window_mode != WINDOWED && Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated_fs"));
                this.parent = parent;
                parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
                resizable = Display.isResizable();
                resized = false;
                window_x = x;
                window_y = y;
                window_width = mode.getWidth();
                window_height = mode.getHeight();
                // this is required to let the fullscreen window appear on the primary screen
                if (mode.isFullscreenCapable() && current_displaymode_extension == XRANDR) {
                    Screen primaryScreen = XRandR.DisplayModetoScreen(Display.getDisplayMode());
                    x = primaryScreen.xPos;
                    y = primaryScreen.yPos;
                }
                current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);
                // Set the WM_CLASS hint which is needed by some WM's e.g. Gnome Shell
                wm_class = Display.getPrivilegedString("LWJGL_WM_CLASS");
                if (wm_class == null)
                    wm_class = Display.getTitle();
                setClassHint(Display.getTitle(), wm_class);
                mapRaised(getDisplay(), current_window);
                xembedded = parent != null && isAncestorXEmbedded(parent_window);
                blank_cursor = createBlankCursor();
                current_cursor = None;
                focused = false;
                input_released = false;
                pointer_grabbed = false;
                keyboard_grabbed = false;
                close_requested = false;
                grab = false;
                minimized = false;
                dirty = true;
                if (drawable instanceof DrawableGLES)
                    ((DrawableGLES) drawable).initialize(current_window, getDisplay(), EGL.EGL_WINDOW_BIT, (org.lwjgl.opengles.PixelFormat) drawable.getPixelFormat());
                if (parent != null) {
                    parent.addFocusListener(focus_listener);
                    parent_focused = parent.isFocusOwner();
                    parent_focus_changed = true;
                }
            } finally {
                peer_info.unlock();
            }
        } catch (LWJGLException e) {
            decDisplay();
            throw e;
        }
    } finally {
        unlockAWT();
    }
}
Also used : Screen(org.lwjgl.opengl.XRandR.Screen) ByteBuffer(java.nio.ByteBuffer) LWJGLException(org.lwjgl.LWJGLException)

Aggregations

ByteBuffer (java.nio.ByteBuffer)1 LWJGLException (org.lwjgl.LWJGLException)1 Screen (org.lwjgl.opengl.XRandR.Screen)1