Merge lp:~gordallott/unity/standalone-unity into lp:unity

Proposed by Gord Allott
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 2365
Proposed branch: lp:~gordallott/unity/standalone-unity
Merge into: lp:unity
Diff against target: 1365 lines (+816/-76)
23 files modified
CMakeLists.txt (+1/-0)
com.canonical.Unity.gschema.xml (+1/-0)
dash/CMakeLists.txt (+0/-1)
dash/DashController.cpp (+3/-4)
dash/DashView.cpp (+6/-4)
dash/StandaloneDash.cpp (+2/-2)
hud/StandaloneHud.cpp (+2/-2)
panel/PanelMenuView.cpp (+1/-1)
panel/StandalonePanel.cpp (+2/-2)
panel/WindowButtons.cpp (+8/-8)
plugins/unityshell/CMakeLists.txt (+2/-2)
plugins/unityshell/src/unityshell.h (+2/-2)
tests/CMakeLists.txt (+27/-26)
unity-shared/CMakeLists.txt (+20/-2)
unity-shared/DashStyle.cpp (+12/-1)
unity-shared/DashStyle.h (+2/-0)
unity-shared/OverlayRenderer.cpp (+4/-4)
unity-shared/PanelStyle.cpp (+10/-0)
unity-shared/PluginAdapterStandalone.cpp (+453/-0)
unity-shared/UnitySettings.cpp (+7/-8)
unity-shared/UnitySettings.h (+7/-7)
unity-standalone/CMakeLists.txt (+46/-0)
unity-standalone/StandaloneUnity.cpp (+198/-0)
To merge this branch: bzr merge lp:~gordallott/unity/standalone-unity
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+106844@code.launchpad.net

Commit message

Adds a standalone mode to unity

Description of the change

Adds a standalone mode to unity, basically just pulls in select components in a single window.

Required a few changes, mostly insignificant but pads out the diff. DashSettings got renamed to UnitySettings in the chaos, no need for it to be DashSpecific. Added a new FormFactor

build with make unity-standalone

its worth noting that its not perfect right now, but this diff is large enough

No tests, covered by existing tests, mostly just organisational renaming, no new logic.

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

Looks good to me, seems to work too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2012-05-07 22:28:17 +0000
3+++ CMakeLists.txt 2012-05-22 15:59:33 +0000
4@@ -131,6 +131,7 @@
5 add_subdirectory(hud)
6 add_subdirectory(launcher)
7 add_subdirectory(shortcuts)
8+add_subdirectory(unity-standalone)
9 add_subdirectory(plugins/unityshell)
10 add_subdirectory(plugins/gtkloader)
11 add_subdirectory(plugins/networkarearegion)
12
13=== modified file 'com.canonical.Unity.gschema.xml'
14--- com.canonical.Unity.gschema.xml 2012-03-21 12:31:11 +0000
15+++ com.canonical.Unity.gschema.xml 2012-05-22 15:59:33 +0000
16@@ -3,6 +3,7 @@
17 <value nick="Automatic" value="0" />
18 <value nick="Desktop" value="1" />
19 <value nick="Netbook" value="2" />
20+ <value nick="TV" value="3" />
21 </enum>
22 <enum id="home-expanded-enum">
23 <value nick="Not Expanded" value="0" />
24
25=== modified file 'dash/CMakeLists.txt'
26--- dash/CMakeLists.txt 2012-05-18 23:34:15 +0000
27+++ dash/CMakeLists.txt 2012-05-22 15:59:33 +0000
28@@ -61,7 +61,6 @@
29
30 add_library (dash-lib STATIC ${DASH_SOURCES})
31 add_dependencies (dash-lib unity-core-${UNITY_API_VERSION} unity-shared)
32-
33 #
34 # Standalone variant
35 #
36
37=== modified file 'dash/DashController.cpp'
38--- dash/DashController.cpp 2012-05-07 22:28:17 +0000
39+++ dash/DashController.cpp 2012-05-22 15:59:33 +0000
40@@ -21,7 +21,7 @@
41 #include <NuxCore/Logger.h>
42 #include <Nux/HLayout.h>
43
44-#include "unity-shared/DashSettings.h"
45+#include "unity-shared/UnitySettings.h"
46 #include "unity-shared/PanelStyle.h"
47 #include "unity-shared/PluginAdapter.h"
48 #include "unity-shared/UBusMessages.h"
49@@ -251,7 +251,6 @@
50 void Controller::ShowDash()
51 {
52 EnsureDash();
53-
54 PluginAdapter* adaptor = PluginAdapter::Default();
55 // Don't want to show at the wrong time
56 if (visible_ || adaptor->IsExpoActive() || adaptor->IsScaleActive())
57@@ -267,12 +266,12 @@
58 need_show_ = true;
59 return;
60 }
61-
62 view_->AboutToShow();
63
64 window_->ShowWindow(true);
65 window_->PushToFront();
66- window_->EnableInputWindow(true, "Dash", true, false);
67+ if (!Settings::Instance().is_standalone) // in standalone mode, we do not need an input window. we are one.
68+ window_->EnableInputWindow(true, "Dash", true, false);
69 window_->SetInputFocus();
70 window_->CaptureMouseDownAnyWhereElse(true);
71 window_->QueueDraw();
72
73=== modified file 'dash/DashView.cpp'
74--- dash/DashView.cpp 2012-05-06 23:48:38 +0000
75+++ dash/DashView.cpp 2012-05-22 15:59:33 +0000
76@@ -30,7 +30,7 @@
77 #include <UnityCore/RadioOptionFilter.h>
78
79 #include "unity-shared/DashStyle.h"
80-#include "unity-shared/DashSettings.h"
81+#include "unity-shared/UnitySettings.h"
82 #include "unity-shared/UBusMessages.h"
83
84 namespace unity
85@@ -232,14 +232,14 @@
86 {
87 nux::Geometry const& geo = GetGeometry();
88 content_geo_ = GetBestFitGeometry(geo);
89-
90- if (Settings::Instance().GetFormFactor() == FormFactor::NETBOOK)
91+ dash::Style& style = dash::Style::Instance();
92+
93+ if (style.always_maximised)
94 {
95 if (geo.width >= content_geo_.width && geo.height > content_geo_.height)
96 content_geo_ = geo;
97 }
98
99- dash::Style& style = dash::Style::Instance();
100
101 // kinda hacky, but it makes sure the content isn't so big that it throws
102 // the bottom of the dash off the screen
103@@ -771,6 +771,8 @@
104 form_factor = "netbook";
105 else if (Settings::Instance().GetFormFactor() == FormFactor::DESKTOP)
106 form_factor = "desktop";
107+ else if (Settings::Instance().GetFormFactor() == FormFactor::TV)
108+ form_factor = "tv";
109
110 unity::variant::BuilderWrapper wrapper(builder);
111 wrapper.add(nux::Geometry(GetAbsoluteX(), GetAbsoluteY(), content_geo_.width, content_geo_.height));
112
113=== modified file 'dash/StandaloneDash.cpp'
114--- dash/StandaloneDash.cpp 2012-05-06 23:48:38 +0000
115+++ dash/StandaloneDash.cpp 2012-05-22 15:59:33 +0000
116@@ -29,7 +29,7 @@
117 #include "unity-shared/BGHash.h"
118 #include "unity-shared/FontSettings.h"
119 #include "DashView.h"
120-#include "unity-shared/DashSettings.h"
121+#include "unity-shared/UnitySettings.h"
122 #include "unity-shared/DashStyle.h"
123
124 #define WIDTH 1024
125@@ -90,7 +90,7 @@
126 nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY"));
127 // The instances for the pseudo-singletons.
128 unity::dash::Style dash_style;
129- unity::dash::Settings dash_settings;
130+ unity::Settings settings;
131
132 TestRunner *test_runner = new TestRunner ();
133 wt = nux::CreateGUIThread(TEXT("Unity Dash"),
134
135=== modified file 'hud/StandaloneHud.cpp'
136--- hud/StandaloneHud.cpp 2012-05-07 00:49:31 +0000
137+++ hud/StandaloneHud.cpp 2012-05-22 15:59:33 +0000
138@@ -29,7 +29,7 @@
139
140 #include "HudView.h"
141 #include "unity-shared/DashStyle.h"
142-#include "unity-shared/DashSettings.h"
143+#include "unity-shared/UnitySettings.h"
144 #include <NuxCore/Logger.h>
145
146 namespace
147@@ -47,7 +47,7 @@
148 void Init ();
149 nux::Layout *layout;
150 unity::hud::View* hud_view_;
151- unity::dash::Settings dash_settings_;
152+ unity::Settings dash_settings_;
153
154 private:
155 unity::hud::Hud hud_service_;
156
157=== modified file 'panel/PanelMenuView.cpp'
158--- panel/PanelMenuView.cpp 2012-05-07 22:28:17 +0000
159+++ panel/PanelMenuView.cpp 2012-05-22 15:59:33 +0000
160@@ -24,7 +24,7 @@
161 #include "unity-shared/CairoTexture.h"
162 #include "PanelMenuView.h"
163 #include "unity-shared/PanelStyle.h"
164-#include "unity-shared/DashSettings.h"
165+#include "unity-shared/UnitySettings.h"
166 #include "unity-shared/UBusMessages.h"
167 #include "unity-shared/UScreen.h"
168
169
170=== modified file 'panel/StandalonePanel.cpp'
171--- panel/StandalonePanel.cpp 2012-05-07 00:49:31 +0000
172+++ panel/StandalonePanel.cpp 2012-05-22 15:59:33 +0000
173@@ -25,7 +25,7 @@
174 #include "NuxGraphics/GraphicsEngine.h"
175 #include <gtk/gtk.h>
176
177-#include "unity-shared/DashSettings.h"
178+#include "unity-shared/UnitySettings.h"
179 #include "unity-shared/PanelStyle.h"
180 #include "PanelView.h"
181 #include <dbus/dbus-glib.h>
182@@ -55,7 +55,7 @@
183
184 // The instances for the pseudo-singletons.
185 unity::panel::Style panel_style;
186- unity::dash::Settings dash_settings;
187+ unity::Settings dash_settings;
188
189 nux::WindowThread* wt = nux::CreateGUIThread(TEXT("Unity Panel"), 1024, 24, 0, &ThreadWidgetInit, 0);
190
191
192=== modified file 'panel/WindowButtons.cpp'
193--- panel/WindowButtons.cpp 2012-05-07 00:49:31 +0000
194+++ panel/WindowButtons.cpp 2012-05-22 15:59:33 +0000
195@@ -27,7 +27,7 @@
196
197 #include "WindowButtons.h"
198
199-#include "unity-shared/DashSettings.h"
200+#include "unity-shared/UnitySettings.h"
201 #include "unity-shared/PanelStyle.h"
202 #include "unity-shared/UBusMessages.h"
203 #include "unity-shared/WindowManager.h"
204@@ -394,7 +394,7 @@
205
206 ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &WindowButtons::OnOverlayShown));
207 ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &WindowButtons::OnOverlayHidden));
208- dash::Settings::Instance().changed.connect(sigc::mem_fun(this, &WindowButtons::OnDashSettingsUpdated));
209+ Settings::Instance().changed.connect(sigc::mem_fun(this, &WindowButtons::OnDashSettingsUpdated));
210 }
211
212 nux::Area* WindowButtons::FindAreaUnderMouse(const nux::Point& mouse, nux::NuxEventType event_type)
213@@ -469,7 +469,7 @@
214
215 if (win_button->IsOverlayOpen())
216 {
217- dash::Settings::Instance().SetFormFactor(dash::FormFactor::DESKTOP);
218+ Settings::Instance().SetFormFactor(FormFactor::DESKTOP);
219 }
220 else
221 {
222@@ -493,7 +493,7 @@
223
224 if (win_button->IsOverlayOpen())
225 {
226- dash::Settings::Instance().SetFormFactor(dash::FormFactor::NETBOOK);
227+ Settings::Instance().SetFormFactor(FormFactor::NETBOOK);
228 }
229
230 maximize_clicked.emit();
231@@ -545,8 +545,8 @@
232
233 if (restore_button && maximize_button)
234 {
235- dash::Settings &dash_settings = dash::Settings::Instance();
236- bool maximizable = (dash_settings.GetFormFactor() == dash::FormFactor::DESKTOP);
237+ Settings &dash_settings = Settings::Instance();
238+ bool maximizable = (dash_settings.GetFormFactor() == FormFactor::DESKTOP);
239
240 restore_button->SetEnabled(can_maximise);
241 maximize_button->SetEnabled(can_maximise);
242@@ -668,8 +668,8 @@
243
244 if (restore_button && restore_button->IsOverlayOpen() && maximize_button)
245 {
246- dash::Settings &dash_settings = dash::Settings::Instance();
247- bool maximizable = (dash_settings.GetFormFactor() == dash::FormFactor::DESKTOP);
248+ Settings &dash_settings = Settings::Instance();
249+ bool maximizable = (dash_settings.GetFormFactor() == FormFactor::DESKTOP);
250
251 if (maximizable != maximize_button->IsVisible())
252 {
253
254=== modified file 'plugins/unityshell/CMakeLists.txt'
255--- plugins/unityshell/CMakeLists.txt 2012-05-07 22:28:17 +0000
256+++ plugins/unityshell/CMakeLists.txt 2012-05-22 15:59:33 +0000
257@@ -8,8 +8,8 @@
258 CFLAGSADD "-DINSTALLPREFIX='\"${CMAKE_INSTALL_PREFIX}\"' -DPKGDATADIR='\"${PKGDATADIR}\"' -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR} ${BOOT_LOGGER_FLAG} -DGETTEXT_PACKAGE='\"unity\"' ${MAINTAINER_CFLAGS} -I${CMAKE_SOURCE_DIR}/dash/ -I${CMAKE_SOURCE_DIR}/launcher/ -I${CMAKE_SOURCE_DIR}/hud/ -I${CMAKE_SOURCE_DIR}/panel/ -I${CMAKE_SOURCE_DIR}/shortcuts/ -I${CMAKE_SOURCE_DIR}/unity-shared/"
259 LIBDIRS "${CMAKE_BINARY_DIR}/UnityCore"
260 )
261-add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib switcher-lib hud-lib panel-lib shortcuts-lib unity-shared)
262-target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib unity-shared)
263+add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib switcher-lib hud-lib panel-lib shortcuts-lib unity-shared unity-shared-compiz)
264+target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib unity-shared unity-shared-compiz)
265
266 #
267 # Data
268
269=== modified file 'plugins/unityshell/src/unityshell.h'
270--- plugins/unityshell/src/unityshell.h 2012-04-24 21:26:55 +0000
271+++ plugins/unityshell/src/unityshell.h 2012-05-22 15:59:33 +0000
272@@ -36,7 +36,7 @@
273
274 #include "Introspectable.h"
275 #include "DashController.h"
276-#include "DashSettings.h"
277+#include "UnitySettings.h"
278 #include "DashStyle.h"
279 #include "FavoriteStoreGSettings.h"
280 #include "FontSettings.h"
281@@ -233,7 +233,7 @@
282
283 void OnPanelStyleChanged();
284
285- dash::Settings dash_settings_;
286+ Settings dash_settings_;
287 dash::Style dash_style_;
288 panel::Style panel_style_;
289 FontSettings font_settings_;
290
291=== modified file 'tests/CMakeLists.txt'
292--- tests/CMakeLists.txt 2012-05-15 18:54:33 +0000
293+++ tests/CMakeLists.txt 2012-05-22 15:59:33 +0000
294@@ -205,20 +205,18 @@
295 test_single_monitor_launcher_icon.cpp
296 test_switcher_controller.cpp
297 test_switcher_model.cpp
298- ${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp
299 ${CMAKE_SOURCE_DIR}/dash/AbstractPlacesGroup.cpp
300- ${CMAKE_SOURCE_DIR}/unity-shared/BackgroundEffectHelper.cpp
301+ ${CMAKE_SOURCE_DIR}/dash/DashViewPrivate.cpp
302+ ${CMAKE_SOURCE_DIR}/dash/LensViewPrivate.cpp
303+ ${CMAKE_SOURCE_DIR}/dash/ResultRenderer.cpp
304+ ${CMAKE_SOURCE_DIR}/dash/ResultView.cpp
305+ ${CMAKE_SOURCE_DIR}/dash/ResultViewGrid.cpp
306+ ${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp
307 ${CMAKE_SOURCE_DIR}/launcher/CairoBaseWindow.cpp
308- ${CMAKE_SOURCE_DIR}/dash/DashViewPrivate.cpp
309+ ${CMAKE_SOURCE_DIR}/launcher/DNDCollectionWindow.cpp
310 ${CMAKE_SOURCE_DIR}/launcher/Decaymulator.cpp
311- ${CMAKE_SOURCE_DIR}/launcher/DNDCollectionWindow.cpp
312 ${CMAKE_SOURCE_DIR}/launcher/DndData.cpp
313 ${CMAKE_SOURCE_DIR}/launcher/GeisAdapter.cpp
314- ${CMAKE_SOURCE_DIR}/unity-shared/IconLoader.cpp
315- ${CMAKE_SOURCE_DIR}/unity-shared/IconRenderer.cpp
316- ${CMAKE_SOURCE_DIR}/unity-shared/IconTextureSource.cpp
317- ${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp
318- ${CMAKE_SOURCE_DIR}/launcher/LayoutSystem.cpp
319 ${CMAKE_SOURCE_DIR}/launcher/Launcher.cpp
320 ${CMAKE_SOURCE_DIR}/launcher/LauncherDragWindow.cpp
321 ${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemote.cpp
322@@ -226,36 +224,39 @@
323 ${CMAKE_SOURCE_DIR}/launcher/LauncherHoverMachine.cpp
324 ${CMAKE_SOURCE_DIR}/launcher/LauncherIcon.cpp
325 ${CMAKE_SOURCE_DIR}/launcher/LauncherModel.cpp
326- ${CMAKE_SOURCE_DIR}/launcher/SimpleLauncherIcon.cpp
327- ${CMAKE_SOURCE_DIR}/launcher/SingleMonitorLauncherIcon.cpp
328- ${CMAKE_SOURCE_DIR}/dash/LensViewPrivate.cpp
329- ${CMAKE_SOURCE_DIR}/unity-shared/StaticCairoText.cpp
330- ${CMAKE_SOURCE_DIR}/launcher/SwitcherController.cpp
331- ${CMAKE_SOURCE_DIR}/launcher/SwitcherModel.cpp
332- ${CMAKE_SOURCE_DIR}/launcher/SwitcherView.cpp
333- ${CMAKE_SOURCE_DIR}/unity-shared/Timer.cpp
334- ${CMAKE_SOURCE_DIR}/launcher/Tooltip.cpp
335- ${CMAKE_SOURCE_DIR}/unity-shared/PanelStyle.cpp
336+ ${CMAKE_SOURCE_DIR}/launcher/LayoutSystem.cpp
337 ${CMAKE_SOURCE_DIR}/launcher/PointerBarrier.cpp
338- ${CMAKE_SOURCE_DIR}/launcher/QuicklistView.cpp
339 ${CMAKE_SOURCE_DIR}/launcher/QuicklistManager.cpp
340 ${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItem.cpp
341 ${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemCheckmark.cpp
342 ${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemLabel.cpp
343 ${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemRadio.cpp
344 ${CMAKE_SOURCE_DIR}/launcher/QuicklistMenuItemSeparator.cpp
345+ ${CMAKE_SOURCE_DIR}/launcher/QuicklistView.cpp
346+ ${CMAKE_SOURCE_DIR}/launcher/SimpleLauncherIcon.cpp
347+ ${CMAKE_SOURCE_DIR}/launcher/SingleMonitorLauncherIcon.cpp
348 ${CMAKE_SOURCE_DIR}/launcher/SpacerLauncherIcon.cpp
349+ ${CMAKE_SOURCE_DIR}/launcher/SwitcherController.cpp
350+ ${CMAKE_SOURCE_DIR}/launcher/SwitcherModel.cpp
351+ ${CMAKE_SOURCE_DIR}/launcher/SwitcherView.cpp
352+ ${CMAKE_SOURCE_DIR}/launcher/Tooltip.cpp
353+ ${CMAKE_SOURCE_DIR}/unity-shared/BackgroundEffectHelper.cpp
354+ ${CMAKE_SOURCE_DIR}/unity-shared/IconLoader.cpp
355+ ${CMAKE_SOURCE_DIR}/unity-shared/IconRenderer.cpp
356+ ${CMAKE_SOURCE_DIR}/unity-shared/IconTextureSource.cpp
357+ ${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp
358+ ${CMAKE_SOURCE_DIR}/unity-shared/IntrospectableWrappers.cpp
359+ ${CMAKE_SOURCE_DIR}/unity-shared/PanelStyle.cpp
360+ ${CMAKE_SOURCE_DIR}/unity-shared/StaticCairoText.cpp
361 ${CMAKE_SOURCE_DIR}/unity-shared/TextureCache.cpp
362+ ${CMAKE_SOURCE_DIR}/unity-shared/Timer.cpp
363 ${CMAKE_SOURCE_DIR}/unity-shared/UBusWrapper.cpp
364+ ${CMAKE_SOURCE_DIR}/unity-shared/UScreen.cpp
365+ ${CMAKE_SOURCE_DIR}/unity-shared/UnitySettings.cpp
366 ${CMAKE_SOURCE_DIR}/unity-shared/UnityWindowStyle.cpp
367 ${CMAKE_SOURCE_DIR}/unity-shared/UnityWindowView.cpp
368+ ${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp
369 ${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp
370- ${CMAKE_SOURCE_DIR}/unity-shared/UScreen.cpp
371- ${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp
372- ${CMAKE_SOURCE_DIR}/dash/ResultView.cpp
373- ${CMAKE_SOURCE_DIR}/dash/ResultViewGrid.cpp
374- ${CMAKE_SOURCE_DIR}/dash/ResultRenderer.cpp
375- ${CMAKE_SOURCE_DIR}/unity-shared/IntrospectableWrappers.cpp
376 )
377 target_link_libraries(test-gtest gtest gmock ${LIBS})
378 add_test(UnityGTest test-gtest)
379
380=== modified file 'unity-shared/CMakeLists.txt'
381--- unity-shared/CMakeLists.txt 2012-05-07 22:28:17 +0000
382+++ unity-shared/CMakeLists.txt 2012-05-22 15:59:33 +0000
383@@ -32,7 +32,6 @@
384 Animator.cpp
385 BGHash.cpp
386 BackgroundEffectHelper.cpp
387- DashSettings.cpp
388 DashStyle.cpp
389 FontSettings.cpp
390 IMTextEntry.cpp
391@@ -46,7 +45,6 @@
392 LineSeparator.cpp
393 OverlayRenderer.cpp
394 PanelStyle.cpp
395- PluginAdapter.cpp
396 SearchBar.cpp
397 SearchBarSpinner.cpp
398 StaticCairoText.cpp
399@@ -54,6 +52,7 @@
400 Timer.cpp
401 UBusWrapper.cpp
402 UScreen.cpp
403+ UnitySettings.cpp
404 UnityWindowStyle.cpp
405 UnityWindowView.cpp
406 WindowManager.cpp
407@@ -63,3 +62,22 @@
408 add_library (unity-shared STATIC ${UNITY_SHARED_SOURCES})
409 add_dependencies (unity-shared unity-core-${UNITY_API_VERSION})
410
411+#
412+# We also need to build compiz specific parts and standalone variants of those parts
413+#
414+
415+# compiz
416+set (UNITY_SHARED_COMPIZ_SOURCES
417+ PluginAdapterCompiz.cpp
418+ )
419+add_library (unity-shared-compiz STATIC ${UNITY_SHARED_COMPIZ_SOURCES})
420+add_dependencies (unity-shared-compiz unity-shared)
421+
422+# standalone
423+set (UNITY_SHARED_STANDALONE_SOURCES
424+ PluginAdapterStandalone.cpp
425+ )
426+add_library (unity-shared-standalone STATIC ${UNITY_SHARED_STANDALONE_SOURCES})
427+add_dependencies (unity-shared-standalone unity-shared)
428+
429+
430
431=== modified file 'unity-shared/DashStyle.cpp'
432--- unity-shared/DashStyle.cpp 2012-05-06 23:48:38 +0000
433+++ unity-shared/DashStyle.cpp 2012-05-22 15:59:33 +0000
434@@ -40,6 +40,7 @@
435
436 #include "CairoTexture.h"
437 #include "JSONParser.h"
438+#include "UnitySettings.h"
439 #include "config.h"
440
441 #define DASH_WIDGETS_FILE DATADIR"/unity/themes/dash-widgets.json"
442@@ -399,7 +400,8 @@
443
444
445 Style::Style()
446- : pimpl(new Impl(this))
447+ : always_maximised(false)
448+ , pimpl(new Impl(this))
449 {
450 if (style_instance)
451 {
452@@ -409,6 +411,15 @@
453 {
454 style_instance = this;
455 }
456+
457+ auto formfactor_lambda = [this] ()
458+ {
459+ FormFactor formfactor = Settings::Instance().GetFormFactor();
460+ always_maximised = (formfactor == FormFactor::NETBOOK || formfactor == FormFactor::TV);
461+ };
462+
463+ Settings::Instance().changed.connect(formfactor_lambda);
464+ formfactor_lambda();
465 }
466
467 Style::~Style ()
468
469=== modified file 'unity-shared/DashStyle.h'
470--- unity-shared/DashStyle.h 2012-05-06 23:48:38 +0000
471+++ unity-shared/DashStyle.h 2012-05-22 15:59:33 +0000
472@@ -238,6 +238,8 @@
473
474 sigc::signal<void> changed;
475
476+ nux::Property<bool> always_maximised;
477+
478 private:
479 class Impl;
480 Impl* pimpl;
481
482=== modified file 'unity-shared/OverlayRenderer.cpp'
483--- unity-shared/OverlayRenderer.cpp 2012-05-06 23:48:38 +0000
484+++ unity-shared/OverlayRenderer.cpp 2012-05-22 15:59:33 +0000
485@@ -26,7 +26,7 @@
486
487 #include "unity-shared/BackgroundEffectHelper.h"
488 #include "DashStyle.h"
489-#include "unity-shared/DashSettings.h"
490+#include "unity-shared/UnitySettings.h"
491
492 #include "unity-shared/UBusMessages.h"
493 #include "unity-shared/UBusWrapper.h"
494@@ -378,7 +378,7 @@
495 bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE;
496 nux::Geometry geo(content_geo);
497
498- int excess_border = (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK || force_edges) ? EXCESS_BORDER : 0;
499+ int excess_border = (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK || force_edges) ? EXCESS_BORDER : 0;
500
501 nux::Geometry larger_content_geo = content_geo;
502 larger_content_geo.OffsetSize(excess_border, excess_border);
503@@ -510,7 +510,7 @@
504 larger_content_geo.width, larger_content_geo.height,
505 bg_shine_texture_, texxform_absolute_bg, nux::color::White);
506
507- if (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK || force_edges)
508+ if (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK || force_edges)
509 {
510 // Paint the edges
511 {
512@@ -767,7 +767,7 @@
513 nux::Geometry geo = geometry;
514 bgs = 0;
515
516- int excess_border = (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK) ? EXCESS_BORDER : 0;
517+ int excess_border = (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK) ? EXCESS_BORDER : 0;
518
519 nux::Geometry larger_content_geo = content_geo;
520 larger_content_geo.OffsetSize(excess_border, excess_border);
521
522=== modified file 'unity-shared/PanelStyle.cpp'
523--- unity-shared/PanelStyle.cpp 2012-05-07 00:49:31 +0000
524+++ unity-shared/PanelStyle.cpp 2012-05-22 15:59:33 +0000
525@@ -34,6 +34,7 @@
526 #include "PanelStyle.h"
527
528 #include <UnityCore/GLibWrapper.h>
529+#include "unity-shared/UnitySettings.h"
530
531 namespace unity
532 {
533@@ -72,6 +73,15 @@
534 style_instance = this;
535 }
536
537+ if (Settings::Instance().GetFormFactor() == FormFactor::TV)
538+ panel_height = 0;
539+
540+ Settings::Instance().changed.connect([this]()
541+ {
542+ if (Settings::Instance().GetFormFactor() == FormFactor::TV)
543+ panel_height = 0;
544+ });
545+
546 GtkWidgetPath* widget_path = gtk_widget_path_new();
547 gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_WINDOW);
548 gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget");
549
550=== renamed file 'unity-shared/PluginAdapter.cpp' => 'unity-shared/PluginAdapterCompiz.cpp'
551=== added file 'unity-shared/PluginAdapterStandalone.cpp'
552--- unity-shared/PluginAdapterStandalone.cpp 1970-01-01 00:00:00 +0000
553+++ unity-shared/PluginAdapterStandalone.cpp 2012-05-22 15:59:33 +0000
554@@ -0,0 +1,453 @@
555+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
556+/*
557+ * Copyright (C) 2010 Canonical Ltd
558+ *
559+ * This program is free software: you can redistribute it and/or modify
560+ * it under the terms of the GNU General Public License version 3 as
561+ * published by the Free Software Foundation.
562+ *
563+ * This program is distributed in the hope that it will be useful,
564+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
565+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
566+ * GNU General Public License for more details.
567+ *
568+ * You should have received a copy of the GNU General Public License
569+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
570+ *
571+ * Authored by: Jason Smith <jason.smith@canonical.com>
572+ */
573+
574+#include <glib.h>
575+#include <sstream>
576+#include "PluginAdapter.h"
577+#include "UScreen.h"
578+
579+#include <NuxCore/Logger.h>
580+#include <UnityCore/Variant.h>
581+
582+//FIXME!! Entirely stubs for now, unless we need this functionality at some point
583+
584+namespace
585+{
586+nux::logging::Logger logger("unity.plugin");
587+}
588+
589+PluginAdapter* PluginAdapter::_default = 0;
590+
591+/* static */
592+PluginAdapter*
593+PluginAdapter::Default()
594+{
595+ if (!_default)
596+ return 0;
597+ return _default;
598+}
599+
600+/* static */
601+void
602+PluginAdapter::Initialize(CompScreen* screen)
603+{
604+ _default = new PluginAdapter(screen);
605+}
606+
607+PluginAdapter::PluginAdapter(CompScreen* screen) :
608+ m_Screen(screen),
609+ m_ExpoActionList(0),
610+ m_ScaleActionList(0),
611+ _in_show_desktop (false),
612+ _last_focused_window(nullptr)
613+{
614+}
615+
616+PluginAdapter::~PluginAdapter()
617+{
618+}
619+
620+/* A No-op for now, but could be useful later */
621+void
622+PluginAdapter::OnScreenGrabbed()
623+{
624+}
625+
626+void
627+PluginAdapter::OnScreenUngrabbed()
628+{
629+}
630+
631+void
632+PluginAdapter::NotifyResized(CompWindow* window, int x, int y, int w, int h)
633+{
634+}
635+
636+void
637+PluginAdapter::NotifyMoved(CompWindow* window, int x, int y)
638+{
639+}
640+
641+void
642+PluginAdapter::NotifyStateChange(CompWindow* window, unsigned int state, unsigned int last_state)
643+{
644+}
645+
646+void
647+PluginAdapter::NotifyNewDecorationState(guint32 xid)
648+{
649+}
650+
651+void
652+PluginAdapter::Notify(CompWindow* window, CompWindowNotify notify)
653+{
654+}
655+
656+void
657+PluginAdapter::NotifyCompizEvent(const char* plugin, const char* event, CompOption::Vector& option)
658+{
659+}
660+
661+void
662+MultiActionList::AddNewAction(CompAction* a, bool primary)
663+{
664+}
665+
666+void
667+MultiActionList::RemoveAction(CompAction* a)
668+{
669+}
670+
671+void
672+MultiActionList::InitiateAll(CompOption::Vector& extraArgs, int state)
673+{
674+}
675+
676+void
677+MultiActionList::TerminateAll(CompOption::Vector& extraArgs)
678+{
679+}
680+
681+unsigned long long
682+PluginAdapter::GetWindowActiveNumber (guint32 xid)
683+{
684+ return 0;
685+}
686+
687+void
688+PluginAdapter::SetExpoAction(MultiActionList& expo)
689+{
690+}
691+
692+void
693+PluginAdapter::SetScaleAction(MultiActionList& scale)
694+{
695+}
696+
697+std::string
698+PluginAdapter::MatchStringForXids(std::vector<Window> *windows)
699+{
700+ return "";
701+}
702+
703+void
704+PluginAdapter::InitiateScale(std::string const& match, int state)
705+{
706+}
707+
708+void
709+PluginAdapter::TerminateScale()
710+{
711+}
712+
713+bool
714+PluginAdapter::IsScaleActive()
715+{
716+ return false;
717+}
718+
719+bool
720+PluginAdapter::IsScaleActiveForGroup()
721+{
722+ return false;
723+}
724+
725+bool
726+PluginAdapter::IsExpoActive()
727+{
728+ return false;
729+}
730+
731+void
732+PluginAdapter::InitiateExpo()
733+{
734+}
735+
736+// WindowManager implementation
737+guint32
738+PluginAdapter::GetActiveWindow()
739+{
740+ return 0;
741+}
742+
743+bool
744+PluginAdapter::IsWindowMaximized(guint xid)
745+{
746+ return false;
747+}
748+
749+bool
750+PluginAdapter::IsWindowDecorated(guint32 xid)
751+{
752+ return false;
753+}
754+
755+bool
756+PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid)
757+{
758+ return false;
759+}
760+
761+bool
762+PluginAdapter::IsWindowObscured(guint32 xid)
763+{
764+ return false;
765+}
766+
767+bool
768+PluginAdapter::IsWindowMapped(guint32 xid)
769+{
770+ return false;
771+}
772+
773+bool
774+PluginAdapter::IsWindowVisible(guint32 xid)
775+{
776+ return false;
777+}
778+
779+bool
780+PluginAdapter::IsWindowOnTop(guint32 xid)
781+{
782+ return false;
783+}
784+
785+bool
786+PluginAdapter::IsWindowClosable(guint32 xid)
787+{
788+ return false;
789+}
790+
791+bool
792+PluginAdapter::IsWindowMinimizable(guint32 xid)
793+{
794+ return false;
795+}
796+
797+bool
798+PluginAdapter::IsWindowMaximizable(guint32 xid)
799+{
800+ return false;
801+}
802+
803+void
804+PluginAdapter::Restore(guint32 xid)
805+{
806+}
807+
808+void
809+PluginAdapter::RestoreAt(guint32 xid, int x, int y)
810+{
811+}
812+
813+void
814+PluginAdapter::Minimize(guint32 xid)
815+{
816+}
817+
818+void
819+PluginAdapter::Close(guint32 xid)
820+{
821+}
822+
823+void
824+PluginAdapter::Activate(guint32 xid)
825+{
826+}
827+
828+void
829+PluginAdapter::Raise(guint32 xid)
830+{
831+}
832+
833+void
834+PluginAdapter::Lower(guint32 xid)
835+{
836+}
837+
838+void
839+PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility, int monitor, bool only_top_win)
840+{
841+}
842+
843+bool
844+PluginAdapter::ScaleWindowGroup(std::vector<Window> windows, int state, bool force)
845+{
846+ return false;
847+}
848+
849+void
850+PluginAdapter::SetWindowIconGeometry(Window window, nux::Geometry const& geo)
851+{
852+}
853+
854+void
855+PluginAdapter::ShowDesktop()
856+{
857+}
858+
859+void
860+PluginAdapter::OnShowDesktop()
861+{
862+}
863+
864+void
865+PluginAdapter::OnLeaveDesktop()
866+{
867+}
868+
869+int
870+PluginAdapter::GetWindowMonitor(guint32 xid) const
871+{
872+ return -1;
873+}
874+
875+nux::Geometry
876+PluginAdapter::GetWindowGeometry(guint32 xid) const
877+{
878+ nux::Geometry geo(0, 0, 1, 1);
879+ return geo;
880+}
881+
882+nux::Geometry
883+PluginAdapter::GetWindowSavedGeometry(guint32 xid) const
884+{
885+ nux::Geometry geo(0, 0, 1, 1);
886+ return geo;
887+}
888+
889+nux::Geometry
890+PluginAdapter::GetScreenGeometry() const
891+{
892+ nux::Geometry geo(0, 0, 1, 1);
893+ return geo;
894+}
895+
896+nux::Geometry
897+PluginAdapter::GetWorkAreaGeometry(guint32 xid) const
898+{
899+ nux::Geometry geo(0, 0, 1, 1);
900+ return geo;
901+}
902+
903+bool
904+PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow* window)
905+{
906+ return false;
907+}
908+
909+void
910+PluginAdapter::CheckWindowIntersections (nux::Geometry const& region, bool &active, bool &any)
911+{
912+}
913+
914+int
915+PluginAdapter::WorkspaceCount()
916+{
917+ return 4;
918+}
919+
920+void
921+PluginAdapter::SetMwmWindowHints(Window xid, MotifWmHints* new_hints)
922+{
923+}
924+
925+void
926+PluginAdapter::Decorate(guint32 xid)
927+{
928+}
929+
930+void
931+PluginAdapter::Undecorate(guint32 xid)
932+{
933+}
934+
935+bool
936+PluginAdapter::IsScreenGrabbed()
937+{
938+ return false;
939+}
940+
941+bool
942+PluginAdapter::IsViewPortSwitchStarted()
943+{
944+ return false;
945+}
946+
947+/* Returns true if the window was maximized */
948+bool PluginAdapter::MaximizeIfBigEnough(CompWindow* window)
949+{
950+ return true;
951+}
952+
953+void
954+PluginAdapter::ShowGrabHandles(CompWindow* window, bool use_timer)
955+{
956+}
957+
958+void
959+PluginAdapter::HideGrabHandles(CompWindow* window)
960+{
961+}
962+
963+void
964+PluginAdapter::ToggleGrabHandles(CompWindow* window)
965+{
966+}
967+
968+void
969+PluginAdapter::SetCoverageAreaBeforeAutomaximize(float area)
970+{
971+}
972+
973+bool
974+PluginAdapter::saveInputFocus()
975+{
976+ return false;
977+}
978+
979+bool
980+PluginAdapter::restoreInputFocus()
981+{
982+ return false;
983+}
984+
985+void
986+PluginAdapter::MoveResizeWindow(guint32 xid, nux::Geometry geometry)
987+{
988+}
989+
990+void
991+PluginAdapter::OnWindowClosed(CompWindow *w)
992+{
993+}
994+
995+void
996+PluginAdapter::AddProperties(GVariantBuilder* builder)
997+{
998+ unity::variant::BuilderWrapper wrapper(builder);
999+ wrapper.add(GetScreenGeometry())
1000+ .add("workspace_count", WorkspaceCount())
1001+ .add("active_window", GetActiveWindow())
1002+ .add("screen_grabbed", IsScreenGrabbed())
1003+ .add("scale_active", IsScaleActive())
1004+ .add("scale_active_for_group", IsScaleActiveForGroup())
1005+ .add("expo_active", IsExpoActive())
1006+ .add("viewport_switch_running", IsViewPortSwitchStarted());
1007+}
1008
1009=== renamed file 'unity-shared/DashSettings.cpp' => 'unity-shared/UnitySettings.cpp'
1010--- unity-shared/DashSettings.cpp 2012-05-06 23:48:38 +0000
1011+++ unity-shared/UnitySettings.cpp 2012-05-22 15:59:33 +0000
1012@@ -22,16 +22,14 @@
1013
1014 #include <NuxCore/Logger.h>
1015
1016-#include "DashSettings.h"
1017+#include "UnitySettings.h"
1018 #include "UScreen.h"
1019
1020 namespace unity
1021 {
1022-namespace dash
1023-{
1024 namespace
1025 {
1026-nux::logging::Logger logger("unity.dash");
1027+nux::logging::Logger logger("unity");
1028
1029 Settings* settings_instance = nullptr;
1030 const char* const FORM_FACTOR = "form-factor";
1031@@ -107,14 +105,16 @@
1032 {
1033 form_factor_ = factor;
1034 g_settings_set_enum(settings_, FORM_FACTOR, static_cast<int>(factor));
1035+ owner_->changed.emit();
1036 }
1037
1038 Settings::Settings()
1039- : pimpl(new Impl(this))
1040+ : is_standalone(false)
1041+ , pimpl(new Impl(this))
1042 {
1043 if (settings_instance)
1044 {
1045- LOG_ERROR(logger) << "More than one dash::Settings created.";
1046+ LOG_ERROR(logger) << "More than one unity::Settings created.";
1047 }
1048 else
1049 {
1050@@ -133,7 +133,7 @@
1051 {
1052 if (!settings_instance)
1053 {
1054- LOG_ERROR(logger) << "No dash::Settings created yet.";
1055+ LOG_ERROR(logger) << "No unity::Settings created yet.";
1056 }
1057
1058 return *settings_instance;
1059@@ -150,5 +150,4 @@
1060 }
1061
1062
1063-} // namespace dash
1064 } // namespace unity
1065
1066=== renamed file 'unity-shared/DashSettings.h' => 'unity-shared/UnitySettings.h'
1067--- unity-shared/DashSettings.h 2012-05-06 23:48:38 +0000
1068+++ unity-shared/UnitySettings.h 2012-05-22 15:59:33 +0000
1069@@ -17,20 +17,20 @@
1070 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
1071 */
1072
1073-#ifndef DASH_SETTINGS_H
1074-#define DASH_SETTINGS_H
1075+#ifndef UNITY_SETTINGS_H
1076+#define UNITY_SETTINGS_H
1077
1078 #include <sigc++/signal.h>
1079+#include <Nux/Nux.h>
1080
1081 namespace unity
1082 {
1083-namespace dash
1084-{
1085
1086 enum class FormFactor
1087 {
1088 DESKTOP = 1,
1089- NETBOOK
1090+ NETBOOK = 2,
1091+ TV
1092 };
1093
1094 class Settings
1095@@ -45,6 +45,7 @@
1096 FormFactor GetFormFactor() const;
1097 void SetFormFactor(FormFactor factor);
1098
1099+ nux::Property<bool> is_standalone;
1100 sigc::signal<void> changed;
1101
1102 private:
1103@@ -53,6 +54,5 @@
1104 };
1105
1106 }
1107-}
1108
1109-#endif // DASH_SETTINGS_H
1110+#endif // UNITY_SETTINGS_H
1111
1112=== added directory 'unity-standalone'
1113=== added file 'unity-standalone/CMakeLists.txt'
1114--- unity-standalone/CMakeLists.txt 1970-01-01 00:00:00 +0000
1115+++ unity-standalone/CMakeLists.txt 2012-05-22 15:59:33 +0000
1116@@ -0,0 +1,46 @@
1117+set(UNITY_SRC ../plugins/unityshell/src)
1118+
1119+find_package (PkgConfig)
1120+
1121+set (CFLAGS
1122+ ${CACHED_UNITY_DEPS_CFLAGS}
1123+ ${CACHED_UNITY_DEPS_CFLAGS_OTHER}
1124+ ${MAINTAINER_CFLAGS}
1125+ "-DGETTEXT_PACKAGE=\"unity\""
1126+ "-I${CMAKE_CURRENT_BINARY_DIR}"
1127+ )
1128+
1129+if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
1130+ set (CFLAGS ${CFLAGS} "-fPIC")
1131+endif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
1132+
1133+add_definitions (${CFLAGS})
1134+
1135+set (LIBS ${CACHED_UNITY_DEPS_LIBRARIES} "-lunity-core-${UNITY_API_VERSION} -lm -lGL -lGLU")
1136+link_libraries (${LIBS})
1137+
1138+set (LIB_PATHS ${CACHED_UNITY_DEPS_LIBRARY_DIRS})
1139+link_directories (${CMAKE_BINARY_DIR}/UnityCore ${LIB_PATHS})
1140+
1141+include_directories (. .. ../services ../UnityCore ${UNITY_SRC} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
1142+
1143+#
1144+# Headers & Sources
1145+#
1146+set (STANDALONE_SOURCES
1147+ StandaloneUnity.cpp
1148+ )
1149+
1150+add_executable (unity-standalone StandaloneUnity.cpp)
1151+add_dependencies (unity-standalone
1152+ dash-lib
1153+ launcher-lib
1154+ panel-lib
1155+ unity-shared
1156+ unity-shared-standalone)
1157+target_link_libraries (unity-standalone
1158+ dash-lib
1159+ launcher-lib
1160+ panel-lib
1161+ unity-shared
1162+ unity-shared-standalone)
1163
1164=== added file 'unity-standalone/StandaloneUnity.cpp'
1165--- unity-standalone/StandaloneUnity.cpp 1970-01-01 00:00:00 +0000
1166+++ unity-standalone/StandaloneUnity.cpp 2012-05-22 15:59:33 +0000
1167@@ -0,0 +1,198 @@
1168+/*
1169+ * Copyright 2010 Canonical Ltd.
1170+ *
1171+ * This program is free software: you can redistribute it and/or modify it
1172+ * under the terms of the GNU General Public License version 3, as published
1173+ * by the Free Software Foundation.
1174+ *
1175+ * This program is distributed in the hope that it will be useful, but
1176+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1177+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
1178+ * PURPOSE. See the GNU General Public License for more details.
1179+ *
1180+ * You should have received a copy of the GNU General Public License
1181+ * version 3 along with this program. If not, see
1182+ * <http://www.gnu.org/licenses/>
1183+ *
1184+ * Authored by: Gordon Allott <gord.allott@canonical.com>
1185+ * Neil Jagdish Patel <neil.patel@canonical.com>
1186+ *
1187+ */
1188+#include <gtk/gtk.h>
1189+
1190+#include "Nux/Nux.h"
1191+#include "Nux/VLayout.h"
1192+#include "Nux/WindowThread.h"
1193+#include "NuxGraphics/GraphicsEngine.h"
1194+#include <NuxCore/Logger.h>
1195+
1196+#include "dash/DashController.h"
1197+#include "dash/DashView.h"
1198+#include "launcher/FavoriteStoreGSettings.h"
1199+#include "launcher/Launcher.h"
1200+#include "launcher/LauncherController.h"
1201+#include "panel/PanelController.h"
1202+#include "panel/PanelView.h"
1203+#include "unity-shared/BGHash.h"
1204+#include "unity-shared/BackgroundEffectHelper.h"
1205+#include "unity-shared/DashStyle.h"
1206+#include "unity-shared/FontSettings.h"
1207+#include "unity-shared/PanelStyle.h"
1208+#include "unity-shared/PluginAdapter.h"
1209+#include "unity-shared/UBusMessages.h"
1210+#include "unity-shared/UBusWrapper.h"
1211+#include "unity-shared/UnitySettings.h"
1212+
1213+namespace
1214+{
1215+ static int display_width = 1280;
1216+ static int display_height = 720;
1217+ static gboolean no_window_decorations = FALSE;
1218+ static gboolean force_tv = FALSE;
1219+
1220+ static GOptionEntry entries[] =
1221+ {
1222+ {"width", 'w', 0, G_OPTION_ARG_INT, &display_width, "Display width", NULL},
1223+ {"height", 'h', 0, G_OPTION_ARG_INT, &display_height, "Display height", NULL},
1224+ {"no-window-decorations", 'd', 0, G_OPTION_ARG_NONE, &no_window_decorations, "Disables the window decorations", NULL},
1225+ {"force-tv", 't', 0, G_OPTION_ARG_NONE, &force_tv, "Forces the TV interface", NULL},
1226+ {NULL}
1227+ };
1228+}
1229+
1230+using namespace unity;
1231+
1232+class UnityStandalone
1233+{
1234+public:
1235+ UnityStandalone ();
1236+ ~UnityStandalone ();
1237+
1238+ static void InitWindowThread (nux::NThread* thread, void* InitData);
1239+ void Init ();
1240+
1241+ launcher::Controller::Ptr launcher_controller;
1242+ dash::Controller::Ptr dash_controller;
1243+ panel::Controller::Ptr panel_controller;
1244+};
1245+
1246+UnityStandalone::UnityStandalone ()
1247+{
1248+}
1249+
1250+UnityStandalone::~UnityStandalone ()
1251+{
1252+}
1253+
1254+void UnityStandalone::Init ()
1255+{
1256+ launcher_controller.reset(new launcher::Controller(0));
1257+ panel_controller.reset(new panel::Controller());
1258+ dash_controller.reset(new dash::Controller());
1259+ dash_controller->launcher_width = launcher_controller->launcher().GetAbsoluteWidth() - 1;
1260+}
1261+
1262+void UnityStandalone::InitWindowThread(nux::NThread* thread, void* InitData)
1263+{
1264+ UnityStandalone *self = static_cast<UnityStandalone*>(InitData);
1265+ self->Init();
1266+}
1267+
1268+
1269+class UnityStandaloneTV
1270+{
1271+public:
1272+ UnityStandaloneTV();
1273+ ~UnityStandaloneTV();
1274+
1275+ static void InitWindowThread (nux::NThread* thread, void* InitData);
1276+ void Init();
1277+
1278+ launcher::Controller::Ptr launcher_controller;
1279+ dash::Controller::Ptr dash_controller;
1280+};
1281+
1282+UnityStandaloneTV::UnityStandaloneTV() {};
1283+UnityStandaloneTV::~UnityStandaloneTV() {};
1284+
1285+void UnityStandaloneTV::Init()
1286+{
1287+ launcher_controller.reset(new launcher::Controller(0));
1288+ dash_controller.reset(new dash::Controller());
1289+ dash_controller->launcher_width = launcher_controller->launcher().GetAbsoluteWidth() - 1;
1290+
1291+ UBusManager().SendMessage(UBUS_DASH_EXTERNAL_ACTIVATION, nullptr);
1292+}
1293+
1294+void UnityStandaloneTV::InitWindowThread(nux::NThread* thread, void* InitData)
1295+{
1296+ UnityStandaloneTV *self = static_cast<UnityStandaloneTV*>(InitData);
1297+ self->Init();
1298+}
1299+
1300+int main(int argc, char **argv)
1301+{
1302+ nux::WindowThread* wt = NULL;
1303+ GError *error = NULL;
1304+ GOptionContext *context;
1305+
1306+ nux::NuxInitialize(0);
1307+ nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY"));
1308+
1309+ context = g_option_context_new("- Unity standalone");
1310+ g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
1311+ g_option_context_add_group(context, gtk_get_option_group(TRUE));
1312+ g_option_context_parse(context, &argc, &argv, &error);
1313+ if (error != NULL)
1314+ {
1315+ g_print("Option parsiong failed: %s\n", error->message);
1316+ g_error_free(error);
1317+ exit(1);
1318+ }
1319+
1320+ gtk_init(&argc, &argv);
1321+
1322+ BGHash bghash;
1323+ FontSettings font_settings;
1324+
1325+ // The instances for the pseudo-singletons.
1326+ Settings settings;
1327+ settings.is_standalone = true;
1328+ if (force_tv) Settings::Instance().SetFormFactor(FormFactor::TV);
1329+
1330+ PluginAdapter::Initialize(NULL);
1331+ dash::Style dash_style;
1332+ panel::Style panel_style;
1333+
1334+ GeisAdapter geis_adapter;
1335+ internal::FavoriteStoreGSettings favorite_store;
1336+ BackgroundEffectHelper::blur_type = BLUR_NONE;
1337+
1338+ if (!force_tv)
1339+ {
1340+ UnityStandalone *standalone_runner = new UnityStandalone();
1341+ wt = nux::CreateNuxWindow("standalone-unity",
1342+ display_width, display_height,
1343+ (no_window_decorations) ? nux::WINDOWSTYLE_NOBORDER : nux::WINDOWSTYLE_NORMAL,
1344+ 0, /* no parent */
1345+ false,
1346+ &UnityStandalone::InitWindowThread,
1347+ standalone_runner);
1348+ }
1349+ else
1350+ {
1351+ //TODO - we should be able to pass in a monitor so that we can make the window
1352+ //the size of the monitor and position the window on the monitor correctly.
1353+ UnityStandaloneTV *standalone_runner = new UnityStandaloneTV();
1354+ wt = nux::CreateNuxWindow("standalone-unity-tv",
1355+ display_width, display_height,
1356+ (no_window_decorations) ? nux::WINDOWSTYLE_NOBORDER : nux::WINDOWSTYLE_NORMAL,
1357+ 0, /* no parent */
1358+ false,
1359+ &UnityStandaloneTV::InitWindowThread,
1360+ standalone_runner);
1361+ }
1362+ wt->Run(NULL);
1363+ delete wt;
1364+ return 0;
1365+}