Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Add window-maximization creation-param, and isWindowMaximized() #142

Merged
merged 5 commits into from
Feb 6, 2023

Conversation

Desour
Copy link
Member

@Desour Desour commented Oct 15, 2022

Needed because big centered windows don't work well.

In X11 we don't support centering the window, instead we always use pos (0,0). In SDL, the window can be (and is, because we use pos (-1,-1) in minetest) centered, but it centers into the middle of display area, not usable display area (the usable one doesn't include the panel), which is better for small windows, but completely wrong for big ones, that almost fill the usable area. And changing that (in SDL) would require repositioning the window when the window decoration is added. All in all, it would be complicated, and it's hard to decide when to center with respect to which area.

Fix: Keep centering the window in SDL, but store whether the window is maximised (just like screen_[h,w]), and maximise window on startup again accordingly.

See also: minetest/minetest#12861

Edit: Please don't merge yet.

@Desour
Copy link
Member Author

Desour commented Oct 15, 2022

Rebased.

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

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

Looks correct.

@Desour
Copy link
Member Author

Desour commented Feb 3, 2023

(Rebased.)
Please wait with merging.
I'd like to see if it's better to use the already existing maximizeWindow function, and implement the isMaximized on other backends. (Idk why I haven't done this in the first place...)

* creation-param is implemented with maximizeWindow()
* isMaximized() returns state set via maximizeWindow() and restoreWindow() (otherwise autosave would overwrite the setting)
* other backends don't support maximization
@Desour Desour changed the title Allow to maximize window (only SDL) Add window-maximization creation-param, and isWindowMaximized() Feb 3, 2023
@Desour
Copy link
Member Author

Desour commented Feb 3, 2023

Added simple implementations (via maximizeWindow()) for the creation-params on win32 and linux backends (macOs doesn't support that function). This means that the setting now also works on these backends. But the autosaving doesn't work (same situation as with fullscreen) (I'd have to look up how querying the actual state works, and that's not worth it (because you'd have to review)).
(I've kept the creation-param as it makes sense to have it.)
See also the new commit.
Someone should test the win32 backend, I can't. See minetest/minetest#12861 for test instructions.

@Desour Desour requested review from nerzhul and SmallJoker and removed request for nerzhul and SmallJoker February 3, 2023 01:23
@Desour
Copy link
Member Author

Desour commented Feb 3, 2023

(Oh, does only one review-request work? That button is weird. x))

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

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

Tested with CIrrDeviceLinux + Minetest PR.
No issues found. SDL part LGTM.

Copy link
Member

@sfan5 sfan5 left a comment

Choose a reason for hiding this comment

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

Looks good.

@sfan5 sfan5 merged commit 51dffc4 into minetest:master Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants