Merge lp:~mc-return/compiz/compiz.merge-fix966099-add-unmaximize-or-minimize-window-key into lp:compiz/0.9.9

Proposed by MC Return
Status: Merged
Approved by: Brandon Schaefer
Approved revision: 3595
Merged at revision: 3591
Proposed branch: lp:~mc-return/compiz/compiz.merge-fix966099-add-unmaximize-or-minimize-window-key
Merge into: lp:compiz/0.9.9
Diff against target: 77 lines (+34/-0)
4 files modified
metadata/core.xml.in (+4/-0)
src/actions.cpp (+25/-0)
src/privatescreen.h (+4/-0)
src/screen.cpp (+1/-0)
To merge this branch: bzr merge lp:~mc-return/compiz/compiz.merge-fix966099-add-unmaximize-or-minimize-window-key
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Daniel van Vugt Needs Fixing
PS Jenkins bot continuous-integration Pending
Review via email: mp+145464@code.launchpad.net

Commit message

Added a new keyboard shortcut named unmaximize_or_minimize_window_key.

This key will restore a maximized or semi-maximized window and minimize a restored window.

Per default this shortcut is disabled and has yet to be enabled via ubuntu-config.patch
for the Ubuntu distribution and Unity.

(LP: #966099)

Description of the change

Note:

The Unity MP to fully fix bug 966099 is to be found here:

https://code.launchpad.net/~mc-return/unity/unity.merge-fix966099-shortcut-fails-to-minimize-just-restores/+merge/145474

TODO:
1. Fix Unity's Help Overlay (see the above MP for Unity, that changes
unmaximize_window_key to unmaximize_or_minimize_window_key)

2. Per default this shortcut is disabled and has yet to be enabled via
ubuntu-config.patch for the Ubuntu distribution and Unity.
(+<default>&lt;Control&gt;&lt;Super&gt;Down</default>)

This MP just adds the necessary new keyboard shortcut option and the needed
functionality for it.

To post a comment you must log in.
3587. By MC Return

Fixed short name of the new unmaximize or minimize option

3588. By MC Return

Reduced diff

3589. By MC Return

Fixed indentation

3590. By MC Return

Simplified the unmaximizeOrMinimizeWin function by checking if (w) just once

3591. By MC Return

unmaximizeOrMinimizeWin will now also restore horizontally or vertically maximized windows first, not just maximized ones

3592. By MC Return

Restored the default shortcut for the unmaximize_window_key
Made Control+Super+Down the default for the unmaximize_or_minimize_window_key

TODO: ubuntu-config.patch does not need to patch the default for the
unmaximize_window_key anymore, in fact it conflicts with the new default
for the unmaximize_or_minimize_window_key now until this is fixed

3593. By MC Return

Cleared the default for unmaximize_or_minimize_window_key, as this
has to be added via ubuntu-config.patch, like done for the
unmaximize_window_key currently

3594. By MC Return

Added brackets for better readability

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Works for me.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

1. This is a pointless statement:
+ if (((w->priv->state & MAXIMIZE_STATE) == MAXIMIZE_STATE) ||
+ (w->priv->state & CompWindowStateMaximizedHorzMask) ||
+ (w->priv->state & CompWindowStateMaximizedVertMask))
and is equivalent to:
    if (w->priv->state & MAXIMIZE_STATE)

2. If design approved this I think they made a mistake. Compiz already has key combinations unmaximize_window_key and minimize_window_key. It's redundant to add a new combo that overlaps those.

review: Disapprove
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I take that back. Design are allowed to /design/ any combos they want. It doesn't matter if they're redundant. The only thing they can't do is change the meaning of window buttons.

Still, the pointless if statement needs cleaning up at least.

review: Needs Fixing
3595. By MC Return

Cleaned up pointless if statement

Revision history for this message
MC Return (mc-return) wrote :

> Still, the pointless if statement needs cleaning up at least.

Done in r3595.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Approved. (Though I do agree with Daniel about this being more redundant...but design wishes for it)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'metadata/core.xml.in'
2--- metadata/core.xml.in 2012-10-15 10:31:51 +0000
3+++ metadata/core.xml.in 2013-01-30 01:53:21 +0000
4@@ -190,6 +190,10 @@
5 <_long>Unmaximize active window</_long>
6 <default>&lt;Alt&gt;F5</default>
7 </option>
8+ <option name="unmaximize_or_minimize_window_key" type="key">
9+ <_short>Unmaximize or Minimize Window</_short>
10+ <_long>Unmaximize or minimize active window</_long>
11+ </option>
12 <option name="maximize_window_horizontally_key" type="key">
13 <_short>Maximize Window Horizontally</_short>
14 <_long>Maximize active window horizontally</_long>
15
16=== modified file 'src/actions.cpp'
17--- src/actions.cpp 2012-04-19 12:06:05 +0000
18+++ src/actions.cpp 2013-01-30 01:53:21 +0000
19@@ -68,6 +68,31 @@
20 }
21
22 bool
23+CompScreenImpl::unmaximizeOrMinimizeWin (CompAction *action,
24+ CompAction::State state,
25+ CompOption::Vector &options)
26+{
27+ CompWindow *w;
28+ Window xid;
29+
30+ xid = CompOption::getIntOptionNamed (options, "window");
31+
32+ w = screen->findTopLevelWindow (xid);
33+ if (w)
34+ {
35+ if (w->priv->state & MAXIMIZE_STATE)
36+ {
37+ w->maximize (0);
38+ }
39+ else if (w->actions () & CompWindowActionMinimizeMask)
40+ {
41+ w->minimize ();
42+ }
43+ }
44+ return true;
45+}
46+
47+bool
48 CompScreenImpl::minimizeWin (CompAction *action,
49 CompAction::State state,
50 CompOption::Vector &options)
51
52=== modified file 'src/privatescreen.h'
53--- src/privatescreen.h 2012-12-30 11:13:36 +0000
54+++ src/privatescreen.h 2013-01-30 01:53:21 +0000
55@@ -1066,6 +1066,10 @@
56 CompAction::State state,
57 CompOption::Vector &options);
58
59+ static bool unmaximizeOrMinimizeWin (CompAction *action,
60+ CompAction::State state,
61+ CompOption::Vector &options);
62+
63 static bool minimizeWin (CompAction *action,
64 CompAction::State state,
65 CompOption::Vector &options);
66
67=== modified file 'src/screen.cpp'
68--- src/screen.cpp 2013-01-11 08:03:50 +0000
69+++ src/screen.cpp 2013-01-30 01:53:21 +0000
70@@ -4490,6 +4490,7 @@
71 privateScreen.optionSetLowerWindowButtonInitiate (CompScreenImpl::lowerWin);
72
73 privateScreen.optionSetUnmaximizeWindowKeyInitiate (CompScreenImpl::unmaximizeWin);
74+ privateScreen.optionSetUnmaximizeOrMinimizeWindowKeyInitiate (CompScreenImpl::unmaximizeOrMinimizeWin);
75
76 privateScreen.optionSetMinimizeWindowKeyInitiate (CompScreenImpl::minimizeWin);
77 privateScreen.optionSetMinimizeWindowButtonInitiate (CompScreenImpl::minimizeWin);

Subscribers

People subscribed via source and target branches