Skip to content

Conversation

@stephengold
Copy link
Member

@stephengold stephengold commented Mar 31, 2022

Based on the observations documented in #1793, the key issue is that transitions between windowed mode and fullscreen mode in LWJGL v3 don't always generate reshape() callbacks. This spoils GUI layouts that need updating each time the dimensions of the graphics context change. The user sees a layout generated for a different-sized framebuffer.

(There's also an issue with the initial reshape() callback, which occurs on Windows, but not Linux, when the initial context is created. However, that's an easy issue for apps to work around.)

The key issue manifests differently on Linux than on Windows:

  • On Linux LWJGL v3, windowed-to-fullscreen causes a callback, but not fullscreen-to-windowed.
  • On Windows LWJGL v3, neither transition causes a callback.

This PR proposes that jme3-lwjgl3's LwjglWindow should explicitly invoke reshape() on both windowed-to-fullscreen and fullscreen-to-windowed transitions. This results in some redundant callbacks (multiple callbacks for a single createContext()). However, I expect most reshape() callbacks perform idempotent operations. Also, filtering out redundant callbacks is much easier that compensating for missing callbacks.

@stephengold stephengold linked an issue Mar 31, 2022 that may be closed by this pull request
@stephengold
Copy link
Member Author

Lying in bed this morning, I came up with a simpler, more elegant fix.

@stephengold stephengold marked this pull request as draft March 31, 2022 15:25
@stephengold
Copy link
Member Author

Here's a summary:

  • deal with all size/scale changes in a single method, now named updateSizes()
  • keep a private record of the framebuffer size, so updateSizes() won't be confused by unrelated changes to AppSettings

@stephengold stephengold marked this pull request as ready for review March 31, 2022 18:36
@stephengold
Copy link
Member Author

Unless there's more to discuss, I propose to self-integrate this PR in about 24 hours.

@stephengold stephengold merged commit 66e16e3 into master Apr 5, 2022
@stephengold stephengold deleted the sgold/issue-1793 branch April 5, 2022 21:12
@stephengold stephengold added this to the Future Release milestone Apr 5, 2022
@stephengold stephengold modified the milestones: Future Release, v3.5.2 Apr 17, 2022
@stephengold
Copy link
Member Author

In order to backport this into "v3.5" branch, we'd also need to backport #1750. The combination of the 2 PRs seems risky relative to the benefits. Better wait for 3.6 or 4.0

@Ali-RS
Copy link
Member

Ali-RS commented Feb 10, 2023

Looks like this breaks TestAWTPanels, please see #1945

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

missing reshape() callbacks in LWJGL v3

3 participants