Merge lp:~townsend/compiz-core/fix-lp1171878-0.9.7 into lp:compiz-core

Proposed by Christopher Townsend
Status: Merged
Approved by: Brandon Schaefer
Approved revision: 3137
Merged at revision: 3137
Proposed branch: lp:~townsend/compiz-core/fix-lp1171878-0.9.7
Merge into: lp:compiz-core
Diff against target: 112 lines (+51/-0)
4 files modified
include/core/window.h (+2/-0)
src/privatewindow.h (+2/-0)
src/screen.cpp (+14/-0)
src/window.cpp (+33/-0)
To merge this branch: bzr merge lp:~townsend/compiz-core/fix-lp1171878-0.9.7
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Review via email: mp+225037@code.launchpad.net

Commit message

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. This is a backport of lp:compiz r3845.

Description of the change

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. This is a backport of lp:compiz r3845.

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/core/window.h'
--- include/core/window.h 2012-03-22 17:00:51 +0000
+++ include/core/window.h 2014-06-30 15:44:56 +0000
@@ -490,6 +490,8 @@
490490
491 bool alive ();491 bool alive ();
492492
493 bool moved () const;
494
493 bool overrideRedirect ();495 bool overrideRedirect ();
494496
495 bool isMapped () const;497 bool isMapped () const;
496498
=== modified file 'src/privatewindow.h'
--- src/privatewindow.h 2012-03-02 18:02:07 +0000
+++ src/privatewindow.h 2014-06-30 15:44:56 +0000
@@ -302,6 +302,8 @@
302 unsigned int lastPong;302 unsigned int lastPong;
303 bool alive;303 bool alive;
304304
305 bool moved;
306
305 CompWindowExtents input;307 CompWindowExtents input;
306 CompWindowExtents serverInput;308 CompWindowExtents serverInput;
307 CompWindowExtents border;309 CompWindowExtents border;
308310
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2012-11-18 18:06:24 +0000
+++ src/screen.cpp 2014-06-30 15:44:56 +0000
@@ -3566,10 +3566,24 @@
35663566
3567 if (workAreaChanged)3567 if (workAreaChanged)
3568 {3568 {
3569 CompWindow::Geometry before, after;
3570
3569 /* as work area changed, update all maximized windows on this3571 /* as work area changed, update all maximized windows on this
3570 screen to snap to the new work area */3572 screen to snap to the new work area */
3571 foreach (CompWindow *w, priv->windows)3573 foreach (CompWindow *w, priv->windows)
3574 {
3575 before = w->priv->serverGeometry;
3572 w->priv->updateSize ();3576 w->priv->updateSize ();
3577 after = w->priv->serverGeometry;
3578
3579 /* A maximized window was adjusted for the new workarea size */
3580 if (before != after &&
3581 (w->state () & CompWindowStateMaximizedVertMask ||
3582 w->state () & CompWindowStateMaximizedHorzMask))
3583 {
3584 w->priv->moved = true;
3585 }
3586 }
3573 }3587 }
3574}3588}
35753589
35763590
=== modified file 'src/window.cpp'
--- src/window.cpp 2012-11-19 18:26:35 +0000
+++ src/window.cpp 2014-06-30 15:44:56 +0000
@@ -3852,6 +3852,31 @@
3852 mask |= restoreGeometry (xwc, CWX | CWWidth);3852 mask |= restoreGeometry (xwc, CWX | CWWidth);
3853 }3853 }
38543854
3855 /* Check to see if a monitor has disappeared that had a maximized window and if so,
3856 * adjust the window to restore in the current viewport instead of the
3857 * coordinates of a different viewport. */
3858 if (window->moved () &&
3859 !(state & CompWindowStateMaximizedVertMask || state & CompWindowStateMaximizedHorzMask))
3860 {
3861 if (xwc->x > screen->width () ||
3862 xwc->y > screen->height ())
3863 {
3864 /* The removed monitor may have had a much different resolution than the
3865 * the current monitor, so let's just orient the window in the top left
3866 * of the workarea. */
3867 xwc->x = workArea.x () + window->border ().left;
3868 xwc->y = workArea.y () + window->border ().top;
3869
3870 if (xwc->width > workArea.width ())
3871 xwc->width = workArea.width () - (window->border ().left + window->border ().right);
3872
3873 if (xwc->height > workArea.height ())
3874 xwc->height = workArea.height () - (window->border ().top + window->border ().bottom);
3875
3876 }
3877
3878 window->priv->moved = false;
3879 }
3855 /* constrain window width if smaller than minimum width */3880 /* constrain window width if smaller than minimum width */
3856 if (!(mask & CWWidth) && (int) old.width () < sizeHints.min_width)3881 if (!(mask & CWWidth) && (int) old.width () < sizeHints.min_width)
3857 {3882 {
@@ -6530,6 +6555,8 @@
6530 lastPong (0),6555 lastPong (0),
6531 alive (true),6556 alive (true),
65326557
6558 moved (false),
6559
6533 struts (0),6560 struts (0),
65346561
6535 icons (0),6562 icons (0),
@@ -6677,6 +6704,12 @@
6677 return priv->alive;6704 return priv->alive;
6678}6705}
66796706
6707bool
6708CompWindow::moved () const
6709{
6710 return priv->moved;
6711}
6712
6680unsigned int6713unsigned int
6681CompWindow::mwmDecor ()6714CompWindow::mwmDecor ()
6682{6715{

Subscribers

People subscribed via source and target branches