RMichelsen / Nvy

Nvy - A Neovim client in C++
MIT License
333 stars 28 forks source link

<alt-Enter> toggle back from full screen will loose the original window state #75

Closed xarthurx closed 1 year ago

xarthurx commented 1 year ago

OS: Windows 11.

Issue:

For normal nvy window, no issues.

For nvy window that is tiled using win+ up/down/left/right to locate into 1/2 or 1/4 of the screen, when toggling into fullscreen mode and toggling back, the nvy window will loose the "tiled" state before toggling.

Actually, the exited state will be whatever before "tiling".

mvarelaf commented 1 year ago

I think this is not a problem with nvy. What (\<alt-Enter>) full screen does is maximize the window and remove its title bar and border.

The behaviour you describe also happens with notepad. 1- Open notepad 2- Tile it using win+ up/down/left/right 3- Maximize the window 4- Restore the window It goes back to the position 1, not the tiled position

RMichelsen commented 1 year ago

The problem is the GetWindowPlacement function used to save and restore window placement does not take into account the snapping behaviour. I think a more complex solution is possible for example using GetWindowRect and restoring with SetWindowPos but then we run into problems with multiple monitors and maybe other things. I would prefer to keep the behaviour as is, unless more people express a desire for this.