Changes SetWindowMonitor() to no longer force fullscreen #3209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since invoking
glfwSetWindowMonitor()
(L1676) forces fullscreen, changesSetWindowMonitor()
to instead move the window to the defined monitor.To move the window it checks if the screen size is larger than the monitor workarea (R1684-R1693). If it is larger, then anchors it on the top left corner (R1693), otherwise, center it (R1696-R1698). This is done because if the window is larger than the workarea, centering could make the window bars/handles unreachable for the user.
Before this proposed change (while using the previous(Sorry, I retested this today and it's working. I probably messed something locally yesterday while testing multiple monitor layout configurations. I amended the commit to allow moving the fullscreen window again: R1673-R1679)SetWindowMonitor()
implementation L1675-L1676), I wasn't able to change the monitor while already on fullscreen. But, just be safe and preventSetWindowMonitor()
from being executed while already on fullscreen, added a check for it before attempting to move the window anyway (R1673, R1694).This proposed change leaves up to the user to call
ToggleFullscreen()
orSetWindowState(FLAG_FULLSCREEN_MODE)
when required.Environment
Tested this change successfully on
PLATFORM_DESKTOP
native Linux (Linux Mint 21.1 x86_64) with two monitors (1600x900 and 1280x1024 resolutions) in various layout configurations.Code Example
Minimal reproduction code to test the change:
Edit 1: added line marks.
Edit 2: fixes #3198.
Edit 3: amended commit to allow moving the fullscreen window again.