Changing the order of monitors leads to off-screen windows

Bug #1656248 reported by Cs-gon
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
compiz (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The following steps lead to off-screen windows when using compiz on Ubuntu 14.04 (e.g. when using Unity), and having no virtual desktops configured:

- Start system and login (with only one monitor connected, or using a laptop)
- Connect an additional monitor after logging in, or connect the laptop to a docking station with an external monitor connected to it (which then should be automatically configured to be the right monitor)
- Open a window on the additional (right) monitor
- Change the order of monitors in the display settings (put the originally left monitor to the right, and vice versa)
- Now the window which was opened on the originally right (now left) monitor is now off-screen

The problem is, that when the order of monitors get changed, the code that recalculates the window positions, calculates the wrong positions.

To calculate the new window positions, the code saves the current desktop resolution (in case the resolution changes), then changes the display configuration (e.g. enables the new monitor and re-configures the desktop) and then uses the saved (now old) desktop resolution to calculate the window positions for the new resolution.

The problem is, that when changing the order of monitors, as described above, the code does not actually save the current desktop resolution (the resolution of the both monitors combined), so does not realize that the desktop resolution has actually not changed (just the order of monitors).

It then uses the old saved resolution (which was the resolution for the initial single-monitor configuration). It then calculates the wrong new window positions (because it thinks the window was an a non-existing virtual desktop).

The fix for the problem is to save the current desktop resolution not only when the resolution changes, but every time the display configuration changes.

The problem also exists when using virtual desktops, but then the window might only be pushed to another virtual desktop, or still off-screen, depending on where the windows was placed initially.

I will attach a patch that solves the problem. The patch makes sure that the current desktop resolution gets saved every time the display configuration changes, and not only when the actual desktop resolution changes.

The patch is against compiz-0.9.11.3+14.04.20160425. But the problem seems still to be present in the latest upstream source. I haven't tested this, but the problematic code is still the same.

Tags: patch
Revision history for this message
Cs-gon (cs-gon) wrote :
tags: added: patch
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "compiz_fix_monitor_reconfiguration.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

Revision history for this message
Cs-gon (cs-gon) wrote :

The patch I provided earlier fixed the described problem, but did also create a new problem leading to off-screen windows when two configure notifies were received (first notify was for the actual size change, while the second one was not), and the second configure notify then lead to a change of mPrevSize, while actions for the first configure notify where still being processed.

The new attached patch compiz_fix_monitor_reconfiguration_2.patch fixes this. The new patch introduces mPrevSize2, which holds the actual value that is used to process the configure notify. This value only changes, when a configure notify is received that actually notifies about a change of the desktop size.

Changed in compiz (Ubuntu):
status: New → Incomplete
Revision history for this message
Luís Infante da Câmara (luis220413) wrote :

The patch applies successfully to the version in the development release of Ubuntu (Kinetic).

Changed in compiz (Ubuntu):
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.