Skip to content

Commit

Permalink
Merge pull request #2314 from jMonkeyEngine/sgold-issue-2298
Browse files Browse the repository at this point in the history
update LWJGL3 to v3.3.4
  • Loading branch information
yaRnMcDonuts authored Jan 20, 2025
2 parents 662b4ea + e1ee54f commit 0d963b6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[versions]

checkstyle = "9.3"
lwjgl3 = "3.3.3"
lwjgl3 = "3.3.4"
nifty = "1.4.3"

[libraries]
Expand Down
49 changes: 32 additions & 17 deletions jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2023 jMonkeyEngine
* Copyright (c) 2009-2025 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -353,13 +353,27 @@ 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);
}
// Lets use the monitor selected from AppSettings if FullScreen is
// set.
if (settings.isFullscreen()) window =
glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), monitor, NULL); else window =
glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), NULL, NULL);

if (settings.isFullscreen()) {
window = glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), monitor, NULL);
} else {
window = glfwCreateWindow(requestWidth, requestHeight, settings.getTitle(), NULL, NULL);
}
if (window == NULL) {
throw new RuntimeException("Failed to create the GLFW window");
}
Expand All @@ -383,17 +397,13 @@ public void invoke(final long window, final boolean focus) {
}
);

if (!settings.isFullscreen()) {
if (settings.getCenterWindow()) {
// Center the window
glfwSetWindowPos(
window,
(videoMode.width() - requestWidth) / 2,
(videoMode.height() - requestHeight) / 2
);
} else {
glfwSetWindowPos(window, settings.getWindowXPosition(), settings.getWindowYPosition());
}
int platformId = glfwGetPlatform();
if (platformId != GLFW_PLATFORM_WAYLAND && !settings.isFullscreen()) {
/*
* 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
Expand Down Expand Up @@ -490,6 +500,11 @@ 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;

Expand Down

0 comments on commit 0d963b6

Please sign in to comment.