Skip to content

Allow toggling fullscreen without restart and add keybind#14714

Merged
grorp merged 13 commits into
luanti-org:masterfrom
grorp:fullscreen-switch
Jun 2, 2024
Merged

Allow toggling fullscreen without restart and add keybind#14714
grorp merged 13 commits into
luanti-org:masterfrom
grorp:fullscreen-switch

Conversation

@grorp

@grorp grorp commented May 29, 2024

Copy link
Copy Markdown
Member

Fixes #2732, opened in 2015, closed as non-trivial in 2017 (because there was no Irrlicht fork and no SDL device back then)

New users can easily think that the fullscreen setting is broken because it's only applied after a restart and this isn't even documented.

This PR allows toggling fullscreen via the settings menu without a restart. For convenience, there's also a new keybind called keymap_fullscreen (F11 by default). As a bonus, window_maximized is now applied immediately too.

To do

This PR is a Ready for Review.

How to test

Change the fullscreen and window_maximized settings. See that Minetest reacts immediately.

Press F11. See that fullscreen mode is toggled and that the fullscreen checkbox in the settings is updated too.

@grorp grorp added Feature ✨ PRs that add or enhance a feature @ Client rendering UI/UX labels May 29, 2024
@rubenwardy

Copy link
Copy Markdown
Member

This is much easier to implement now that we use borderless fullscreen

@grorp

grorp commented May 29, 2024

Copy link
Copy Markdown
Member Author

This is much easier to implement now that we use borderless fullscreen

What actually makes it much easier is that we now have an Irrlicht fork and the SDL device. Now that we have these two things, this PR automatically works with "real" fullscreen too if we tell SDL to enable it.

Comment thread src/client/inputhandler.cpp
Comment thread irr/src/CIrrDeviceSDL.h Outdated
Comment thread src/client/inputhandler.cpp Outdated
@Zughy Zughy added the Action / change needed Code still needs changes (PR) / more information requested (Issues) label May 31, 2024
@grorp grorp removed the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Jun 1, 2024
@grorp grorp requested a review from sfan5 June 1, 2024 09:30
@grorp grorp force-pushed the fullscreen-switch branch from 5e6783c to 173767c Compare June 1, 2024 09:44
Comment thread irr/src/CIrrDeviceSDL.cpp

@sfan5 sfan5 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and mostly works, but:

  • going in and out of fullscreen moves the window downwards by like 10 pixels (not our fault?)
  • fullscreening a maximized window and returning will cause it to be unmaximized

@grorp

grorp commented Jun 2, 2024

Copy link
Copy Markdown
Member Author

going in and out of fullscreen moves the window downwards by like 10 pixels (not our fault?)

Cannot reproduce (Fedora 39 "Workstation", GNOME 45, Wayland). I think indeed not our fault.

fullscreening a maximized window and returning will cause it to be unmaximized

That should depend on your window_maximized setting, which is appplied again when leaving fullscreen. I could just remove that part. The setting and the actual state go out of sync anyway whenever you minimize/maximize the window.

@sfan5

sfan5 commented Jun 2, 2024

Copy link
Copy Markdown
Member

Cannot reproduce (Fedora 39 "Workstation", GNOME 45, Wayland). I think indeed not our fault.

Well I'm on X11, but I think the source of this behavior is more likely in SDL.

I could just remove that part. The setting and the actual state go out of sync anyway whenever you minimize/maximize the window.

👍

@grorp grorp merged commit 833bb54 into luanti-org:master Jun 2, 2024
@grorp grorp deleted the fullscreen-switch branch June 2, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Key to toggle fullscreen

4 participants