Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save/Restore on 2nd screen not working with aerosnap #553

Closed
iamsergio opened this issue Dec 13, 2024 · 1 comment
Closed

Save/Restore on 2nd screen not working with aerosnap #553

iamsergio opened this issue Dec 13, 2024 · 1 comment
Assignees

Comments

@iamsergio
Copy link
Contributor

Windows 11 / Qt 6:

  • Drag main window from screen 1 to screen 2 (don't release mouse)
  • Drag near edge of screen 2 to allow for aerosnap to maximize it fully
  • Save and Restore

Unexpectedly window restores on screen 1.
Not repro with Qt 5.
Not repro if you maximize via titlebar double click

Reproduced initially by bbc on #508

@iamsergio
Copy link
Contributor Author

iamsergio commented Dec 13, 2024

The bug is related to "normal geometry", aka the geometry the window should get when shown in a non-maximized state.
Here's what's happening:

When we save layout, in this case, "normalGeometry" is of 1st screen, while window is in 2nd screen maximized.
Qt doesn't offer API to restore the "normalGeometry" when we restore layout, so we workaround by calling setGeometry(normal)+showMaximized(). Turns out for this odd case of using aerosnap, the setGeometry() call will put it in 1st screen, then gets maximized in 1st screen.

iamsergio added a commit that referenced this issue Dec 14, 2024
For issue #553

On Windows it's possible to have normal geometry
in a different screen than the maximized window if
you drag a window across monitors and touch an
aerosnap edge.

While restoring, we need a fake setGeometry()
call to set the normal geometry, since Qt doesn't
provide QWindow::setNormalGeometry(), that resulted
in the window being maximized on the wrong window.

The solution is to patch the normal geometry to be
in the first screen.
iamsergio added a commit that referenced this issue Dec 14, 2024
For issue #553

On Windows it's possible to have normal geometry
in a different screen than the maximized window if
you drag a window across monitors and touch an
aerosnap edge.

While restoring, we need a fake setGeometry()
call to set the normal geometry, since Qt doesn't
provide QWindow::setNormalGeometry(), that resulted
in the window being maximized on the wrong window.

The solution is to patch the normal geometry to be
in the first screen.
iamsergio added a commit that referenced this issue Dec 14, 2024
For issue #553

On Windows it's possible to have normal geometry
in a different screen than the maximized window if
you drag a window across monitors and touch an
aerosnap edge.

While restoring, we need a fake setGeometry()
call to set the normal geometry, since Qt doesn't
provide QWindow::setNormalGeometry(), that resulted
in the window being maximized on the wrong window.

The solution is to patch the normal geometry to be
in the first screen.
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

No branches or pull requests

1 participant