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

CompoundEditor : Fix maximizing detached windows #6201

Open
wants to merge 1 commit into
base: 1.5_maintenance
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/GafferUI/CompoundEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,14 @@ def _restoreWindowState( gafferWindow, boundData ) :
screens = QtWidgets.QApplication.screens()
if boundData["screen"] < len(screens) :
targetScreen = screens[ boundData["screen"] ]
window.setScreen( targetScreen )
# \todo In Qt6, `setScreen()` is added to `QWidget` which we should
# be able to use to set the screen including for detached windows.

window.setWindowState( QtCore.Qt.WindowNoState )

screenGeom = targetScreen.availableGeometry()
geometry = window.geometry()
window.setGeometry( screenGeom.x(), screenGeom.y(), geometry.width(), geometry.height() )
Comment on lines +1432 to +1439
Copy link
Member

Choose a reason for hiding this comment

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

If this is a fix related to maximisation, then perhaps it belongs down below in the elif boundData["maximized"] block? It seems that could also fix the problem reported on Discord, where this code isn't being run for the primary screen.

There's a bit of an assumption here when doing window.setGeometry() that the target screen will have at least enough resolution to hold the originally created window.

Alternatively, perhaps we should always restore the geometry (our final else : clause below) and then maximise? From the looks of it, the code for restoring the geometry is smart enough not to overshoot the screeen.

Copy link
Contributor

Choose a reason for hiding this comment

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

If this is a fix related to maximisation, then perhaps it belongs down below in the elif boundData["maximized"] block?

If we take this approach, it might be worth double-checking that the same issue doesn't apply for the boundData["fullscreen"] case, it may need the same special handling as maximisation to ensure we end up fullscreen on the correct screen? If so, that's likely a vote for always restoring the geometry...


if boundData["fullScreen"] :
window.setWindowState( QtCore.Qt.WindowFullScreen )
Expand Down