Adding/Removing an external monitor causes maximized windows to move to another workspace

Bug #1171878 reported by Eduards Bezverhijs
78
This bug affects 16 people
Affects Status Importance Assigned to Milestone
Compiz
Fix Released
Medium
Christopher Townsend
Compiz Core
Fix Released
Medium
Christopher Townsend
compiz (Ubuntu)
Fix Released
Medium
Christopher Townsend
Precise
Fix Released
Medium
Bartosz Kosiorek

Bug Description

[Impact]

If I plug in external monitor, move a window to it, maximize window and remove external monitor, window is moved to the same workspace primary screen - this is correct behavior, but when I un-maximize it - window moves to different workspace. This most likely is because original window positions are not updated after removing the monitor and un-maximize still uses those old values to move the window to supposedly original position.
Another use case is when window movement is somewhat wrong - external monitor plugged in, window is maximized on primary screen, move focus to different workspace, unplug the monitor, move back to the workspace when we have fullscreen window, unmaximize it - window un-maximizes not to original position, it's moved away by the same mount of pixels as external monitor width is.

I expect that window stays on the same workspace - once it's on it it should not move unless I do that manually, also I expect that un-maximizing moves window to original position, not different.

This is continuation of bug https://bugs.launchpad.net/compiz/+bug/763148, fullscreen window bug was separated as per "Christopher Townsend (townsend) wrote on 2013-04-18".

P.S. Most likely bug can be fixed quite easy as behavior is similar to bug I mentioned, hopefully this can be included in the same SRU.

thanks in advance
Eduards

[Test Case]

** Test Case 1

1. plug in external monitor and move a windows to it
2. maximize window
3. unplug external monitor
4. window moves to the primary display of the same workspace (this is correct)
5. un-maximize window
6. window un-maximizes to a different workspace (this is incorrect)

** Test Case 2

1. plug in external monitor
2. maximize window on primary (laptop display)
3. change to a different workspace
4. unplug external monitor
5. return to workspace with maximized window
6. un-maximize window
7. window un-maximizes to wrong position. instead of the original position it is shifted over by the same number of pixels as the width of the external monitor (also incorrect)

[Other information]

The bug fix also address bug LP: #763148 on precise.

[Regression]

None determined && expected.

Related branches

Revision history for this message
Margarita Manterola (marga-9) wrote :

I guess the hot plug events for adding and removing external monitors are a really complicated issue. In my case, I have two monitors connected to my computer. Turning them off causes a hot plug event saying that first one and then the other have gone away. Turning them on again causes windows to turn up in different places as they were before, which is of course not the expected behavior.

Moving the window when un-maximazing is obviously wrong, but my point is that the solution as to what to do when monitors appear or go away is not trivial at all.

Revision history for this message
Margarita Manterola (marga-9) wrote :

I'm running precise and I've applied the changes available at the unity SRU ppa.

This bug is still present with the currently available latest updates.

Behaviour:
When having two monitors, if a window is maximized in the right monitor and this monitor is turned off, the window moves to the left [correct, expected].
  If it's unmaximized, it moves to the workspace to the right or to the left, depending on which workspace it is [incorrect].
  If while still maximized, the monitor comes back, it stays on the right. [unexpected, at least for me]

--
Regards,
Marga

Stephen M. Webb (bregma)
Changed in compiz:
status: New → Triaged
Changed in compiz (Ubuntu):
status: New → Triaged
Changed in compiz:
importance: Undecided → Medium
Changed in compiz (Ubuntu):
importance: Undecided → Medium
Changed in compiz:
milestone: none → 0.9.10.3
Changed in compiz:
assignee: nobody → Christopher Townsend (townsend)
status: Triaged → In Progress
Revision history for this message
Eduards Bezverhijs (mjasnik) wrote :

A little update.
If I add second display, maximize application to it and window has "Visible on all workspaces" set, after removing second display window is moved to current workspace, active display maximized, but when I un-maximize the window, it's gone. I cant get it back to work with it, no matter how I try - clicking in unity launcher just switches desktops, wmctrl can't move the window and there is no possibility for me get that window in any visible area anymore. Only solution to it is - right click in unity launcher and choose "Quit".

Revision history for this message
Peter Senft (dusares) wrote :

In addition to the problem that all full screen windows show up on the current workspace after resuming from standby or changing the monitor setup (adding/removing monitor), I also have problems with switching off monitors in general.

I have a dual monitor setup and switching the monitors off causes some trouble. All is fine, if you switch them on again before the screen saver is activated. After the screen saver is activated only the primary output of the graphics adapter is activated. The second monitor is not even available anymore until I detect it with the nvidia-settings-manager.

Revision history for this message
Christopher Townsend (townsend) wrote :

I've been looking at this and have a working solution, but I have to make some compromises on the geometry of restoring the maximized window. Since the monitor that got removed may have had a much larger resolution than the current monitor, I think it's best to restore the window to the top left of the workspace since it's conceivable that it could restore somewhere far to the right and/or far to the bottom and still wouldn't look right. Also, if the restored window is still larger than the screen even with the window positioned at the top left, then the window will be shrunk to fit the screen.

summary: - Adding/Removing an external monitor causes open fullscreen windows to
- move to another workspace
+ Adding/Removing an external monitor causes maximized windows to move to
+ another workspace
Changed in compiz (Ubuntu):
status: Triaged → In Progress
assignee: nobody → Christopher Townsend (townsend)
Changed in compiz:
milestone: 0.9.10.3 → 0.9.11.0
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package compiz - 1:0.9.11+14.04.20140328-0ubuntu1

---------------
compiz (1:0.9.11+14.04.20140328-0ubuntu1) trusty; urgency=low

  [ Chris Townsend ]
  * Fix issue where having a maximized window on a second monitor, then
    that monitor gets removed which moves the maximized window to the
    main monitor, then restoring the maximized window would place it on
    a different viewport. It should stay on the same viewport. (LP:
    #1171878)
 -- Ubuntu daily release <email address hidden> Fri, 28 Mar 2014 10:44:36 +0000

Changed in compiz (Ubuntu):
status: In Progress → Fix Released
Changed in compiz:
status: In Progress → Fix Committed
Revision history for this message
cometdog (ericctharley) wrote :

I still observe the problem with

$ apt-cache policy compiz
compiz:
  Installed: 1:0.9.11+14.04.20140328-0ubuntu1
  Candidate: 1:0.9.11+14.04.20140328-0ubuntu1

Example:
4 workspaces, external monitor plugged in. Applications are maximized to primary monitors in workspaces 2 and 3. Current worspace is workspace 1. When disconnecting the external monitor, those maximized applications move from workspaces 2 and 3 to workspace 1.

Expected behavior: maximized applications should remain on their original workspaces.

Revision history for this message
Christopher Townsend (townsend) wrote :

@cometdog,

This bug is specifically about unmaximizing a window once it moves to a different screen when unplugging a monitor. The issue you describe is indeed a bug, but should be tracked in a different bug. I'll see if a bug has already been reported for the issue you describe. If not, then I'll make one:)

Revision history for this message
Ritesh Khadgaray (khadgaray) wrote :
Revision history for this message
Gao Shichao (xgdgsc) wrote :

@cometdog
https://bugs.launchpad.net/compiz/+bug/1304531

I don' t quite get why 763148 can be seen as fixed without fixing maximized windows bug.

Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

@khadgaray patches appears to fix this behavior on precise.

Changed in compiz (Ubuntu Precise):
status: New → Triaged
importance: Undecided → Critical
importance: Critical → Medium
description: updated
description: updated
Changed in compiz-core:
milestone: none → 0.9.7.14
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Christopher Townsend (townsend)
status: Confirmed → In Progress
Revision history for this message
Christopher Townsend (townsend) wrote :

Attached is the debdiff for the proposed Compiz SRU that fixes this. Also, a branch is linked to this bug for the same fix.

Changed in compiz-core:
status: In Progress → Fix Committed
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Eduards, or anyone else affected,

Accepted compiz into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/compiz/1:0.9.7.12-0ubuntu4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in compiz (Ubuntu Precise):
status: Triaged → Fix Committed
tags: added: verification-needed
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

After install compiz from propose, all problems with multi monitor support (which was described here) was solved for me.

Now it is working perfectly.

Thanks you!

Changed in compiz (Ubuntu Precise):
assignee: nobody → Bartosz Kosiorek (gang65)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for compiz has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package compiz - 1:0.9.7.12-0ubuntu4

---------------
compiz (1:0.9.7.12-0ubuntu4) precise; urgency=low

  * debian/patches/fix_external_monitor_hotplug.patch
    - Cherry-pick fixes upstream for window mismanagement when adding
      and/or removing an external monitor. (LP: #763148) (LP: #1171878)
 -- Chris Townsend <email address hidden> Mon, 07 Jul 2014 15:15:43 -0400

Changed in compiz (Ubuntu Precise):
status: Fix Committed → Fix Released
tags: added: cts
Stephen M. Webb (bregma)
Changed in compiz:
status: Fix Committed → Fix Released
tags: added: rls-w-incoming
Mathew Hodson (mhodson)
Changed in compiz-core:
status: Fix Committed → Fix Released
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.