openbox icon indicating copy to clipboard operation
openbox copied to clipboard

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

Open compmstr opened this issue 3 years ago • 3 comments

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.

compmstr avatar Dec 21 '21 20:12 compmstr

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)?

adamhotep avatar Dec 07 '22 22:12 adamhotep

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.

compmstr avatar Dec 07 '22 23:12 compmstr

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.

adamhotep avatar Dec 09 '22 22:12 adamhotep