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

When turning off maximize/fullscreen, keep window on same monitor. #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

compmstr
Copy link

@compmstr compmstr commented Dec 21, 2021

This is a fix for: https://bugzilla.icculus.org/show_bug.cgi?id=4408

When we go to unmaximize, if the client is currently on a
different monitor than the one it was on when it was originally
maximized, we now move it to the same position on the current
monitor, instead of snapping it back to the old one.

We do the same thing for removing the fullscreen status.

For the case when the current screen is smaller than the old monitor,
I also set up code to move the client to be visible on the new
monitor, if it's not visible.

This is a fix for: https://bugzilla.icculus.org/show_bug.cgi?id=4408
Basically, when we go to unmaximize, if the client is currently on a
  different moniter than the one it was on when it was originally
  maximized, we now move it to the same position on the current
  monitor, instead of snapping it back to the old one.
We do the same thing for removing the fullscreen status.
For the case when the current screen is smaller than the old monitor,
  I also set up code to move the client to be visible on the new
  monitor, if it's not visible.
@adamhotep
Copy link

Could this fix be adapted to solving bug 5733 (Track window position when monitors change, restore position (if not dirtied) when same monitors are restored)?

@compmstr
Copy link
Author

compmstr commented Dec 7, 2022

Hmm, good question. Maximize and Fullscreen both are initiated from within Openbox, so there was an easy place to check and restore the positions.

Doing a quick grep through the codebase, I see the Xrandr library being pulled in, but I'm not seeing it being used anywhere. obt_display_extension_randr is initialized, but that's the only use I see for it.

If there were any way to hook into it and tell when a monitor was disconnected and/or connected I could see that fix being a possibility, but I'm not seeing that option currently.

@adamhotep
Copy link

Maybe just save the current display resolution and trigger when it changes? The heart of this issue is in changing resolution, which happens (especially in today's LCD-dominated landscape) mostly when adding or removing monitors.

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

Successfully merging this pull request may close these issues.

2 participants