Comment 2 for bug 796594

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Re: Window behaviour - pressing the 'restore' window indicator on a semi-maximised window should return it to the restored state

=== added file 'debian/patches/rev_2847_bug_796594.patch'
--- debian/patches/rev_2847_bug_796594.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/rev_2847_bug_796594.patch 2011-10-17 07:16:06 +0000
@@ -0,0 +1,161 @@
+=== modified file 'plugins/decor/src/decor.cpp'
+Index: compiz-0.9.6+bzr20110929/plugins/decor/src/decor.cpp
+===================================================================
+--- compiz-0.9.6+bzr20110929.orig/plugins/decor/src/decor.cpp 2011-10-17 15:12:20.278356818 +0800
++++ compiz-0.9.6+bzr20110929/plugins/decor/src/decor.cpp 2011-10-17 15:12:22.718368920 +0800
+@@ -934,7 +934,7 @@
+ if (!wd)
+ return false;
+
+- if ((window->state () & MAXIMIZE_STATE) == MAXIMIZE_STATE)
++ if ((window->state () & MAXIMIZE_STATE))
+ window->setWindowFrameExtents (&wd->decor->maxBorder,
+ &wd->decor->maxInput);
+ else if (!window->hasUnmapReference ())
+@@ -1084,7 +1084,7 @@
+ else
+ parent = window->frame ();
+
+- if ((window->state () & MAXIMIZE_STATE) == MAXIMIZE_STATE)
++ if ((window->state () & MAXIMIZE_STATE))
+ {
+ border = wd->decor->maxBorder;
+ input = wd->decor->maxInput;
+@@ -1214,7 +1214,7 @@
+ int bw = server.border () * 2;
+ CompWindowExtents input;
+
+- if ((window->state () & MAXIMIZE_STATE) == MAXIMIZE_STATE)
++ if ((window->state () & MAXIMIZE_STATE))
+ input = wd->decor->maxInput;
+ else
+ input = wd->decor->input;
+@@ -2007,7 +2007,7 @@
+ int oldShiftY = shiftY ();
+ int moveDx, moveDy;
+
+- if ((window->state () & MAXIMIZE_STATE) == MAXIMIZE_STATE)
++ if ((window->state () & MAXIMIZE_STATE))
+ window->setWindowFrameExtents (&wd->decor->maxBorder,
+ &wd->decor->maxInput);
+ else
+Index: compiz-0.9.6+bzr20110929/src/window.cpp
+===================================================================
+--- compiz-0.9.6+bzr20110929.orig/src/window.cpp 2011-10-17 15:12:51.974513993 +0800
++++ compiz-0.9.6+bzr20110929/src/window.cpp 2011-10-17 15:14:52.863113452 +0800
+@@ -3855,9 +3855,9 @@
+
+ if (state & CompWindowStateMaximizedVertMask)
+ {
+- if (old.y () < y + workArea.y () + serverInput.top)
++ if (old.y () < y + workArea.y () + border.top)
+ {
+- xwc->y = y + workArea.y () + serverInput.top;
++ xwc->y = y + workArea.y () + border.top;
+ mask |= CWY;
+ }
+ else
+@@ -3865,16 +3865,16 @@
+ height = xwc->height + old.border () * 2;
+
+ max = y + workArea.bottom ();
+- if (old.y () + (int) old.height () + serverInput.bottom > max)
++ if (old.y () + (int) old.height () + border.bottom > max)
+ {
+- xwc->y = max - height - serverInput.bottom;
++ xwc->y = max - height - border.bottom;
+ mask |= CWY;
+ }
+- else if (old.y () + height + serverInput.bottom > max)
++ else if (old.y () + height + border.bottom > max)
+ {
+ xwc->y = y + workArea.y () +
+- (workArea.height () - serverInput.top - height -
+- serverInput.bottom) / 2 + serverInput.top;
++ (workArea.height () - border.top - height -
++ border.bottom) / 2 + border.top;
+ mask |= CWY;
+ }
+ }
+@@ -3882,9 +3882,9 @@
+
+ if (state & CompWindowStateMaximizedHorzMask)
+ {
+- if (old.x () < x + workArea.x () + serverInput.left)
++ if (old.x () < x + workArea.x () + border.left)
+ {
+- xwc->x = x + workArea.x () + serverInput.left;
++ xwc->x = x + workArea.x () + border.left;
+ mask |= CWX;
+ }
+ else
+@@ -3892,16 +3892,16 @@
+ width = xwc->width + old.border () * 2;
+
+ max = x + workArea.right ();
+- if (old.x () + (int) old.width () + serverInput.right > max)
++ if (old.x () + (int) old.width () + border.right > max)
+ {
+- xwc->x = max - width - serverInput.right;
++ xwc->x = max - width - border.right;
+ mask |= CWX;
+ }
+- else if (old.x () + width + serverInput.right > max)
++ else if (old.x () + width + border.right > max)
+ {
+ xwc->x = x + workArea.x () +
+- (workArea.width () - serverInput.left - width -
+- serverInput.right) / 2 + serverInput.left;
++ (workArea.width () - border.left - width -
++ border.right) / 2 + border.left;
+ mask |= CWX;
+ }
+ }
+Index: compiz-0.9.6+bzr20110929/unity/unity_window_decorator/src/events.c
+===================================================================
+--- compiz-0.9.6+bzr20110929.orig/unity/unity_window_decorator/src/events.c 2011-10-17 15:12:51.950513875 +0800
++++ compiz-0.9.6+bzr20110929/unity/unity_window_decorator/src/events.c 2011-10-17 15:15:28.971292509 +0800
+@@ -136,28 +136,27 @@
+ {
+ if (state == BUTTON_EVENT_ACTION_STATE)
+ {
+- if (gtkwd_event->button == 2)
++ if (wnck_window_is_maximized (win))
++ wnck_window_unmaximize (win);
++ if (wnck_window_is_maximized_vertically (win))
++ wnck_window_unmaximize_vertically (win);
++ else if (wnck_window_is_maximized_horizontally (win))
++ wnck_window_unmaximize_horizontally (win);
++ else
+ {
+- if (wnck_window_is_maximized_vertically (win))
+- wnck_window_unmaximize_vertically (win);
+- else
++ if (gtkwd_event->button == 2)
++ {
+ wnck_window_maximize_vertically (win);
+- }
+- else if (gtkwd_event->button == 3)
+- {
+- if (wnck_window_is_maximized_horizontally (win))
+- wnck_window_unmaximize_horizontally (win);
+- else
++ }
++ else if (gtkwd_event->button == 3)
++ {
+ wnck_window_maximize_horizontally (win);
+- }
+- else
+- {
+- if (wnck_window_is_maximized (win))
+- wnck_window_unmaximize (win);
++ }
+ else
++ {
+ wnck_window_maximize (win);
++ }
+ }
+- }
+ }
+ break;
+ default:

This ensures that pressing the maximize button on a semi-maximized window will actually un-semi-maximize it.