! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Windows are moved by temporary resolution change for full-screen game


Description Daniel Richard G. 2010-07-29 20:00:25 CEST
I am running an Xfce desktop on a Debian/testing system, with xfwm4 4.6.2.

Whenever I start a full-screen game that runs at a lower resolution than the normal desktop, I find on exiting the game that all my windows have been shifted to the upper-left-hand corner of the screen.

I believe xfwm4 is failing to distinguish between desktop resolution changes (where it would be reasonable to shift window positions to keep them visible), and fullscreen-app resolution changes (where it is not).

I suspect this behavior may be a side effect of the fix for Bug #5795, because earlier releases of xfwm4 (though I can't say at what exact point things changed) certainly did not have it.
Comment 1 Jaromír Cápík 2010-08-19 09:44:30 CEST
Hello. The same happens also for desktop icons. Their positions change with low-res fullscreen games and I have to restore them each time I exit the game.
Comment 2 Olivier Fourdan editbugs 2010-08-19 09:52:48 CEST
(In reply to comment #1)
> Hello. The same happens also for desktop icons. Their positions change with
> low-res fullscreen games and I have to restore them each time I exit the game.

That's unrelated, icons are managed by the desktop
Comment 3 Jaromír Cápík 2010-08-21 16:55:58 CEST
Ok. I created a new Bug 6653 for the icons

Comment 4 Daniel Richard G. 2010-10-05 09:52:45 CEST
I've confirmed that the bug is absent in 4.6.0, and present in 4.6.1.
Comment 5 Olivier Fourdan editbugs 2010-12-15 19:11:24 CET
Fixed in git master
Comment 6 Daniel Richard G. 2011-11-18 04:17:31 CET
Unfortunately, this bug isn't quite licked yet.

I'm using xfwm4 version 4.8.2, on Ubuntu Oneiric. When a low-resolution game is loaded, windows that are partially within the smaller screen area are not touched; however, windows and desktop icons that are entirely outside this area are moved in until they are partly inside.

Three screen shots that illustrate the problem are forthcoming.
Comment 7 Daniel Richard G. 2011-11-18 04:21:48 CET
Created attachment 3967 
Screenshot: Before game

This is a screenshot of a stock Xubuntu 11.10 desktop, with Xfce 4.8, running inside VirtualBox. I've set up three windows, and three desktop icons at the bottom and right-side corners of the screen. There is also a terminal window occupying the center area.
Comment 8 Daniel Richard G. 2011-11-18 04:23:54 CET
Created attachment 3968 
Screenshot: Game

This is Kobo Deluxe, running at 640x480 resolution. It is an addictive, fast-paced shoot-'em-up.
Comment 9 Daniel Richard G. 2011-11-18 04:31:49 CET
Created attachment 3969 
Screenshot: After game

The xlogo windows have been moved so that they are partly inside the 640x480 area (at the top-left corner of the screen) in which the game was running. The desktop icons have not only moved in, they have completely shuffled around the order of the Home/FileSystem/Trash icons that were already at the top-left.

This bug is fixed when the "after" desktop looks the same as "before."
Comment 10 Olivier Fourdan editbugs 2011-11-18 09:42:53 CET
Unfortunately this is the best I can come up with.

The game changing resolution is the same as the user changing resolution, and it's the role of the window manager to make sure that all windows remain accessible when the screen resolution has been changed, or when a monitor has been disabled (in a dual head setup).

Without this, changing resolution would make windows out of reach of the user, which is really not a good solution.

Keeping the window accessible can be done in two different ways:

1. Make the entire window visible
2. Do not move the window to be fully visible, but make it so a tiny part of the window still remains visible so the user can still click and move it.

Previously, solution 1. was chosen in any case, thus moving all windows to the top left corner. 

Now, solution 1. is chosen only if a monitor is removed. And solution 2. is chosen for simple resolution changes, such as the one that happens when running a game is low-res.

Now, I believe that avoiding the replacement entirely is not desirable, again, I think it's the role of the window manager to make sure that all windows remain accessible to the user in any circumstances (as much as possible, of course). Changing that would be a (serious) regression.

I am therefore closing this bug as wontfix, what we have now is what I think it should be.
Comment 11 Daniel Richard G. 2011-11-22 00:15:47 CET
Created attachment 3979 
Patch against xfwm4 git master

Okay, so I pulled out my debugger, and poked around a bit in the code, eventually focusing on clientScreenResize().

I see that there aren't any obvious properties on the game window to indicate how it is special. But looking at it, at least two conditions always seem to be the case:

1. The window has a width/height exactly equal to the screen's new width/height;

2. The window is marked as non-resizable.

With that, I've put together a first-cut patch that adds a check to clientScreenResize(): if any window meets the above conditions, then presume that it's a low-res game/app of some kind, and skip the clientConfigure()ing loop.

The conditions could probably be narrowed further, and the check may or may not be better done before the "revalidate client struts" loop. But so far, this has worked perfectly for all the games I like to play. Those XLogo windows only move when I change the desktop resolution manually.
Comment 12 Olivier Fourdan editbugs 2011-11-22 09:13:54 CET
Unfortunately, that's a hack tbh, the same kind of things I am trying to remove (see git commit 9982c00b [1])

Trying to guess and adapt to the apps/windows is not a good solution in the long term. 

A better approach would be to memorize the previous location before resizing the screen, and restore that location when the resolution changes back. 

If in the mean time the user has moved the window, the previous location should be cleared (means the user want the window in a new location, the position should not be reverted tin that case)

[1] http://git.xfce.org/xfce/xfwm4/commit/?id=9982c00b3b7f6423faf9fe4a18cb92e85ce11c8f
Comment 13 Olivier Fourdan editbugs 2011-11-22 09:14:56 CET
Note, the patch is fairly simple, I would possibly consider including such a patch if well written.
Comment 14 Daniel Richard G. 2011-11-22 09:59:31 CET
I imagine the best solution would be for game windows to set an actual hint so that the WM can tell what's going on. Currently, a new window appears, and then there's a screen-size change, but very little appears to connect the two from the WM's point of view.

I don't think any standard exists for such a hint, however, and it'll be a long time before we see one.

The attached patch has the advantage of being self-contained and to the point. But if you'd rather have the new fields in Client, and the necessary logic in clientScreenResize() and a couple other places, then I'll work on implementing a patch along the lines you describe.
Comment 15 Daniel Richard G. 2011-11-22 22:00:57 CET
Created attachment 3980 
Patch against xfwm4 git master

Okay, here's a first-draft patch implementing your approach. It does the trick for the xlogo windows.

However, maximized windows see needless churn from doing things this way. Is it workable to have these windows not be notified of the size change until the user would actually see them?
Comment 16 Olivier Fourdan editbugs 2012-04-07 17:11:04 CEST
fixed in git master (different patch though)
Comment 17 Daniel Richard G. 2012-04-09 19:33:27 CEST
Thanks for getting a fix in---look forward to trying it out.

Bug #6589

Reported by:
Daniel Richard G.
Reported on: 2010-07-29
Last modified on: 2012-04-09


Olivier Fourdan
CC List:
1 user



Screenshot: Before game (325.67 KB, image/png)
2011-11-18 04:21 CET , Daniel Richard G.
no flags
Screenshot: Game (212.63 KB, image/png)
2011-11-18 04:23 CET , Daniel Richard G.
no flags
Screenshot: After game (331.18 KB, image/png)
2011-11-18 04:31 CET , Daniel Richard G.
no flags
Patch against xfwm4 git master (1.03 KB, patch)
2011-11-22 00:15 CET , Daniel Richard G.
no flags
Patch against xfwm4 git master (1.49 KB, patch)
2011-11-22 22:00 CET , Daniel Richard G.
no flags

Additional information