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

Proposed by Mirco Müller
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
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) Approve
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.
Revision history for this message
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
=== modified file 'src/PanelIndicatorObjectEntryView.cpp'
--- src/PanelIndicatorObjectEntryView.cpp 2011-01-13 15:54:59 +0000
+++ src/PanelIndicatorObjectEntryView.cpp 2011-01-20 13:07:37 +0000
@@ -36,13 +36,14 @@
36static void draw_menu_bg (cairo_t *cr, int width, int height);36static void draw_menu_bg (cairo_t *cr, int width, int height);
3737
3838
39PanelIndicatorObjectEntryView::PanelIndicatorObjectEntryView (IndicatorObjectEntryProxy *proxy)39PanelIndicatorObjectEntryView::PanelIndicatorObjectEntryView (IndicatorObjectEntryProxy *proxy, int padding)
40: TextureArea (NUX_TRACKER_LOCATION),40: TextureArea (NUX_TRACKER_LOCATION),
41 _proxy (proxy),41 _proxy (proxy),
42 _util_cg (CAIRO_FORMAT_ARGB32, 1, 1)42 _util_cg (CAIRO_FORMAT_ARGB32, 1, 1)
43{43{
44 _proxy->active_changed.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnActiveChanged));44 _proxy->active_changed.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnActiveChanged));
45 _proxy->updated.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::Refresh));45 _proxy->updated.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::Refresh));
46 _padding = padding;
4647
47 InputArea::OnMouseDown.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseDown));48 InputArea::OnMouseDown.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseDown));
48 InputArea::OnMouseWheel.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseWheel));49 InputArea::OnMouseWheel.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseWheel));
@@ -185,7 +186,7 @@
185 }186 }
186187
187 if (width)188 if (width)
188 width += PADDING *2;189 width += _padding *2;
189190
190 SetMinimumWidth (width);191 SetMinimumWidth (width);
191192
@@ -196,7 +197,7 @@
196 if (_proxy->GetActive ())197 if (_proxy->GetActive ())
197 draw_menu_bg (cr, width, height);198 draw_menu_bg (cr, width, height);
198199
199 x = PADDING;200 x = _padding;
200 y = 0;201 y = 0;
201202
202 if (_proxy->GetPixbuf () && _proxy->icon_visible)203 if (_proxy->GetPixbuf () && _proxy->icon_visible)
203204
=== modified file 'src/PanelIndicatorObjectEntryView.h'
--- src/PanelIndicatorObjectEntryView.h 2011-01-13 15:54:59 +0000
+++ src/PanelIndicatorObjectEntryView.h 2011-01-20 13:07:37 +0000
@@ -30,13 +30,13 @@
30#include "Introspectable.h"30#include "Introspectable.h"
3131
32#define PANEL_HEIGHT 2432#define PANEL_HEIGHT 24
33#define PADDING 633//#define PADDING 6
34#define SPACING 334#define SPACING 3
3535
36class PanelIndicatorObjectEntryView : public nux::TextureArea, public Introspectable36class PanelIndicatorObjectEntryView : public nux::TextureArea, public Introspectable
37{37{
38public:38public:
39 PanelIndicatorObjectEntryView (IndicatorObjectEntryProxy *proxy);39 PanelIndicatorObjectEntryView (IndicatorObjectEntryProxy *proxy, int padding = 3);
40 ~PanelIndicatorObjectEntryView ();40 ~PanelIndicatorObjectEntryView ();
4141
42 void Refresh ();42 void Refresh ();
@@ -55,6 +55,7 @@
55 IndicatorObjectEntryProxy *_proxy;55 IndicatorObjectEntryProxy *_proxy;
56private:56private:
57 nux::CairoGraphics _util_cg;57 nux::CairoGraphics _util_cg;
58 int _padding;
58};59};
5960
60#endif // PANEL_INDICATOR_OBJECT_ENTRY_VIEW_H61#endif // PANEL_INDICATOR_OBJECT_ENTRY_VIEW_H
6162
=== modified file 'src/PanelMenuView.cpp'
--- src/PanelMenuView.cpp 2011-01-14 18:17:34 +0000
+++ src/PanelMenuView.cpp 2011-01-20 13:07:37 +0000
@@ -44,7 +44,7 @@
44 PanelMenuView *self);44 PanelMenuView *self);
4545
4646
47PanelMenuView::PanelMenuView ()47PanelMenuView::PanelMenuView (int padding)
48: _matcher (NULL),48: _matcher (NULL),
49 _title_layer (NULL),49 _title_layer (NULL),
50 _util_cg (CAIRO_FORMAT_ARGB32, 1, 1),50 _util_cg (CAIRO_FORMAT_ARGB32, 1, 1),
@@ -67,6 +67,8 @@
67 */67 */
68 _layout = _menu_layout;68 _layout = _menu_layout;
6969
70 _padding = padding;
71
70 _window_buttons = new WindowButtons ();72 _window_buttons = new WindowButtons ();
71 _window_buttons->NeedRedraw ();73 _window_buttons->NeedRedraw ();
72 _window_buttons->close_clicked.connect (sigc::mem_fun (this, &PanelMenuView::OnCloseClicked));74 _window_buttons->close_clicked.connect (sigc::mem_fun (this, &PanelMenuView::OnCloseClicked));
@@ -168,14 +170,14 @@
168 nux::Geometry geo = GetGeometry ();170 nux::Geometry geo = GetGeometry ();
169171
170 old_window_buttons_w = _window_buttons->GetContentWidth ();172 old_window_buttons_w = _window_buttons->GetContentWidth ();
171 _window_buttons->SetGeometry (geo.x + PADDING, geo.y, old_window_buttons_w, geo.height);173 _window_buttons->SetGeometry (geo.x + _padding, geo.y, old_window_buttons_w, geo.height);
172 _window_buttons->ComputeLayout2 ();174 _window_buttons->ComputeLayout2 ();
173 new_window_buttons_w = _window_buttons->GetContentWidth ();175 new_window_buttons_w = _window_buttons->GetContentWidth ();
174176
175 177
176 /* Explicitly set the size and position of the widgets */178 /* Explicitly set the size and position of the widgets */
177 geo.x += PADDING + new_window_buttons_w + PADDING;179 geo.x += _padding + new_window_buttons_w + _padding;
178 geo.width -= PADDING + new_window_buttons_w + PADDING;180 geo.width -= _padding + new_window_buttons_w + _padding;
179181
180 old_menu_area_w = _menu_layout->GetContentWidth ();182 old_menu_area_w = _menu_layout->GetContentWidth ();
181 _menu_layout->SetGeometry (geo.x, geo.y, old_menu_area_w, geo.height);183 _menu_layout->SetGeometry (geo.x, geo.y, old_menu_area_w, geo.height);
@@ -196,7 +198,7 @@
196PanelMenuView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)198PanelMenuView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
197{199{
198 nux::Geometry geo = GetGeometry ();200 nux::Geometry geo = GetGeometry ();
199 int button_width = PADDING + _window_buttons->GetContentWidth () + PADDING;201 int button_width = _padding + _window_buttons->GetContentWidth () + _padding;
200 float factor = 4;202 float factor = 4;
201 button_width /= factor;203 button_width /= factor;
202 204
@@ -430,11 +432,11 @@
430 cr = cairo_graphics.GetContext();432 cr = cairo_graphics.GetContext();
431 cairo_set_line_width (cr, 1);433 cairo_set_line_width (cr, 1);
432434
433 x = PADDING;435 x = _padding;
434 y = 0;436 y = 0;
435437
436 if (_is_maximized)438 if (_is_maximized)
437 x += _window_buttons->GetContentWidth () + PADDING + PADDING;439 x += _window_buttons->GetContentWidth () + _padding + _padding;
438440
439 if (label)441 if (label)
440 {442 {
@@ -518,7 +520,7 @@
518void520void
519PanelMenuView::OnEntryAdded (IndicatorObjectEntryProxy *proxy)521PanelMenuView::OnEntryAdded (IndicatorObjectEntryProxy *proxy)
520{522{
521 PanelIndicatorObjectEntryView *view = new PanelIndicatorObjectEntryView (proxy);523 PanelIndicatorObjectEntryView *view = new PanelIndicatorObjectEntryView (proxy, 6);
522 view->active_changed.connect (sigc::mem_fun (this, &PanelMenuView::OnActiveChanged));524 view->active_changed.connect (sigc::mem_fun (this, &PanelMenuView::OnActiveChanged));
523 view->refreshed.connect (sigc::mem_fun (this, &PanelMenuView::OnEntryRefreshed));525 view->refreshed.connect (sigc::mem_fun (this, &PanelMenuView::OnEntryRefreshed));
524 _menu_layout->AddView (view, 0, nux::eCenter, nux::eFull);526 _menu_layout->AddView (view, 0, nux::eCenter, nux::eFull);
525527
=== modified file 'src/PanelMenuView.h'
--- src/PanelMenuView.h 2010-12-30 15:57:11 +0000
+++ src/PanelMenuView.h 2011-01-20 13:07:37 +0000
@@ -47,7 +47,7 @@
47 // It also deals with undecorating maximized windows (and redecorating them47 // It also deals with undecorating maximized windows (and redecorating them
48 // on unmaximize)48 // on unmaximize)
4949
50 PanelMenuView ();50 PanelMenuView (int padding = 6);
51 ~PanelMenuView ();51 ~PanelMenuView ();
5252
53 void FullRedraw ();53 void FullRedraw ();
@@ -110,5 +110,6 @@
110 PanelTitlebarGrabArea * _panel_titlebar_grab_area;110 PanelTitlebarGrabArea * _panel_titlebar_grab_area;
111111
112 std::map<guint32, bool> _decor_map;112 std::map<guint32, bool> _decor_map;
113 int _padding;
113};114};
114#endif115#endif