From 775af3f6127a9bba6ec569f918183b8cf08e6eb3 Mon Sep 17 00:00:00 2001 From: stephengold Date: Tue, 22 Oct 2024 15:35:31 -0700 Subject: [PATCH 1/5] update LWJGL3 to v3.3.4 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 655e7e6a83..2ce41a862b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ [versions] checkstyle = "9.3" -lwjgl3 = "3.3.3" +lwjgl3 = "3.3.4" nifty = "1.4.3" [libraries] From 7b9e16ef9e370e02393574c41f76ac82cd755373 Mon Sep 17 00:00:00 2001 From: stephengold Date: Sun, 27 Oct 2024 09:57:29 -0700 Subject: [PATCH 2/5] bypass window positioning on Wayland platforms --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index 24a02bcd13..d7794d9964 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2023 jMonkeyEngine + * Copyright (c) 2009-2024 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -319,7 +319,9 @@ public void invoke(final long window, final boolean focus) { } }); - if (!settings.isFullscreen()) { + int platformId = glfwGetPlatform(); + if (platformId != GLFW_PLATFORM_WAYLAND && !settings.isFullscreen()) { + // Wayland doesn't support window positioning. if (settings.getCenterWindow()) { // Center the window glfwSetWindowPos(window, From a9261695b8259576ffc1dd68102432aff7d2545a Mon Sep 17 00:00:00 2001 From: stephengold Date: Fri, 10 Jan 2025 11:41:10 -0800 Subject: [PATCH 3/5] avoid invoking glfwSetWindowIcon() on Wayland --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index d7794d9964..582a72c435 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -424,6 +424,10 @@ protected void showWindow() { * @param settings settings for getting the icons */ protected void setWindowIcon(final AppSettings settings) { + if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) { + // Wayland doesn't support custom icons. + return; + } final Object[] icons = settings.getIcons(); if (icons == null) return; From 7717e7e46b2d733cb41d6dd07fb06f57ad38cf41 Mon Sep 17 00:00:00 2001 From: stephengold Date: Fri, 10 Jan 2025 11:41:42 -0800 Subject: [PATCH 4/5] LwjglWindow: update copyright notice for the new year --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index 582a72c435..aff46c69e9 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2024 jMonkeyEngine + * Copyright (c) 2009-2025 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without From 9b88901e8b7d7d88f85a288d79fd89f430847753 Mon Sep 17 00:00:00 2001 From: stephengold Date: Fri, 10 Jan 2025 11:43:55 -0800 Subject: [PATCH 5/5] provide positioning hints when creating a window with LWJGL3 --- .../com/jme3/system/lwjgl/LwjglWindow.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index aff46c69e9..9feea5fd16 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -298,6 +298,20 @@ public void invoke(int error, long description) { requestWidth = videoMode.width(); requestHeight = videoMode.height(); } + int requestX = GLFW_ANY_POSITION; + int requestY = GLFW_ANY_POSITION; + if (!settings.isFullscreen()) { + if (settings.getCenterWindow()) { + // Center the window + requestX = videoMode.width() - requestWidth; + requestY = videoMode.height() - requestWidth; + } else { + requestX = settings.getWindowXPosition(); + requestY = settings.getWindowYPosition(); + } + glfwWindowHint(GLFW_POSITION_X, requestX); + glfwWindowHint(GLFW_POSITION_Y, requestY); + } window = glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), monitor, NULL); if (window == NULL) { throw new RuntimeException("Failed to create the GLFW window"); @@ -321,17 +335,11 @@ public void invoke(final long window, final boolean focus) { int platformId = glfwGetPlatform(); if (platformId != GLFW_PLATFORM_WAYLAND && !settings.isFullscreen()) { - // Wayland doesn't support window positioning. - if (settings.getCenterWindow()) { - // Center the window - glfwSetWindowPos(window, - (videoMode.width() - requestWidth) / 2, - (videoMode.height() - requestHeight) / 2); - } else { - glfwSetWindowPos(window, - settings.getWindowXPosition(), - settings.getWindowYPosition()); - } + /* + * in case the window positioning hints above were ignored, but not + * on Wayland, since Wayland doesn't support window positioning. + */ + glfwSetWindowPos(window, requestX, requestY); } // Make the OpenGL context current