Merge lp:~azzar1/unity/fix-713087 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 931
Proposed branch: lp:~azzar1/unity/fix-713087
Merge into: lp:unity
Diff against target: 279 lines (+59/-14)
8 files modified
src/Launcher.cpp (+1/-0)
src/PanelHomeButton.cpp (+21/-9)
src/PanelHomeButton.h (+3/-1)
src/PlacesController.cpp (+12/-4)
src/PlacesController.h (+2/-0)
src/unityshell.cpp (+10/-0)
src/unityshell.h (+2/-0)
unityshell.xml.in (+8/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-713087
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+52206@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Launcher.cpp'
--- src/Launcher.cpp 2011-03-01 11:25:44 +0000
+++ src/Launcher.cpp 2011-03-04 15:16:33 +0000
@@ -1844,6 +1844,7 @@
1844 _icon_size = tile_size;1844 _icon_size = tile_size;
1845 _icon_image_size = icon_size;1845 _icon_image_size = icon_size;
1846 _icon_image_size_delta = tile_size - icon_size;1846 _icon_image_size_delta = tile_size - icon_size;
1847 _icon_glow_size = icon_size + 14;
18471848
1848 // recreate tile textures1849 // recreate tile textures
18491850
18501851
=== modified file 'src/PanelHomeButton.cpp'
--- src/PanelHomeButton.cpp 2011-02-23 11:18:17 +0000
+++ src/PanelHomeButton.cpp 2011-03-04 15:16:33 +0000
@@ -35,15 +35,14 @@
35#include "PanelStyle.h"35#include "PanelStyle.h"
3636
37#define PANEL_HEIGHT 2437#define PANEL_HEIGHT 24
38#define BUTTON_WIDTH 66
3938
40NUX_IMPLEMENT_OBJECT_TYPE (PanelHomeButton);39NUX_IMPLEMENT_OBJECT_TYPE (PanelHomeButton);
4140
42PanelHomeButton::PanelHomeButton ()41PanelHomeButton::PanelHomeButton ()
43: TextureArea (NUX_TRACKER_LOCATION),42: TextureArea (NUX_TRACKER_LOCATION)
44 _util_cg (CAIRO_FORMAT_ARGB32, BUTTON_WIDTH, PANEL_HEIGHT)
45{43{
46 SetMinMaxSize (BUTTON_WIDTH, PANEL_HEIGHT);44 _button_width = 66;
45 SetMinMaxSize (_button_width, PANEL_HEIGHT);
4746
48 OnMouseClick.connect (sigc::mem_fun (this, &PanelHomeButton::RecvMouseClick));47 OnMouseClick.connect (sigc::mem_fun (this, &PanelHomeButton::RecvMouseClick));
49 48
@@ -63,17 +62,19 @@
63void62void
64PanelHomeButton::Refresh ()63PanelHomeButton::Refresh ()
65{64{
66 int width = BUTTON_WIDTH;65 int width = _button_width;
67 int height = PANEL_HEIGHT;66 int height = PANEL_HEIGHT;
68 GdkPixbuf *pixbuf;67 GdkPixbuf *pixbuf;
6968
69 SetMinMaxSize (_button_width, PANEL_HEIGHT);
70
70 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, width, height);71 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, width, height);
71 cairo_t *cr = cairo_graphics.GetContext();72 cairo_t *cr = cairo_graphics.GetContext();
72 cairo_set_line_width (cr, 1);73 cairo_set_line_width (cr, 1);
7374
74 pixbuf = PanelStyle::GetDefault ()->GetHomeButton ();75 pixbuf = PanelStyle::GetDefault ()->GetHomeButton ();
75 gdk_cairo_set_source_pixbuf (cr, pixbuf,76 gdk_cairo_set_source_pixbuf (cr, pixbuf,
76 (BUTTON_WIDTH-gdk_pixbuf_get_width (pixbuf))/2,77 (_button_width-gdk_pixbuf_get_width (pixbuf))/2,
77 (PANEL_HEIGHT-gdk_pixbuf_get_height (pixbuf))/2);78 (PANEL_HEIGHT-gdk_pixbuf_get_height (pixbuf))/2);
78 g_object_unref (pixbuf);79 g_object_unref (pixbuf);
7980
@@ -144,7 +145,7 @@
144 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(iiiia{sv})"));145 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(iiiia{sv})"));
145 g_variant_builder_add (&builder, "i", x);146 g_variant_builder_add (&builder, "i", x);
146 g_variant_builder_add (&builder, "i", y);147 g_variant_builder_add (&builder, "i", y);
147 g_variant_builder_add (&builder, "i", BUTTON_WIDTH);148 g_variant_builder_add (&builder, "i", _button_width);
148 g_variant_builder_add (&builder, "i", PANEL_HEIGHT);149 g_variant_builder_add (&builder, "i", PANEL_HEIGHT);
149 150
150 g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));151 g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
@@ -164,7 +165,7 @@
164 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(iiiia{sv})"));165 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(iiiia{sv})"));
165 g_variant_builder_add (&builder, "i", x);166 g_variant_builder_add (&builder, "i", x);
166 g_variant_builder_add (&builder, "i", y);167 g_variant_builder_add (&builder, "i", y);
167 g_variant_builder_add (&builder, "i", BUTTON_WIDTH);168 g_variant_builder_add (&builder, "i", _button_width);
168 g_variant_builder_add (&builder, "i", PANEL_HEIGHT);169 g_variant_builder_add (&builder, "i", PANEL_HEIGHT);
169 170
170 g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));171 g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
@@ -184,7 +185,7 @@
184 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(iiiia{sv})"));185 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(iiiia{sv})"));
185 g_variant_builder_add (&builder, "i", x);186 g_variant_builder_add (&builder, "i", x);
186 g_variant_builder_add (&builder, "i", y);187 g_variant_builder_add (&builder, "i", y);
187 g_variant_builder_add (&builder, "i", BUTTON_WIDTH);188 g_variant_builder_add (&builder, "i", _button_width);
188 g_variant_builder_add (&builder, "i", PANEL_HEIGHT);189 g_variant_builder_add (&builder, "i", PANEL_HEIGHT);
189 190
190 g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));191 g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
@@ -195,6 +196,17 @@
195 ubus_server_send_message (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE, g_variant_builder_end (&builder));196 ubus_server_send_message (ubus, UBUS_HOME_BUTTON_TRIGGER_UPDATE, g_variant_builder_end (&builder));
196}197}
197198
199void
200PanelHomeButton::SetButtonWidth (int button_width)
201{
202 if (_button_width == button_width)
203 return;
204
205 _button_width = button_width;
206
207 Refresh();
208}
209
198const gchar*210const gchar*
199PanelHomeButton::GetName ()211PanelHomeButton::GetName ()
200{212{
201213
=== modified file 'src/PanelHomeButton.h'
--- src/PanelHomeButton.h 2011-02-17 09:56:22 +0000
+++ src/PanelHomeButton.h 2011-03-04 15:16:33 +0000
@@ -42,6 +42,8 @@
4242
43 void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);43 void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
4444
45 void SetButtonWidth (int button_width);
46
45protected:47protected:
46 const gchar* GetName ();48 const gchar* GetName ();
47 void AddProperties (GVariantBuilder *builder);49 void AddProperties (GVariantBuilder *builder);
@@ -50,7 +52,7 @@
50 void Refresh ();52 void Refresh ();
5153
52private:54private:
53 nux::CairoGraphics _util_cg;55 int _button_width;
54};56};
5557
56#endif // PANEL_HOME_BUTTON_H58#endif // PANEL_HOME_BUTTON_H
5759
=== modified file 'src/PlacesController.cpp'
--- src/PlacesController.cpp 2011-02-28 16:49:11 +0000
+++ src/PlacesController.cpp 2011-03-04 15:16:33 +0000
@@ -32,6 +32,8 @@
3232
33#include "PlacesController.h"33#include "PlacesController.h"
3434
35int PlacesController::_launcher_size = 66;
36
35PlacesController::PlacesController ()37PlacesController::PlacesController ()
36: _visible (false),38: _visible (false),
37 _fullscren_request (false)39 _fullscren_request (false)
@@ -156,7 +158,7 @@
156 }158 }
157 else159 else
158 {160 {
159 width = rect.width - 66;161 width = rect.width - _launcher_size;
160 height = rect.height - 24;162 height = rect.height - 24;
161163
162 _view->SetSizeMode (PlacesView::SIZE_MODE_FULLSCREEN);164 _view->SetSizeMode (PlacesView::SIZE_MODE_FULLSCREEN);
@@ -173,7 +175,7 @@
173{175{
174 int width = 0, height = 0;176 int width = 0, height = 0;
175 static_cast<PlacesController *> (user_data)->GetWindowSize (&width, &height);177 static_cast<PlacesController *> (user_data)->GetWindowSize (&width, &height);
176 geo = nux::Geometry (66, 24, width, height);178 geo = nux::Geometry (_launcher_size, 24, width, height);
177}179}
178180
179void181void
@@ -182,7 +184,7 @@
182 int width = 0, height = 0;184 int width = 0, height = 0;
183 _fullscren_request = true;185 _fullscren_request = true;
184 GetWindowSize (&width, &height);186 GetWindowSize (&width, &height);
185 _window->SetGeometry (nux::Geometry (66, 24, width, height));187 _window->SetGeometry (nux::Geometry (_launcher_size, 24, width, height));
186}188}
187189
188void190void
@@ -203,7 +205,7 @@
203PlacesController::RecvMouseDownOutsideOfView (int x, int y, unsigned long button_flags, unsigned long key_flags)205PlacesController::RecvMouseDownOutsideOfView (int x, int y, unsigned long button_flags, unsigned long key_flags)
204{206{
205 //FIXME: We need a way to get the real position/size of the homebutton207 //FIXME: We need a way to get the real position/size of the homebutton
206 nux::Geometry geo (0, 0, 66, 24);208 nux::Geometry geo (0, 0, _launcher_size, 24);
207 if (!geo.IsPointInside (x, y))209 if (!geo.IsPointInside (x, y))
208 Hide ();210 Hide ();
209}211}
@@ -214,6 +216,12 @@
214 entry ? Show () : Hide ();216 entry ? Show () : Hide ();
215}217}
216218
219void
220PlacesController::SetLauncherSize (int launcher_size)
221{
222 _launcher_size = launcher_size;
223}
224
217225
218/* Introspection */226/* Introspection */
219const gchar *227const gchar *
220228
=== modified file 'src/PlacesController.h'
--- src/PlacesController.h 2011-02-28 14:16:05 +0000
+++ src/PlacesController.h 2011-03-04 15:16:33 +0000
@@ -41,6 +41,7 @@
41 void Show ();41 void Show ();
42 void Hide ();42 void Hide ();
43 void ToggleShowHide ();43 void ToggleShowHide ();
44 static void SetLauncherSize (int launcher_size);
4445
45protected:46protected:
46 const gchar* GetName ();47 const gchar* GetName ();
@@ -65,6 +66,7 @@
65 PlaceFactoryFile *_factory;66 PlaceFactoryFile *_factory;
66 bool _visible;67 bool _visible;
67 bool _fullscren_request;68 bool _fullscren_request;
69 static int _launcher_size;
68};70};
6971
70#endif // PLACES_CONTROLLER_H72#endif // PLACES_CONTROLLER_H
7173
=== modified file 'src/unityshell.cpp'
--- src/unityshell.cpp 2011-03-01 09:41:36 +0000
+++ src/unityshell.cpp 2011-03-04 15:16:33 +0000
@@ -551,6 +551,13 @@
551 break;551 break;
552 case UnityshellOptions::PanelOpacity:552 case UnityshellOptions::PanelOpacity:
553 panelView->SetOpacity (optionGetPanelOpacity ());553 panelView->SetOpacity (optionGetPanelOpacity ());
554 break;
555 case UnityshellOptions::IconSize:
556 panelHomeButton->SetButtonWidth (optionGetIconSize()+18);
557 launcher->SetIconSize (optionGetIconSize()+6, optionGetIconSize());
558 PlacesController::SetLauncherSize (optionGetIconSize()+18);
559
560 break;
554 case UnityshellOptions::AutohideAnimation:561 case UnityshellOptions::AutohideAnimation:
555 launcher->SetAutoHideAnimation ((Launcher::AutoHideAnimation) optionGetAutohideAnimation ());562 launcher->SetAutoHideAnimation ((Launcher::AutoHideAnimation) optionGetAutohideAnimation ());
556 break;563 break;
@@ -733,6 +740,7 @@
733 optionSetLaunchAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));740 optionSetLaunchAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
734 optionSetUrgentAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));741 optionSetUrgentAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
735 optionSetPanelOpacityNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));742 optionSetPanelOpacityNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
743 optionSetIconSizeNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
736 optionSetAutohideAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));744 optionSetAutohideAnimationNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
737 optionSetShowLauncherInitiate (boost::bind (&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));745 optionSetShowLauncherInitiate (boost::bind (&UnityScreen::showLauncherKeyInitiate, this, _1, _2, _3));
738 optionSetShowLauncherTerminate (boost::bind (&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));746 optionSetShowLauncherTerminate (boost::bind (&UnityScreen::showLauncherKeyTerminate, this, _1, _2, _3));
@@ -837,6 +845,8 @@
837 self->panelView = new PanelView ();845 self->panelView = new PanelView ();
838 self->AddChild (self->panelView);846 self->AddChild (self->panelView);
839847
848 self->panelHomeButton = self->panelView->HomeButton ();
849
840 layout = new nux::HLayout();850 layout = new nux::HLayout();
841851
842 self->panelView->SetMaximumHeight(24);852 self->panelView->SetMaximumHeight(24);
843853
=== modified file 'src/unityshell.h'
--- src/unityshell.h 2011-02-28 16:32:12 +0000
+++ src/unityshell.h 2011-03-04 15:16:33 +0000
@@ -34,6 +34,7 @@
34#include "Launcher.h"34#include "Launcher.h"
35#include "LauncherController.h"35#include "LauncherController.h"
36#include "PanelView.h"36#include "PanelView.h"
37#include "PanelHomeButton.h"
37#include "PlacesController.h"38#include "PlacesController.h"
38#include "DebugDBusInterface.h"39#include "DebugDBusInterface.h"
39#include <Nux/WindowThread.h>40#include <Nux/WindowThread.h>
@@ -191,6 +192,7 @@
191 Launcher *launcher;192 Launcher *launcher;
192 LauncherController *controller;193 LauncherController *controller;
193 PanelView *panelView;194 PanelView *panelView;
195 PanelHomeButton *panelHomeButton;
194 PlacesController *placesController;196 PlacesController *placesController;
195 nux::WindowThread *wt;197 nux::WindowThread *wt;
196 nux::BaseWindow *launcherWindow;198 nux::BaseWindow *launcherWindow;
197199
=== modified file 'unityshell.xml.in'
--- unityshell.xml.in 2011-02-23 08:10:51 +0000
+++ unityshell.xml.in 2011-03-04 15:16:33 +0000
@@ -144,6 +144,14 @@
144 <max>1.0</max>144 <max>1.0</max>
145 <precision>0.01</precision>145 <precision>0.01</precision>
146 </option>146 </option>
147 <option name="icon_size" type="int">
148 <_short>Launcher icon size</_short>
149 <_long>The size of the launcher icons</_long>
150 <default>48</default>
151 <min>32</min>
152 <max>64</max>
153 <precision>1</precision>
154 </option>
147 <option name="autohide_animation" type="int">155 <option name="autohide_animation" type="int">
148 <_short>Hide Animation</_short>156 <_short>Hide Animation</_short>
149 <_long>Animation played when the launcher is showing or hiding</_long>157 <_long>Animation played when the launcher is showing or hiding</_long>