Merge lp:~azzar1/unity/fix-maximimize-button-if-vert-horz into lp:unity

Proposed by Andrea Azzarone on 2016-08-01
Status: Superseded
Proposed branch: lp:~azzar1/unity/fix-maximimize-button-if-vert-horz
Merge into: lp:unity
Diff against target: 88 lines (+20/-4)
4 files modified
decorations/DecoratedWindow.cpp (+9/-1)
decorations/DecorationsPriv.h (+2/-0)
decorations/DecorationsWindowButton.cpp (+8/-1)
decorations/DecorationsWindowButton.h (+1/-2)
To merge this branch: bzr merge lp:~azzar1/unity/fix-maximimize-button-if-vert-horz
Reviewer Review Type Date Requested Status
Unity Team 2016-08-01 Pending
Review via email: mp+301635@code.launchpad.net

This proposal has been superseded by a proposal from 2016-08-02.

Commit message

Display unmaximize button if the window is vertically or horizontally maximized.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'decorations/DecoratedWindow.cpp'
2--- decorations/DecoratedWindow.cpp 2016-07-27 10:17:42 +0000
3+++ decorations/DecoratedWindow.cpp 2016-08-01 11:02:01 +0000
4@@ -118,6 +118,10 @@
5 else
6 Undecorate();
7
8+ auto const& maximize_button = maximize_button_.lock();
9+ if (maximize_button)
10+ maximize_button->UpdateTexture();
11+
12 last_mwm_decor_ = win_->mwmDecor();
13 last_actions_ = win_->actions();
14 }
15@@ -410,7 +414,11 @@
16 top_layout_->Append(std::make_shared<WindowButton>(win_, WindowButtonType::MINIMIZE));
17
18 if (win_->actions() & (CompWindowActionMaximizeHorzMask|CompWindowActionMaximizeVertMask))
19- top_layout_->Append(std::make_shared<WindowButton>(win_, WindowButtonType::MAXIMIZE));
20+ {
21+ auto maximize_button = std::make_shared<WindowButton>(win_, WindowButtonType::MAXIMIZE);
22+ maximize_button_ = maximize_button;
23+ top_layout_->Append(maximize_button);
24+ }
25
26 auto title = std::make_shared<Title>();
27 title->text = last_title_.empty() ? WindowManager::Default().GetWindowName(win_->id()) : last_title_;
28
29=== modified file 'decorations/DecorationsPriv.h'
30--- decorations/DecorationsPriv.h 2016-07-26 11:33:50 +0000
31+++ decorations/DecorationsPriv.h 2016-08-01 11:02:01 +0000
32@@ -49,6 +49,7 @@
33 class MenuLayout;
34 class SlidingLayout;
35 class ForceQuitDialog;
36+class WindowButton;
37
38 namespace cu = compiz_utils;
39
40@@ -164,6 +165,7 @@
41 std::shared_ptr<ForceQuitDialog> force_quit_;
42 InputMixer::Ptr input_mixer_;
43 Layout::Ptr top_layout_;
44+ uweak_ptr<WindowButton> maximize_button_;
45 uweak_ptr<MenuLayout> menus_;
46 uweak_ptr<Title> title_;
47 uweak_ptr<SlidingLayout> sliding_layout_;
48
49=== modified file 'decorations/DecorationsWindowButton.cpp'
50--- decorations/DecorationsWindowButton.cpp 2014-02-27 07:11:16 +0000
51+++ decorations/DecorationsWindowButton.cpp 2016-08-01 11:02:01 +0000
52@@ -44,7 +44,14 @@
53
54 void WindowButton::UpdateTexture()
55 {
56- SetTexture(DataPool::Get()->ButtonTexture(scale(), type_, GetCurrentState()));
57+ auto type = type_;
58+
59+ if (type == WindowButtonType::MAXIMIZE &&
60+ (win_->state() & CompWindowStateMaximizedVertMask ||
61+ win_->state() & CompWindowStateMaximizedHorzMask))
62+ type = WindowButtonType::UNMAXIMIZE;
63+
64+ SetTexture(DataPool::Get()->ButtonTexture(scale(), type, GetCurrentState()));
65 }
66
67 WidgetState WindowButton::GetCurrentState() const
68
69=== modified file 'decorations/DecorationsWindowButton.h'
70--- decorations/DecorationsWindowButton.h 2014-02-19 00:03:24 +0000
71+++ decorations/DecorationsWindowButton.h 2016-08-01 11:02:01 +0000
72@@ -34,6 +34,7 @@
73 WindowButton(CompWindow*, WindowButtonType type);
74
75 WidgetState GetCurrentState() const;
76+ void UpdateTexture();
77
78 protected:
79 void ButtonDownEvent(CompPoint const&, unsigned button, Time) override;
80@@ -44,8 +45,6 @@
81 void AddProperties(debug::IntrospectionData&);
82
83 private:
84- void UpdateTexture();
85-
86 WindowButtonType type_;
87 bool pressed_;
88 bool was_pressed_;