From e0bfcca32375be2498484fe69615a00a2998760d Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Sun, 4 Jul 2010 17:14:33 +0000 Subject: [PATCH] Fix for Linux fullscreen mode problem with Compiz (http://lwjgl.org/forum/index.php/topic,3335.0.html) --- src/java/org/lwjgl/opengl/APIUtils.java | 1 + src/java/org/lwjgl/opengl/LinuxDisplay.java | 6 +++++- src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/java/org/lwjgl/opengl/APIUtils.java b/src/java/org/lwjgl/opengl/APIUtils.java index 730b8014..51ded17e 100644 --- a/src/java/org/lwjgl/opengl/APIUtils.java +++ b/src/java/org/lwjgl/opengl/APIUtils.java @@ -158,6 +158,7 @@ final class APIUtils { final InfiniteCharSequence infiniteSeq = getInfiniteSeq(); infiniteSeq.setString(string); encoder.encode(infiniteSeq.buffer, buffer, true); + infiniteSeq.clear(); } /** diff --git a/src/java/org/lwjgl/opengl/LinuxDisplay.java b/src/java/org/lwjgl/opengl/LinuxDisplay.java index 7f36ee52..8571e3f7 100644 --- a/src/java/org/lwjgl/opengl/LinuxDisplay.java +++ b/src/java/org/lwjgl/opengl/LinuxDisplay.java @@ -410,7 +410,11 @@ final class LinuxDisplay implements DisplayImplementation { ByteBuffer handle = peer_info.lockAndGetHandle(); try { current_window_mode = getWindowMode(Display.isFullscreen()); - boolean undecorated = Display.getPrivilegedBoolean("org.lwjgl.opengl.Window.undecorated") || current_window_mode != WINDOWED; + // 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()); current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window); diff --git a/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java b/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java index 39ea63aa..16320774 100644 --- a/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java +++ b/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java @@ -222,6 +222,8 @@ public class FullScreenWindowedTest { if (angleRotation > MAX_SPEED) { angleRotation = MAX_SPEED; } + + while ( Mouse.next() ); } /** * Cleans up the test