Merge lp:~3v1n0/unity/overlay-disabled-close-button-fix into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2325
Proposed branch: lp:~3v1n0/unity/overlay-disabled-close-button-fix
Merge into: lp:unity
Diff against target: 75 lines (+37/-13)
1 file modified
plugins/unityshell/src/WindowButtons.cpp (+37/-13)
To merge this branch: bzr merge lp:~3v1n0/unity/overlay-disabled-close-button-fix
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+102919@code.launchpad.net

Commit message

WindowButtons: avoid to disable the Overlay close button.

This fixes a regression I probabily introduced (sorry).

Description of the change

WindowButtons: avoid to disable the Overlay close button.

This fixes a regression I probabily introduced (sorry).

Tests for this are already covered by AP and manual tests.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/696/console reported an error when processing this lp:~3v1n0/unity/overlay-disabled-close-button-fix branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/WindowButtons.cpp'
2--- plugins/unityshell/src/WindowButtons.cpp 2012-04-13 21:08:27 +0000
3+++ plugins/unityshell/src/WindowButtons.cpp 2012-04-20 19:20:24 +0000
4@@ -530,6 +530,9 @@
5
6 if (button)
7 {
8+ if (button->GetType() == panel::WindowButtonType::CLOSE)
9+ button->SetEnabled(true);
10+
11 if (button->GetType() == panel::WindowButtonType::UNMAXIMIZE)
12 restore_button = button;
13
14@@ -596,6 +599,21 @@
15
16 if (button)
17 {
18+ if (window_xid_)
19+ {
20+ if (button->GetType() == panel::WindowButtonType::CLOSE)
21+ {
22+ bool closable = WindowManager::Default()->IsWindowClosable(window_xid_);
23+ button->SetEnabled(closable);
24+ }
25+
26+ if (button->GetType() == panel::WindowButtonType::MINIMIZE)
27+ {
28+ bool minimizable = WindowManager::Default()->IsWindowMinimizable(window_xid_);
29+ button->SetEnabled(minimizable);
30+ }
31+ }
32+
33 if (button->GetType() == panel::WindowButtonType::UNMAXIMIZE)
34 restore_button = button;
35
36@@ -721,20 +739,26 @@
37 {
38 window_xid_ = xid;
39
40- for (auto area : GetChildren())
41+ if (window_xid_ && active_overlay_.empty())
42 {
43- auto button = dynamic_cast<WindowButton*>(area);
44-
45- if (button->GetType() == panel::WindowButtonType::CLOSE)
46- {
47- bool closable = WindowManager::Default()->IsWindowClosable(xid);
48- button->SetEnabled(closable);
49- }
50-
51- if (button->GetType() == panel::WindowButtonType::MINIMIZE)
52- {
53- bool minimizable = WindowManager::Default()->IsWindowMinimizable(xid);
54- button->SetEnabled(minimizable);
55+ for (auto area : GetChildren())
56+ {
57+ auto button = dynamic_cast<WindowButton*>(area);
58+
59+ if (!button)
60+ continue;
61+
62+ if (button->GetType() == panel::WindowButtonType::CLOSE)
63+ {
64+ bool closable = WindowManager::Default()->IsWindowClosable(xid);
65+ button->SetEnabled(closable);
66+ }
67+
68+ if (button->GetType() == panel::WindowButtonType::MINIMIZE)
69+ {
70+ bool minimizable = WindowManager::Default()->IsWindowMinimizable(xid);
71+ button->SetEnabled(minimizable);
72+ }
73 }
74 }
75 }