Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update LWJGL3 to v3.3.4 #2314

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading