Merge lp:~canonical-dx-team/unity/unity.fix-684114 into lp:unity

Proposed by Mirco Müller on 2011-01-20
Status: Merged
Approved by: Mirco Müller on 2011-01-20
Approved revision: 776
Merged at revision: 776
Proposed branch: lp:~canonical-dx-team/unity/unity.fix-684114
Merge into: lp:unity
Diff against target: 157 lines (+19/-14)
4 files modified
src/PanelIndicatorObjectEntryView.cpp (+4/-3)
src/PanelIndicatorObjectEntryView.h (+3/-2)
src/PanelMenuView.cpp (+10/-8)
src/PanelMenuView.h (+2/-1)
To merge this branch: bzr merge lp:~canonical-dx-team/unity/unity.fix-684114
Reviewer Review Type Date Requested Status
Neil J. Patel (community) 2011-01-20 Approve on 2011-01-20
Review via email: mp+46901@code.launchpad.net

Description of the change

Use a padding of 6px for the appmenu and 3px for the other indicators. Fixes LP: #684114

To post a comment you must log in.
776. By Mirco Müller on 2011-01-20

Actually make use of the new parameter of the constructor now

Neil J. Patel (njpatel) wrote :

Sweet!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PanelIndicatorObjectEntryView.cpp'
2--- src/PanelIndicatorObjectEntryView.cpp 2011-01-13 15:54:59 +0000
3+++ src/PanelIndicatorObjectEntryView.cpp 2011-01-20 13:07:37 +0000
4@@ -36,13 +36,14 @@
5 static void draw_menu_bg (cairo_t *cr, int width, int height);
6
7
8-PanelIndicatorObjectEntryView::PanelIndicatorObjectEntryView (IndicatorObjectEntryProxy *proxy)
9+PanelIndicatorObjectEntryView::PanelIndicatorObjectEntryView (IndicatorObjectEntryProxy *proxy, int padding)
10 : TextureArea (NUX_TRACKER_LOCATION),
11 _proxy (proxy),
12 _util_cg (CAIRO_FORMAT_ARGB32, 1, 1)
13 {
14 _proxy->active_changed.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnActiveChanged));
15 _proxy->updated.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::Refresh));
16+ _padding = padding;
17
18 InputArea::OnMouseDown.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseDown));
19 InputArea::OnMouseWheel.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseWheel));
20@@ -185,7 +186,7 @@
21 }
22
23 if (width)
24- width += PADDING *2;
25+ width += _padding *2;
26
27 SetMinimumWidth (width);
28
29@@ -196,7 +197,7 @@
30 if (_proxy->GetActive ())
31 draw_menu_bg (cr, width, height);
32
33- x = PADDING;
34+ x = _padding;
35 y = 0;
36
37 if (_proxy->GetPixbuf () && _proxy->icon_visible)
38
39=== modified file 'src/PanelIndicatorObjectEntryView.h'
40--- src/PanelIndicatorObjectEntryView.h 2011-01-13 15:54:59 +0000
41+++ src/PanelIndicatorObjectEntryView.h 2011-01-20 13:07:37 +0000
42@@ -30,13 +30,13 @@
43 #include "Introspectable.h"
44
45 #define PANEL_HEIGHT 24
46-#define PADDING 6
47+//#define PADDING 6
48 #define SPACING 3
49
50 class PanelIndicatorObjectEntryView : public nux::TextureArea, public Introspectable
51 {
52 public:
53- PanelIndicatorObjectEntryView (IndicatorObjectEntryProxy *proxy);
54+ PanelIndicatorObjectEntryView (IndicatorObjectEntryProxy *proxy, int padding = 3);
55 ~PanelIndicatorObjectEntryView ();
56
57 void Refresh ();
58@@ -55,6 +55,7 @@
59 IndicatorObjectEntryProxy *_proxy;
60 private:
61 nux::CairoGraphics _util_cg;
62+ int _padding;
63 };
64
65 #endif // PANEL_INDICATOR_OBJECT_ENTRY_VIEW_H
66
67=== modified file 'src/PanelMenuView.cpp'
68--- src/PanelMenuView.cpp 2011-01-14 18:17:34 +0000
69+++ src/PanelMenuView.cpp 2011-01-20 13:07:37 +0000
70@@ -44,7 +44,7 @@
71 PanelMenuView *self);
72
73
74-PanelMenuView::PanelMenuView ()
75+PanelMenuView::PanelMenuView (int padding)
76 : _matcher (NULL),
77 _title_layer (NULL),
78 _util_cg (CAIRO_FORMAT_ARGB32, 1, 1),
79@@ -67,6 +67,8 @@
80 */
81 _layout = _menu_layout;
82
83+ _padding = padding;
84+
85 _window_buttons = new WindowButtons ();
86 _window_buttons->NeedRedraw ();
87 _window_buttons->close_clicked.connect (sigc::mem_fun (this, &PanelMenuView::OnCloseClicked));
88@@ -168,14 +170,14 @@
89 nux::Geometry geo = GetGeometry ();
90
91 old_window_buttons_w = _window_buttons->GetContentWidth ();
92- _window_buttons->SetGeometry (geo.x + PADDING, geo.y, old_window_buttons_w, geo.height);
93+ _window_buttons->SetGeometry (geo.x + _padding, geo.y, old_window_buttons_w, geo.height);
94 _window_buttons->ComputeLayout2 ();
95 new_window_buttons_w = _window_buttons->GetContentWidth ();
96
97
98 /* Explicitly set the size and position of the widgets */
99- geo.x += PADDING + new_window_buttons_w + PADDING;
100- geo.width -= PADDING + new_window_buttons_w + PADDING;
101+ geo.x += _padding + new_window_buttons_w + _padding;
102+ geo.width -= _padding + new_window_buttons_w + _padding;
103
104 old_menu_area_w = _menu_layout->GetContentWidth ();
105 _menu_layout->SetGeometry (geo.x, geo.y, old_menu_area_w, geo.height);
106@@ -196,7 +198,7 @@
107 PanelMenuView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
108 {
109 nux::Geometry geo = GetGeometry ();
110- int button_width = PADDING + _window_buttons->GetContentWidth () + PADDING;
111+ int button_width = _padding + _window_buttons->GetContentWidth () + _padding;
112 float factor = 4;
113 button_width /= factor;
114
115@@ -430,11 +432,11 @@
116 cr = cairo_graphics.GetContext();
117 cairo_set_line_width (cr, 1);
118
119- x = PADDING;
120+ x = _padding;
121 y = 0;
122
123 if (_is_maximized)
124- x += _window_buttons->GetContentWidth () + PADDING + PADDING;
125+ x += _window_buttons->GetContentWidth () + _padding + _padding;
126
127 if (label)
128 {
129@@ -518,7 +520,7 @@
130 void
131 PanelMenuView::OnEntryAdded (IndicatorObjectEntryProxy *proxy)
132 {
133- PanelIndicatorObjectEntryView *view = new PanelIndicatorObjectEntryView (proxy);
134+ PanelIndicatorObjectEntryView *view = new PanelIndicatorObjectEntryView (proxy, 6);
135 view->active_changed.connect (sigc::mem_fun (this, &PanelMenuView::OnActiveChanged));
136 view->refreshed.connect (sigc::mem_fun (this, &PanelMenuView::OnEntryRefreshed));
137 _menu_layout->AddView (view, 0, nux::eCenter, nux::eFull);
138
139=== modified file 'src/PanelMenuView.h'
140--- src/PanelMenuView.h 2010-12-30 15:57:11 +0000
141+++ src/PanelMenuView.h 2011-01-20 13:07:37 +0000
142@@ -47,7 +47,7 @@
143 // It also deals with undecorating maximized windows (and redecorating them
144 // on unmaximize)
145
146- PanelMenuView ();
147+ PanelMenuView (int padding = 6);
148 ~PanelMenuView ();
149
150 void FullRedraw ();
151@@ -110,5 +110,6 @@
152 PanelTitlebarGrabArea * _panel_titlebar_grab_area;
153
154 std::map<guint32, bool> _decor_map;
155+ int _padding;
156 };
157 #endif