Merge lp:~3v1n0/unity/shutdown-buttons-push-feedback into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Stephen M. Webb
Approved revision: no longer in the source branch.
Merged at revision: 3992
Proposed branch: lp:~3v1n0/unity/shutdown-buttons-push-feedback
Merge into: lp:unity
Diff against target: 71 lines (+12/-2)
4 files modified
shutdown/SessionButton.cpp (+7/-0)
shutdown/SessionButton.h (+1/-0)
shutdown/SessionView.cpp (+1/-1)
unity-shared/IconTexture.cpp (+3/-1)
To merge this branch: bzr merge lp:~3v1n0/unity/shutdown-buttons-push-feedback
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+263452@code.launchpad.net

Commit message

SessionButton: set button opacity to 75% when pressed

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Stephen M. Webb (bregma) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shutdown/SessionButton.cpp'
2--- shutdown/SessionButton.cpp 2014-05-08 04:04:18 +0000
3+++ shutdown/SessionButton.cpp 2015-07-01 01:46:50 +0000
4@@ -40,6 +40,7 @@
5 : nux::View(NUX_FILE_LINE_PARAM)
6 , scale(1.0)
7 , highlighted(false)
8+ , pressed(false)
9 , action([this] { return action_; })
10 , label([this] { return label_view_->GetText(); })
11 , action_(action)
12@@ -107,6 +108,8 @@
13 mouse_enter.connect([this] (int, int, unsigned long, unsigned long) { highlighted = true; });
14 mouse_leave.connect([this] (int, int, unsigned long, unsigned long) { highlighted = false; });
15 mouse_click.connect([this] (int, int, unsigned long, unsigned long) { activated.emit(); });
16+ mouse_down.connect([this] (int, int, unsigned long, unsigned long) { pressed = true; });
17+ mouse_up.connect([this] (int, int, unsigned long, unsigned long) { pressed = false; });
18
19 begin_key_focus.connect([this] { highlighted = true; });
20 end_key_focus.connect([this] { highlighted = false; });
21@@ -116,6 +119,10 @@
22 image_view_->SetTexture(value ? highlight_tex_ : normal_tex_);
23 label_view_->SetTextColor(value ? nux::color::White : nux::color::Transparent);
24 });
25+
26+ pressed.changed.connect([this] (bool value) {
27+ image_view_->SetOpacity(value ? 0.75 : 1.0);
28+ });
29 }
30
31 void Button::UpdateTextures(std::string const& texture_prefix)
32
33=== modified file 'shutdown/SessionButton.h'
34--- shutdown/SessionButton.h 2014-05-05 18:42:45 +0000
35+++ shutdown/SessionButton.h 2015-07-01 01:46:50 +0000
36@@ -52,6 +52,7 @@
37
38 nux::Property<double> scale;
39 nux::Property<bool> highlighted;
40+ nux::Property<bool> pressed;
41 nux::ROProperty<Action> action;
42 nux::ROProperty<std::string> label;
43
44
45=== modified file 'shutdown/SessionView.cpp'
46--- shutdown/SessionView.cpp 2014-06-18 15:08:33 +0000
47+++ shutdown/SessionView.cpp 2015-07-01 01:46:50 +0000
48@@ -236,7 +236,7 @@
49 {
50 if (mode() == Mode::FULL)
51 {
52- if (manager_->CanLock())
53+ if (manager_->CanLock() && !manager_->is_locked())
54 {
55 auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION);
56 button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen));
57
58=== modified file 'unity-shared/IconTexture.cpp'
59--- unity-shared/IconTexture.cpp 2014-07-28 16:28:38 +0000
60+++ unity-shared/IconTexture.cpp 2015-07-01 01:46:50 +0000
61@@ -281,8 +281,10 @@
62
63 void IconTexture::SetOpacity(float opacity)
64 {
65+ if (_opacity == opacity)
66+ return;
67+
68 _opacity = opacity;
69-
70 QueueDraw();
71 }
72