Skip to content

Commit 0d963b6

Browse files
authored
Merge pull request #2314 from jMonkeyEngine/sgold-issue-2298
update LWJGL3 to v3.3.4
2 parents 662b4ea + e1ee54f commit 0d963b6

2 files changed

Lines changed: 33 additions & 18 deletions

File tree

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[versions]
44

55
checkstyle = "9.3"
6-
lwjgl3 = "3.3.3"
6+
lwjgl3 = "3.3.4"
77
nifty = "1.4.3"
88

99
[libraries]

jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2023 jMonkeyEngine
2+
* Copyright (c) 2009-2025 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -353,13 +353,27 @@ public void invoke(int error, long description) {
353353
requestWidth = videoMode.width();
354354
requestHeight = videoMode.height();
355355
}
356-
356+
int requestX = GLFW_ANY_POSITION;
357+
int requestY = GLFW_ANY_POSITION;
358+
if (!settings.isFullscreen()) {
359+
if (settings.getCenterWindow()) {
360+
// Center the window
361+
requestX = videoMode.width() - requestWidth;
362+
requestY = videoMode.height() - requestWidth;
363+
} else {
364+
requestX = settings.getWindowXPosition();
365+
requestY = settings.getWindowYPosition();
366+
}
367+
glfwWindowHint(GLFW_POSITION_X, requestX);
368+
glfwWindowHint(GLFW_POSITION_Y, requestY);
369+
}
357370
// Lets use the monitor selected from AppSettings if FullScreen is
358371
// set.
359-
if (settings.isFullscreen()) window =
360-
glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), monitor, NULL); else window =
361-
glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), NULL, NULL);
362-
372+
if (settings.isFullscreen()) {
373+
window = glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), monitor, NULL);
374+
} else {
375+
window = glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), NULL, NULL);
376+
}
363377
if (window == NULL) {
364378
throw new RuntimeException("Failed to create the GLFW window");
365379
}
@@ -383,17 +397,13 @@ public void invoke(final long window, final boolean focus) {
383397
}
384398
);
385399

386-
if (!settings.isFullscreen()) {
387-
if (settings.getCenterWindow()) {
388-
// Center the window
389-
glfwSetWindowPos(
390-
window,
391-
(videoMode.width() - requestWidth) / 2,
392-
(videoMode.height() - requestHeight) / 2
393-
);
394-
} else {
395-
glfwSetWindowPos(window, settings.getWindowXPosition(), settings.getWindowYPosition());
396-
}
400+
int platformId = glfwGetPlatform();
401+
if (platformId != GLFW_PLATFORM_WAYLAND && !settings.isFullscreen()) {
402+
/*
403+
* in case the window positioning hints above were ignored, but not
404+
* on Wayland, since Wayland doesn't support window positioning
405+
*/
406+
glfwSetWindowPos(window, requestX, requestY);
397407
}
398408

399409
// Make the OpenGL context current
@@ -490,6 +500,11 @@ protected void showWindow() {
490500
* @param settings settings for getting the icons
491501
*/
492502
protected void setWindowIcon(final AppSettings settings) {
503+
if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) {
504+
// Wayland doesn't support custom icons.
505+
return;
506+
}
507+
493508
final Object[] icons = settings.getIcons();
494509
if (icons == null) return;
495510

0 commit comments

Comments
 (0)