From 81b53f401a477258e364ae638e8ec826a2f4ad32 Mon Sep 17 00:00:00 2001 From: Khaled-Dridi <95275414+Khaled-Dridi@users.noreply.github.com> Date: Tue, 7 May 2024 23:47:01 +0100 Subject: [PATCH] fix: fix windowed fullscreen overlapping taskbar on Windows (#5243) --- .../subsystem/lwjgl/LwjglDisplayDevice.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/engine/src/main/java/org/terasology/engine/core/subsystem/lwjgl/LwjglDisplayDevice.java b/engine/src/main/java/org/terasology/engine/core/subsystem/lwjgl/LwjglDisplayDevice.java index dda04be1427..44e8d40cefc 100644 --- a/engine/src/main/java/org/terasology/engine/core/subsystem/lwjgl/LwjglDisplayDevice.java +++ b/engine/src/main/java/org/terasology/engine/core/subsystem/lwjgl/LwjglDisplayDevice.java @@ -88,14 +88,18 @@ public void setDisplayModeSetting(DisplayModeSetting displayModeSetting, boolean break; case WINDOWED_FULLSCREEN: GLFWVidMode vidMode = desktopResolution.get(); - GLFW.glfwSetWindowMonitor(window, - MemoryUtil.NULL, - 0, - 0, - vidMode.width(), - vidMode.height(), - GLFW.GLFW_DONT_CARE); - GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE); + // Attempt to go into fullscreen twice to fix the taskbar showing on-top of the game on Windows. + // See also: https://github.com/MovingBlocks/Terasology/issues/5228. + for (int i = 0; i < 2; i++) { + GLFW.glfwSetWindowMonitor(window, + MemoryUtil.NULL, + 0, + 0, + vidMode.width(), + vidMode.height(), + GLFW.GLFW_DONT_CARE); + GLFW.glfwSetWindowAttrib(window, GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE); + } config.setDisplayModeSetting(displayModeSetting); config.setWindowedFullscreen(true); break;