Merge lp:~3v1n0/unity/launcher-controller-ensure-new into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2521
Proposed branch: lp:~3v1n0/unity/launcher-controller-ensure-new
Merge into: lp:unity
Diff against target: 985 lines (+566/-172)
11 files modified
launcher/EdgeBarrierController.cpp (+18/-5)
launcher/EdgeBarrierController.h (+1/-0)
launcher/LauncherController.cpp (+29/-161)
launcher/LauncherController.h (+2/-0)
launcher/LauncherControllerPrivate.h (+163/-0)
tests/CMakeLists.txt (+9/-0)
tests/test_edge_barrier_controller.cpp (+48/-1)
tests/test_launcher_controller.cpp (+202/-0)
tests/test_uscreen_mock.h (+85/-0)
unity-shared/UScreen.cpp (+4/-3)
unity-shared/UScreen.h (+5/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/launcher-controller-ensure-new
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
jenkins (community) continuous-integration Needs Fixing
Review via email: mp+116775@code.launchpad.net

Commit message

LauncherController: Rewritten EnsureLaunchers() added tests, fix a crash caused by invalid barrier subscriptions.

Description of the change

Rewritten the EnsureLaunchers() method LauncherController and added unit tests for it.

As discussed with Tim LauncherControllerTest is now friend of LauncherController to access to the pimpl data, even if I've changed this on my next branch.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Looks good.

There are some merge markers in added file 'tests/test_launcher_controller.cpp'.

General comments:

 * If you want to avoid the friend declaration, you can do something like this:
   class TestLauncherExpectationsInterface
   {
       public:
           virtual void ExpectNumControllers (int num) = 0;
           ...
   }

   LauncherControllerPrivate::SetExpectations (TestLauncherExpectationsInterface *expect)
   {
       ...
       expect->ExpectNumControllers (whatever);
   }

   ::testing::NiceMock <MockLauncherExpectations> mock_launcher_expectations;

   EXPECT_CALL (mock_launcher_expectations, ExpectNumControllers (value));

   This method is pretty ugly though, and the friend might be better. Generally speaking, testing implementation details isn't really recommended, but in this case we want to do that.

 * Its a bit unclear as to how UScreen.SetupFakeMultimonitor () causes more launchers to be added to an lc it doesn't know about, unless some singleton knows about lc, and that's pretty confusing.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> Looks good.
>
> There are some merge markers in added file
> 'tests/test_launcher_controller.cpp'.

Yeah, fixed...

> General comments:
>
> * If you want to avoid the friend declaration, you can do something like
> [...]
> This method is pretty ugly though, and the friend might be better.

Yes, that's what I generally do, but I didn't want all this even for future testing...

> Generally speaking, testing implementation details isn't really recommended,
> but in this case we want to do that.

Yep, that's the fact.

> * Its a bit unclear as to how UScreen.SetupFakeMultimonitor () causes more
> launchers to be added to an lc it doesn't know about, unless some singleton
> knows about lc, and that's pretty confusing.

As you can see, int SetupFakeMultimonitor implementation, basically I'm adding to it some fake monitors, and then emitting that UScreen has changed, exactly like if I'd have plugged some monitors.

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Martin Mrazik (mrazik) wrote :

Sorry for the jenkins failure. I'm looking into this.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/967/console reported an error when processing this lp:~3v1n0/unity/launcher-controller-ensure-new branch.
Not merging it.

Revision history for this message
Martin Mrazik (mrazik) wrote :

Now I'm a bit confused. I thought the CI failure is because our jenkins quantal slaves were not 100% up-to-date as I was able to compile the latest trunk on my quantal laptop with staging PPA.
Now it looks like the unity-merger has a similar problem so let me look close into this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/EdgeBarrierController.cpp'
--- launcher/EdgeBarrierController.cpp 2012-07-20 19:26:15 +0000
+++ launcher/EdgeBarrierController.cpp 2012-07-26 13:13:33 +0000
@@ -15,6 +15,7 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *16 *
17 * Authored by: Jason Smith <jason.smith@canonical.com>17 * Authored by: Jason Smith <jason.smith@canonical.com>
18 * Marco Trevisan <marco.trevisan@canonical.com>
18 */19 */
1920
20#include "EdgeBarrierController.h"21#include "EdgeBarrierController.h"
@@ -157,7 +158,7 @@
157 unsigned int monitor = owner->index;158 unsigned int monitor = owner->index;
158 bool process = true;159 bool process = true;
159160
160 if (monitor <= subscribers_.size())161 if (monitor < subscribers_.size())
161 {162 {
162 auto subscriber = subscribers_[monitor];163 auto subscriber = subscribers_[monitor];
163164
@@ -206,20 +207,32 @@
206207
207void EdgeBarrierController::Subscribe(EdgeBarrierSubscriber* subscriber, unsigned int monitor)208void EdgeBarrierController::Subscribe(EdgeBarrierSubscriber* subscriber, unsigned int monitor)
208{209{
209 if (pimpl->subscribers_.size() <= monitor)210 if (monitor >= pimpl->subscribers_.size())
210 pimpl->subscribers_.resize(monitor + 1);211 pimpl->subscribers_.resize(monitor + 1);
211212
213 auto const& monitors = UScreen::GetDefault()->GetMonitors();
212 pimpl->subscribers_[monitor] = subscriber;214 pimpl->subscribers_[monitor] = subscriber;
213 pimpl->SetupBarriers(UScreen::GetDefault()->GetMonitors());215 pimpl->ResizeBarrierList(monitors);
216 pimpl->SetupBarriers(monitors);
214}217}
215218
216void EdgeBarrierController::Unsubscribe(EdgeBarrierSubscriber* subscriber, unsigned int monitor)219void EdgeBarrierController::Unsubscribe(EdgeBarrierSubscriber* subscriber, unsigned int monitor)
217{220{
218 if (pimpl->subscribers_.size() < monitor || pimpl->subscribers_[monitor] != subscriber)221 if (monitor >= pimpl->subscribers_.size() || pimpl->subscribers_[monitor] != subscriber)
219 return;222 return;
220223
224 auto const& monitors = UScreen::GetDefault()->GetMonitors();
221 pimpl->subscribers_[monitor] = nullptr;225 pimpl->subscribers_[monitor] = nullptr;
222 pimpl->SetupBarriers(UScreen::GetDefault()->GetMonitors());226 pimpl->ResizeBarrierList(monitors);
227 pimpl->SetupBarriers(monitors);
228}
229
230EdgeBarrierSubscriber* EdgeBarrierController::GetSubscriber(unsigned int monitor)
231{
232 if (monitor >= pimpl->subscribers_.size())
233 return nullptr;
234
235 return pimpl->subscribers_[monitor];
223}236}
224237
225void EdgeBarrierController::ProcessBarrierEvent(PointerBarrierWrapper* owner, BarrierEvent::Ptr event)238void EdgeBarrierController::ProcessBarrierEvent(PointerBarrierWrapper* owner, BarrierEvent::Ptr event)
226239
=== modified file 'launcher/EdgeBarrierController.h'
--- launcher/EdgeBarrierController.h 2012-07-20 18:33:58 +0000
+++ launcher/EdgeBarrierController.h 2012-07-26 13:13:33 +0000
@@ -43,6 +43,7 @@
4343
44 void Subscribe(EdgeBarrierSubscriber* subscriber, unsigned int monitor);44 void Subscribe(EdgeBarrierSubscriber* subscriber, unsigned int monitor);
45 void Unsubscribe(EdgeBarrierSubscriber* subscriber, unsigned int monitor);45 void Unsubscribe(EdgeBarrierSubscriber* subscriber, unsigned int monitor);
46 EdgeBarrierSubscriber* GetSubscriber(unsigned int monitor);
4647
47protected:48protected:
48 void ProcessBarrierEvent(PointerBarrierWrapper* owner, BarrierEvent::Ptr event);49 void ProcessBarrierEvent(PointerBarrierWrapper* owner, BarrierEvent::Ptr event);
4950
=== modified file 'launcher/LauncherController.cpp'
--- launcher/LauncherController.cpp 2012-07-25 02:39:32 +0000
+++ launcher/LauncherController.cpp 2012-07-26 13:13:33 +0000
@@ -30,23 +30,15 @@
30#include "BamfLauncherIcon.h"30#include "BamfLauncherIcon.h"
31#include "DesktopLauncherIcon.h"31#include "DesktopLauncherIcon.h"
32#include "DeviceLauncherIcon.h"32#include "DeviceLauncherIcon.h"
33#include "DeviceLauncherSection.h"
34#include "EdgeBarrierController.h"
35#include "FavoriteStore.h"33#include "FavoriteStore.h"
36#include "HudLauncherIcon.h"34#include "HudLauncherIcon.h"
37#include "Launcher.h"
38#include "LauncherController.h"35#include "LauncherController.h"
39#include "LauncherEntryRemote.h"36#include "LauncherControllerPrivate.h"
40#include "LauncherEntryRemoteModel.h"
41#include "AbstractLauncherIcon.h"
42#include "SoftwareCenterLauncherIcon.h"37#include "SoftwareCenterLauncherIcon.h"
43#include "LauncherModel.h"
44#include "VolumeMonitorWrapper.h"
45#include "unity-shared/WindowManager.h"38#include "unity-shared/WindowManager.h"
46#include "TrashLauncherIcon.h"39#include "TrashLauncherIcon.h"
47#include "BFBLauncherIcon.h"40#include "BFBLauncherIcon.h"
48#include "unity-shared/UScreen.h"41#include "unity-shared/UScreen.h"
49#include "unity-shared/UBusWrapper.h"
50#include "unity-shared/UBusMessages.h"42#include "unity-shared/UBusMessages.h"
51#include "unity-shared/TimeUtil.h"43#include "unity-shared/TimeUtil.h"
5244
@@ -93,120 +85,7 @@
93}85}
94}86}
9587
96class Controller::Impl88
97{
98public:
99 Impl(Display* display, Controller* parent);
100 ~Impl();
101
102 void UpdateNumWorkspaces(int workspaces);
103
104 Launcher* CreateLauncher(int monitor);
105
106 void Save();
107 void SortAndUpdate();
108
109 nux::ObjectPtr<Launcher> CurrentLauncher();
110
111 void OnIconAdded(AbstractLauncherIcon::Ptr icon);
112 void OnIconRemoved(AbstractLauncherIcon::Ptr icon);
113
114 void OnLauncherAddRequest(char* path, AbstractLauncherIcon::Ptr before);
115 void OnLauncherAddRequestSpecial(std::string const& path, std::string const& aptdaemon_trans_id,
116 std::string const& icon_path, int icon_x, int icon_y, int icon_size);
117 void OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr icon);
118 void OnSCIconAnimationComplete(AbstractLauncherIcon::Ptr icon);
119
120 void OnLauncherEntryRemoteAdded(LauncherEntryRemote::Ptr const& entry);
121 void OnLauncherEntryRemoteRemoved(LauncherEntryRemote::Ptr const& entry);
122
123 void OnFavoriteStoreFavoriteAdded(std::string const& entry, std::string const& pos, bool before);
124 void OnFavoriteStoreFavoriteRemoved(std::string const& entry);
125 void OnFavoriteStoreReordered();
126
127
128 void InsertExpoAction();
129 void RemoveExpoAction();
130
131 void InsertDesktopIcon();
132 void RemoveDesktopIcon();
133
134 void SendHomeActivationRequest();
135
136 int MonitorWithMouse();
137
138 void InsertTrash();
139
140 void RegisterIcon(AbstractLauncherIcon::Ptr icon);
141
142 AbstractLauncherIcon::Ptr CreateFavorite(const char* file_path);
143
144 SoftwareCenterLauncherIcon::Ptr CreateSCLauncherIcon(std::string const& file_path, std::string const& aptdaemon_trans_id, std::string const& icon_path);
145
146 void SetupBamf();
147
148 void EnsureLaunchers(int primary, std::vector<nux::Geometry> const& monitors);
149
150 void OnExpoActivated();
151
152 void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors);
153
154 void OnWindowFocusChanged (guint32 xid);
155
156 void OnViewOpened(BamfMatcher* matcher, BamfView* view);
157
158 void ReceiveMouseDownOutsideArea(int x, int y, unsigned long button_flags, unsigned long key_flags);
159
160 void ReceiveLauncherKeyPress(unsigned long eventType,
161 unsigned long keysym,
162 unsigned long state,
163 const char* character,
164 unsigned short keyCount);
165
166 static void OnBusAcquired(GDBusConnection* connection, const gchar* name, gpointer user_data);
167 static void OnDBusMethodCall(GDBusConnection* connection, const gchar* sender, const gchar* object_path,
168 const gchar* interface_name, const gchar* method_name,
169 GVariant* parameters, GDBusMethodInvocation* invocation,
170 gpointer user_data);
171
172 static GDBusInterfaceVTable interface_vtable;
173
174 Controller* parent_;
175 LauncherModel::Ptr model_;
176 nux::ObjectPtr<Launcher> launcher_;
177 nux::ObjectPtr<Launcher> keyboard_launcher_;
178 int sort_priority_;
179 AbstractVolumeMonitorWrapper::Ptr volume_monitor_;
180 DeviceLauncherSection device_section_;
181 LauncherEntryRemoteModel remote_model_;
182 AbstractLauncherIcon::Ptr expo_icon_;
183 AbstractLauncherIcon::Ptr desktop_icon_;
184 int num_workspaces_;
185 bool show_desktop_icon_;
186 Display* display_;
187
188 bool launcher_open;
189 bool launcher_keynav;
190 bool launcher_grabbed;
191 bool reactivate_keynav;
192 int reactivate_index;
193 bool keynav_restore_window_;
194 int launcher_key_press_time_;
195 unsigned int dbus_owner_;
196
197 ui::EdgeBarrierController edge_barriers_;
198
199 LauncherList launchers;
200
201 glib::Object<BamfMatcher> matcher_;
202 glib::Signal<void, BamfMatcher*, BamfView*> view_opened_signal_;
203 glib::SourceManager sources_;
204 UBusManager ubus;
205
206 sigc::connection on_expoicon_activate_connection_;
207 sigc::connection launcher_key_press_connection_;
208 sigc::connection launcher_event_outside_connection_;
209};
21089
211GDBusInterfaceVTable Controller::Impl::interface_vtable =90GDBusInterfaceVTable Controller::Impl::interface_vtable =
212 { Controller::Impl::OnDBusMethodCall, NULL, NULL};91 { Controller::Impl::OnDBusMethodCall, NULL, NULL};
@@ -316,41 +195,35 @@
316 unsigned int num_monitors = monitors.size();195 unsigned int num_monitors = monitors.size();
317 unsigned int num_launchers = parent_->multiple_launchers ? num_monitors : 1;196 unsigned int num_launchers = parent_->multiple_launchers ? num_monitors : 1;
318 unsigned int launchers_size = launchers.size();197 unsigned int launchers_size = launchers.size();
319 unsigned int last_monitor = 0;198 unsigned int last_launcher = 0;
320199
321 if (num_launchers == 1)200 for (unsigned int i = 0; i < num_launchers; i++, last_launcher++)
322 {201 {
323 if (launchers_size == 0)202 if (i >= launchers_size)
324 {203 {
325 launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher(primary)));204 launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher(i)));
326 }205 }
327 else if (!launchers[0].IsValid())206 else if (!launchers[i])
328 {207 {
329 launchers[0] = nux::ObjectPtr<Launcher>(CreateLauncher(primary));208 launchers[i] = nux::ObjectPtr<Launcher>(CreateLauncher(i));
330 }209 }
331210
332 launchers[0]->monitor(primary);211 int monitor = (num_launchers == 1) ? primary : i;
333 launchers[0]->Resize();212
334 last_monitor = 1;213 if (launchers[i]->monitor() != monitor)
335 }214 {
336 else215 edge_barriers_.Unsubscribe(launchers[i].GetPointer(), launchers[i]->monitor);
337 {216 }
338 for (unsigned int i = 0; i < num_monitors; i++, last_monitor++)217
339 {218 launchers[i]->monitor(monitor);
340 if (i >= launchers_size)219 launchers[i]->Resize();
341 {220 edge_barriers_.Subscribe(launchers[i].GetPointer(), launchers[i]->monitor);
342 launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher(i)));221 }
343 }222
344223 for (unsigned int i = last_launcher; i < launchers_size; ++i)
345 launchers[i]->monitor(i);
346 launchers[i]->Resize();
347 }
348 }
349
350 for (unsigned int i = last_monitor; i < launchers_size; ++i)
351 {224 {
352 auto launcher = launchers[i];225 auto launcher = launchers[i];
353 if (launcher.IsValid())226 if (launcher)
354 {227 {
355 parent_->RemoveChild(launcher.GetPointer());228 parent_->RemoveChild(launcher.GetPointer());
356 launcher->GetParent()->UnReference();229 launcher->GetParent()->UnReference();
@@ -359,11 +232,6 @@
359 }232 }
360233
361 launchers.resize(num_launchers);234 launchers.resize(num_launchers);
362
363 for (size_t i = 0; i < launchers.size(); ++i)
364 {
365 edge_barriers_.Subscribe(launchers[i].GetPointer(), launchers[i]->monitor);
366 }
367}235}
368236
369void Controller::Impl::OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors)237void Controller::Impl::OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors)
370238
=== modified file 'launcher/LauncherController.h'
--- launcher/LauncherController.h 2012-06-18 02:57:23 +0000
+++ launcher/LauncherController.h 2012-07-26 13:13:33 +0000
@@ -35,6 +35,7 @@
35class AbstractLauncherIcon;35class AbstractLauncherIcon;
36class Launcher;36class Launcher;
37class LauncherModel;37class LauncherModel;
38class TestLauncherController;
3839
39class Controller : public unity::debug::Introspectable, public sigc::trackable40class Controller : public unity::debug::Introspectable, public sigc::trackable
40{41{
@@ -86,6 +87,7 @@
86 void AddProperties(GVariantBuilder* builder);87 void AddProperties(GVariantBuilder* builder);
8788
88private:89private:
90 friend class TestLauncherController;
89 class Impl;91 class Impl;
90 std::unique_ptr<Impl> pimpl;92 std::unique_ptr<Impl> pimpl;
91};93};
9294
=== added file 'launcher/LauncherControllerPrivate.h'
--- launcher/LauncherControllerPrivate.h 1970-01-01 00:00:00 +0000
+++ launcher/LauncherControllerPrivate.h 2012-07-26 13:13:33 +0000
@@ -0,0 +1,163 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * version 3 along with this program. If not, see
15 * <http://www.gnu.org/licenses/>
16 *
17 * Authored by: Jason Smith <jason.smith@canonical.com>
18 * Tim Penhey <tim.penhey@canonical.com>
19 * Marco Trevisan (Treviño) <marco.trevisan@canonical.com>
20 *
21 */
22
23#ifndef LAUNCHER_CONTROLLER_PRIVATE_H
24#define LAUNCHER_CONTROLLER_PRIVATE_H
25
26#include <Nux/Nux.h>
27
28#include "AbstractLauncherIcon.h"
29#include "DeviceLauncherSection.h"
30#include "EdgeBarrierController.h"
31#include "LauncherController.h"
32#include "Launcher.h"
33#include "LauncherEntryRemote.h"
34#include "LauncherEntryRemoteModel.h"
35#include "LauncherModel.h"
36#include "SoftwareCenterLauncherIcon.h"
37#include "unity-shared/UBusWrapper.h"
38#include "VolumeMonitorWrapper.h"
39
40namespace unity
41{
42namespace launcher
43{
44
45class Controller::Impl
46{
47public:
48 Impl(Display* display, Controller* parent);
49 ~Impl();
50
51 void UpdateNumWorkspaces(int workspaces);
52
53 Launcher* CreateLauncher(int monitor);
54
55 void Save();
56 void SortAndUpdate();
57
58 nux::ObjectPtr<Launcher> CurrentLauncher();
59
60 void OnIconAdded(AbstractLauncherIcon::Ptr icon);
61 void OnIconRemoved(AbstractLauncherIcon::Ptr icon);
62
63 void OnLauncherAddRequest(char* path, AbstractLauncherIcon::Ptr before);
64 void OnLauncherAddRequestSpecial(std::string const& path, std::string const& aptdaemon_trans_id,
65 std::string const& icon_path, int icon_x, int icon_y, int icon_size);
66 void OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr icon);
67 void OnSCIconAnimationComplete(AbstractLauncherIcon::Ptr icon);
68
69 void OnLauncherEntryRemoteAdded(LauncherEntryRemote::Ptr const& entry);
70 void OnLauncherEntryRemoteRemoved(LauncherEntryRemote::Ptr const& entry);
71
72 void OnFavoriteStoreFavoriteAdded(std::string const& entry, std::string const& pos, bool before);
73 void OnFavoriteStoreFavoriteRemoved(std::string const& entry);
74 void OnFavoriteStoreReordered();
75
76
77 void InsertExpoAction();
78 void RemoveExpoAction();
79
80 void InsertDesktopIcon();
81 void RemoveDesktopIcon();
82
83 void SendHomeActivationRequest();
84
85 int MonitorWithMouse();
86
87 void InsertTrash();
88
89 void RegisterIcon(AbstractLauncherIcon::Ptr icon);
90
91 AbstractLauncherIcon::Ptr CreateFavorite(const char* file_path);
92
93 SoftwareCenterLauncherIcon::Ptr CreateSCLauncherIcon(std::string const& file_path, std::string const& aptdaemon_trans_id, std::string const& icon_path);
94
95 void SetupBamf();
96
97 void EnsureLaunchers(int primary, std::vector<nux::Geometry> const& monitors);
98
99 void OnExpoActivated();
100
101 void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors);
102
103 void OnWindowFocusChanged (guint32 xid);
104
105 void OnViewOpened(BamfMatcher* matcher, BamfView* view);
106
107 void ReceiveMouseDownOutsideArea(int x, int y, unsigned long button_flags, unsigned long key_flags);
108
109 void ReceiveLauncherKeyPress(unsigned long eventType,
110 unsigned long keysym,
111 unsigned long state,
112 const char* character,
113 unsigned short keyCount);
114
115 static void OnBusAcquired(GDBusConnection* connection, const gchar* name, gpointer user_data);
116 static void OnDBusMethodCall(GDBusConnection* connection, const gchar* sender, const gchar* object_path,
117 const gchar* interface_name, const gchar* method_name,
118 GVariant* parameters, GDBusMethodInvocation* invocation,
119 gpointer user_data);
120
121 static GDBusInterfaceVTable interface_vtable;
122
123 Controller* parent_;
124 LauncherModel::Ptr model_;
125 nux::ObjectPtr<Launcher> launcher_;
126 nux::ObjectPtr<Launcher> keyboard_launcher_;
127 int sort_priority_;
128 AbstractVolumeMonitorWrapper::Ptr volume_monitor_;
129 DeviceLauncherSection device_section_;
130 LauncherEntryRemoteModel remote_model_;
131 AbstractLauncherIcon::Ptr expo_icon_;
132 AbstractLauncherIcon::Ptr desktop_icon_;
133 int num_workspaces_;
134 bool show_desktop_icon_;
135 Display* display_;
136
137 bool launcher_open;
138 bool launcher_keynav;
139 bool launcher_grabbed;
140 bool reactivate_keynav;
141 int reactivate_index;
142 bool keynav_restore_window_;
143 int launcher_key_press_time_;
144 unsigned int dbus_owner_;
145
146 ui::EdgeBarrierController edge_barriers_;
147
148 LauncherList launchers;
149
150 glib::Object<BamfMatcher> matcher_;
151 glib::Signal<void, BamfMatcher*, BamfView*> view_opened_signal_;
152 glib::SourceManager sources_;
153 UBusManager ubus;
154
155 sigc::connection on_expoicon_activate_connection_;
156 sigc::connection launcher_key_press_connection_;
157 sigc::connection launcher_event_outside_connection_;
158};
159
160} // launcher namespace
161} // unity namespace
162
163#endif
0164
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2012-07-24 23:09:24 +0000
+++ tests/CMakeLists.txt 2012-07-26 13:13:33 +0000
@@ -217,6 +217,7 @@
217 test_hud_view.cpp217 test_hud_view.cpp
218 test_icon_loader.cpp218 test_icon_loader.cpp
219 test_im_text_entry.cpp219 test_im_text_entry.cpp
220 test_launcher_controller.cpp
220 test_keyboard_util.cpp221 test_keyboard_util.cpp
221 test_resultviewgrid.cpp222 test_resultviewgrid.cpp
222 test_single_monitor_launcher_icon.cpp223 test_single_monitor_launcher_icon.cpp
@@ -239,9 +240,11 @@
239 ${CMAKE_SOURCE_DIR}/hud/HudView.cpp240 ${CMAKE_SOURCE_DIR}/hud/HudView.cpp
240 ${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp241 ${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp
241 ${CMAKE_SOURCE_DIR}/launcher/BamfLauncherIcon.cpp242 ${CMAKE_SOURCE_DIR}/launcher/BamfLauncherIcon.cpp
243 ${CMAKE_SOURCE_DIR}/launcher/BFBLauncherIcon.cpp
242 ${CMAKE_SOURCE_DIR}/launcher/CairoBaseWindow.cpp244 ${CMAKE_SOURCE_DIR}/launcher/CairoBaseWindow.cpp
243 ${CMAKE_SOURCE_DIR}/launcher/DNDCollectionWindow.cpp245 ${CMAKE_SOURCE_DIR}/launcher/DNDCollectionWindow.cpp
244 ${CMAKE_SOURCE_DIR}/launcher/Decaymulator.cpp246 ${CMAKE_SOURCE_DIR}/launcher/Decaymulator.cpp
247 ${CMAKE_SOURCE_DIR}/launcher/DesktopLauncherIcon.cpp
245 ${CMAKE_SOURCE_DIR}/launcher/DeviceLauncherIcon.cpp248 ${CMAKE_SOURCE_DIR}/launcher/DeviceLauncherIcon.cpp
246 ${CMAKE_SOURCE_DIR}/launcher/DeviceLauncherSection.cpp249 ${CMAKE_SOURCE_DIR}/launcher/DeviceLauncherSection.cpp
247 ${CMAKE_SOURCE_DIR}/launcher/DevicesSettings.cpp250 ${CMAKE_SOURCE_DIR}/launcher/DevicesSettings.cpp
@@ -251,9 +254,12 @@
251 ${CMAKE_SOURCE_DIR}/launcher/FavoriteStoreGSettings.cpp254 ${CMAKE_SOURCE_DIR}/launcher/FavoriteStoreGSettings.cpp
252 ${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp255 ${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp
253 ${CMAKE_SOURCE_DIR}/launcher/GeisAdapter.cpp256 ${CMAKE_SOURCE_DIR}/launcher/GeisAdapter.cpp
257 ${CMAKE_SOURCE_DIR}/launcher/HudLauncherIcon.cpp
254 ${CMAKE_SOURCE_DIR}/launcher/Launcher.cpp258 ${CMAKE_SOURCE_DIR}/launcher/Launcher.cpp
259 ${CMAKE_SOURCE_DIR}/launcher/LauncherController.cpp
255 ${CMAKE_SOURCE_DIR}/launcher/LauncherDragWindow.cpp260 ${CMAKE_SOURCE_DIR}/launcher/LauncherDragWindow.cpp
256 ${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemote.cpp261 ${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemote.cpp
262 ${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemoteModel.cpp
257 ${CMAKE_SOURCE_DIR}/launcher/LauncherHideMachine.cpp263 ${CMAKE_SOURCE_DIR}/launcher/LauncherHideMachine.cpp
258 ${CMAKE_SOURCE_DIR}/launcher/LauncherHoverMachine.cpp264 ${CMAKE_SOURCE_DIR}/launcher/LauncherHoverMachine.cpp
259 ${CMAKE_SOURCE_DIR}/launcher/LauncherIcon.cpp265 ${CMAKE_SOURCE_DIR}/launcher/LauncherIcon.cpp
@@ -271,11 +277,14 @@
271 ${CMAKE_SOURCE_DIR}/launcher/QuicklistView.cpp277 ${CMAKE_SOURCE_DIR}/launcher/QuicklistView.cpp
272 ${CMAKE_SOURCE_DIR}/launcher/SimpleLauncherIcon.cpp278 ${CMAKE_SOURCE_DIR}/launcher/SimpleLauncherIcon.cpp
273 ${CMAKE_SOURCE_DIR}/launcher/SingleMonitorLauncherIcon.cpp279 ${CMAKE_SOURCE_DIR}/launcher/SingleMonitorLauncherIcon.cpp
280 ${CMAKE_SOURCE_DIR}/launcher/SoftwareCenterLauncherIcon.cpp
274 ${CMAKE_SOURCE_DIR}/launcher/SpacerLauncherIcon.cpp281 ${CMAKE_SOURCE_DIR}/launcher/SpacerLauncherIcon.cpp
275 ${CMAKE_SOURCE_DIR}/launcher/SwitcherController.cpp282 ${CMAKE_SOURCE_DIR}/launcher/SwitcherController.cpp
276 ${CMAKE_SOURCE_DIR}/launcher/SwitcherModel.cpp283 ${CMAKE_SOURCE_DIR}/launcher/SwitcherModel.cpp
277 ${CMAKE_SOURCE_DIR}/launcher/SwitcherView.cpp284 ${CMAKE_SOURCE_DIR}/launcher/SwitcherView.cpp
278 ${CMAKE_SOURCE_DIR}/launcher/Tooltip.cpp285 ${CMAKE_SOURCE_DIR}/launcher/Tooltip.cpp
286 ${CMAKE_SOURCE_DIR}/launcher/TrashLauncherIcon.cpp
287 ${CMAKE_SOURCE_DIR}/launcher/VolumeMonitorWrapper.cpp
279 ${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp288 ${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp
280 ${CMAKE_SOURCE_DIR}/unity-shared/BackgroundEffectHelper.cpp289 ${CMAKE_SOURCE_DIR}/unity-shared/BackgroundEffectHelper.cpp
281 ${CMAKE_SOURCE_DIR}/unity-shared/DashStyle.cpp290 ${CMAKE_SOURCE_DIR}/unity-shared/DashStyle.cpp
282291
=== modified file 'tests/test_edge_barrier_controller.cpp'
--- tests/test_edge_barrier_controller.cpp 2012-07-20 18:34:34 +0000
+++ tests/test_edge_barrier_controller.cpp 2012-07-26 13:13:33 +0000
@@ -20,9 +20,9 @@
2020
21#include <gmock/gmock.h>21#include <gmock/gmock.h>
22#include "test_utils.h"22#include "test_utils.h"
23#include "test_uscreen_mock.h"
2324
24#include "EdgeBarrierController.h"25#include "EdgeBarrierController.h"
25#include "MultiMonitor.h"
2626
27using namespace unity;27using namespace unity;
28using namespace unity::ui;28using namespace unity::ui;
@@ -53,6 +53,11 @@
53 {53 {
54 EdgeBarrierController::ProcessBarrierEvent(owner, event);54 EdgeBarrierController::ProcessBarrierEvent(owner, event);
55 }55 }
56
57 EdgeBarrierSubscriber* GetSubscriber(unsigned int monitor)
58 {
59 return EdgeBarrierController::GetSubscriber(monitor);
60 }
56};61};
5762
58class TestBarrierSubscriber : public EdgeBarrierSubscriber63class TestBarrierSubscriber : public EdgeBarrierSubscriber
@@ -79,6 +84,8 @@
79 bc.options()->edge_resist = true;84 bc.options()->edge_resist = true;
80 bc.options()->edge_passed_disabled_ms = 150;85 bc.options()->edge_passed_disabled_ms = 150;
8186
87 uscreen.SetupFakeMultiMonitor();
88
82 for (int i = 0; i < max_num_monitors; ++i)89 for (int i = 0; i < max_num_monitors; ++i)
83 {90 {
84 // By default we assume that no subscriber handles the events!!!91 // By default we assume that no subscriber handles the events!!!
@@ -93,12 +100,38 @@
93 }100 }
94101
95 TestBarrierSubscriber subscribers_[max_num_monitors];102 TestBarrierSubscriber subscribers_[max_num_monitors];
103 MockUScreen uscreen;
96 MockEdgeBarrierController bc;104 MockEdgeBarrierController bc;
97};105};
98106
99TEST_F(TestEdgeBarrierController, Construction)107TEST_F(TestEdgeBarrierController, Construction)
100{108{
101 EXPECT_TRUE(bc.sticky_edges);109 EXPECT_TRUE(bc.sticky_edges);
110
111 for (int i = 0; i < max_num_monitors; ++i)
112 ASSERT_EQ(bc.GetSubscriber(i), &subscribers_[i]);
113}
114
115TEST_F(TestEdgeBarrierController, Unsubscribe)
116{
117 for (int i = 0; i < max_num_monitors; ++i)
118 {
119 bc.Unsubscribe(&subscribers_[i], i);
120 ASSERT_EQ(bc.GetSubscriber(i), nullptr);
121 }
122}
123
124TEST_F(TestEdgeBarrierController, UnsubscribeInvalid)
125{
126 bc.Unsubscribe(&subscribers_[2], 1);
127 ASSERT_EQ(bc.GetSubscriber(2), &subscribers_[2]);
128}
129
130TEST_F(TestEdgeBarrierController, SubscriberReplace)
131{
132 TestBarrierSubscriber handling_subscriber(true);
133 bc.Subscribe(&handling_subscriber, 0);
134 EXPECT_EQ(bc.GetSubscriber(0), &handling_subscriber);
102}135}
103136
104TEST_F(TestEdgeBarrierController, ProcessHandledEvent)137TEST_F(TestEdgeBarrierController, ProcessHandledEvent)
@@ -141,6 +174,20 @@
141 bc.ProcessBarrierEvent(&owner, breaking_barrier_event);174 bc.ProcessBarrierEvent(&owner, breaking_barrier_event);
142}175}
143176
177TEST_F(TestEdgeBarrierController, ProcessUnHandledEventBreakingBarrierOnMaxMonitor)
178{
179 int monitor = max_num_monitors;
180
181 MockPointerBarrier owner(monitor);
182 auto breaking_barrier_event = MakeBarrierEvent(0, true);
183
184 // This was leading to a crash, see bug #1020075
185 // you can reproduce this repeating this test multiple times using the
186 // --gtest_repeat=X command line
187 EXPECT_CALL(owner, ReleaseBarrier(_));
188 bc.ProcessBarrierEvent(&owner, breaking_barrier_event);
189}
190
144TEST_F(TestEdgeBarrierController, ProcessUnHandledEventNotBreakingBarrier)191TEST_F(TestEdgeBarrierController, ProcessUnHandledEventNotBreakingBarrier)
145{192{
146 int monitor = 2;193 int monitor = 2;
147194
=== added file 'tests/test_launcher_controller.cpp'
--- tests/test_launcher_controller.cpp 1970-01-01 00:00:00 +0000
+++ tests/test_launcher_controller.cpp 2012-07-26 13:13:33 +0000
@@ -0,0 +1,202 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * version 3 along with this program. If not, see
15 * <http://www.gnu.org/licenses/>
16 *
17 * Authored by: Marco Trevisan (Treviño) <marco.trevisan@canonical.com>
18 */
19
20#include <gmock/gmock.h>
21#include "test_uscreen_mock.h"
22
23#include "FavoriteStore.h"
24#include "LauncherController.h"
25#include "LauncherControllerPrivate.h"
26#include "PanelStyle.h"
27#include "UnitySettings.h"
28
29using namespace unity::launcher;
30using namespace testing;
31
32namespace unity
33{
34
35class MockFavoriteStore : public FavoriteStore
36{
37public:
38 FavoriteList const& GetFavorites()
39 {
40 return fav_list_;
41 };
42
43 void AddFavorite(std::string const& desktop_path, int position) {};
44 void RemoveFavorite(std::string const& desktop_path) {};
45 void MoveFavorite(std::string const& desktop_path, int position) {};
46 void SetFavorites(FavoriteList const& desktop_paths) {};
47
48private:
49 FavoriteList fav_list_;
50};
51
52namespace launcher
53{
54class TestLauncherController : public testing::Test
55{
56public:
57 TestLauncherController()
58 : lc(nux::GetGraphicsDisplay()->GetX11Display())
59 {}
60
61 virtual void SetUp()
62 {
63 lc.options = std::make_shared<Options>();
64 lc.multiple_launchers = true;
65 }
66
67protected:
68 ui::EdgeBarrierController &GetBarrierController()
69 {
70 return lc.pimpl->edge_barriers_;
71 }
72
73 MockUScreen uscreen;
74 Settings settings;
75 panel::Style panel_style;
76 MockFavoriteStore favorite_store;
77 GeisAdapter geis_adapter;
78 Controller lc;
79};
80}
81
82TEST_F(TestLauncherController, Construction)
83{
84 EXPECT_NE(lc.options(), nullptr);
85 EXPECT_TRUE(lc.multiple_launchers());
86}
87
88TEST_F(TestLauncherController, MultimonitorMultipleLaunchers)
89{
90 lc.multiple_launchers = true;
91 uscreen.SetupFakeMultiMonitor();
92
93 ASSERT_EQ(lc.launchers().size(), max_num_monitors);
94
95 for (int i = 0; i < max_num_monitors; ++i)
96 {
97 EXPECT_EQ(lc.launchers()[i]->monitor(), i);
98 }
99}
100
101TEST_F(TestLauncherController, MultimonitorSingleLauncher)
102{
103 lc.multiple_launchers = false;
104 uscreen.SetupFakeMultiMonitor(0, false);
105
106 for (int i = 0; i < max_num_monitors; ++i)
107 {
108 uscreen.SetPrimary(i);
109 ASSERT_EQ(lc.launchers().size(), 1);
110 EXPECT_EQ(lc.launcher().monitor(), i);
111 }
112}
113
114TEST_F(TestLauncherController, MultimonitorSwitchToMultipleLaunchers)
115{
116 lc.multiple_launchers = false;
117 uscreen.SetupFakeMultiMonitor();
118
119 ASSERT_EQ(lc.launchers().size(), 1);
120
121 lc.multiple_launchers = true;
122 EXPECT_EQ(lc.launchers().size(), max_num_monitors);
123}
124
125TEST_F(TestLauncherController, MultimonitorSwitchToSingleLauncher)
126{
127 lc.multiple_launchers = true;
128 int primary = 3;
129 uscreen.SetupFakeMultiMonitor(primary);
130
131 ASSERT_EQ(lc.launchers().size(), max_num_monitors);
132
133 lc.multiple_launchers = false;
134 EXPECT_EQ(lc.launchers().size(), 1);
135 EXPECT_EQ(lc.launcher().monitor(), primary);
136}
137
138TEST_F(TestLauncherController, MultimonitorSwitchToSingleMonitor)
139{
140 uscreen.SetupFakeMultiMonitor();
141 ASSERT_EQ(lc.launchers().size(), max_num_monitors);
142
143 uscreen.Reset();
144 EXPECT_EQ(lc.launchers().size(), 1);
145 EXPECT_EQ(lc.launcher().monitor(), 0);
146}
147
148TEST_F(TestLauncherController, MultimonitorRemoveMiddleMonitor)
149{
150 uscreen.SetupFakeMultiMonitor();
151 ASSERT_EQ(lc.launchers().size(), max_num_monitors);
152
153 std::vector<nux::Geometry> &monitors = uscreen.GetMonitors();
154 monitors.erase(monitors.begin() + monitors.size()/2);
155 uscreen.changed.emit(uscreen.GetPrimaryMonitor(), uscreen.GetMonitors());
156 ASSERT_EQ(lc.launchers().size(), max_num_monitors - 1);
157
158 for (int i = 0; i < max_num_monitors - 1; ++i)
159 EXPECT_EQ(lc.launchers()[i]->monitor(), i);
160}
161
162TEST_F(TestLauncherController, SingleMonitorSwitchToMultimonitor)
163{
164 ASSERT_EQ(lc.launchers().size(), 1);
165
166 uscreen.SetupFakeMultiMonitor();
167
168 EXPECT_EQ(lc.launchers().size(), max_num_monitors);
169}
170
171TEST_F(TestLauncherController, MultiMonitorEdgeBarrierSubscriptions)
172{
173 uscreen.SetupFakeMultiMonitor();
174
175 for (int i = 0; i < max_num_monitors; ++i)
176 ASSERT_EQ(GetBarrierController().GetSubscriber(i), lc.launchers()[i].GetPointer());
177}
178
179TEST_F(TestLauncherController, SingleMonitorEdgeBarrierSubscriptionsUpdates)
180{
181 lc.multiple_launchers = false;
182 uscreen.SetupFakeMultiMonitor(0, false);
183
184 for (int i = 0; i < max_num_monitors; ++i)
185 {
186 uscreen.SetPrimary(i);
187
188 for (int j = 0; j < max_num_monitors; ++j)
189 {
190 if (j == i)
191 {
192 ASSERT_EQ(GetBarrierController().GetSubscriber(j), &lc.launcher());
193 }
194 else
195 {
196 ASSERT_EQ(GetBarrierController().GetSubscriber(j), nullptr);
197 }
198 }
199 }
200}
201
202}
0203
=== added file 'tests/test_uscreen_mock.h'
--- tests/test_uscreen_mock.h 1970-01-01 00:00:00 +0000
+++ tests/test_uscreen_mock.h 2012-07-26 13:13:33 +0000
@@ -0,0 +1,85 @@
1/*
2 * Copyright 2012 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * version 3 along with this program. If not, see
15 * <http://www.gnu.org/licenses/>
16 *
17 * Authored by: Marco Trevisan (Treviño) <marco.trevisan@canonical.com>
18
19 */
20
21#ifndef TEST_USCREEN_MOCK_H
22#define TEST_USCREEN_MOCK_H
23
24#include "MultiMonitor.h"
25#include "UScreen.h"
26
27namespace unity
28{
29
30const unsigned MONITOR_WIDTH = 1024;
31const unsigned MONITOR_HEIGHT = 768;
32
33class MockUScreen : public UScreen
34{
35public:
36 MockUScreen()
37 {
38 Reset(false);
39 }
40
41 ~MockUScreen()
42 {
43 if (default_screen_ == this)
44 default_screen_ = nullptr;
45 }
46
47 void Reset(bool emit = true)
48 {
49 default_screen_ = this;
50 primary_ = 0;
51 monitors_ = {nux::Geometry(0, 0, MONITOR_WIDTH, MONITOR_HEIGHT)};
52
53 changed.emit(primary_, monitors_);
54 }
55
56 void SetupFakeMultiMonitor(int primary = 0, bool emit_update = true)
57 {
58 SetPrimary(primary, false);
59 monitors_.clear();
60
61 for (int i = 0, total_width = 0; i < max_num_monitors; ++i)
62 {
63 monitors_.push_back(nux::Geometry(MONITOR_WIDTH, MONITOR_HEIGHT, total_width, 0));
64 total_width += MONITOR_WIDTH;
65
66 if (emit_update)
67 changed.emit(GetPrimaryMonitor(), GetMonitors());
68 }
69 }
70
71 void SetPrimary(int primary, bool emit = true)
72 {
73 if (primary_ != primary)
74 {
75 primary_ = primary;
76
77 if (emit)
78 changed.emit(primary_, monitors_);
79 }
80 }
81};
82
83}
84
85#endif
0\ No newline at end of file86\ No newline at end of file
187
=== modified file 'unity-shared/UScreen.cpp'
--- unity-shared/UScreen.cpp 2012-06-18 02:57:23 +0000
+++ unity-shared/UScreen.cpp 2012-07-26 13:13:33 +0000
@@ -24,17 +24,18 @@
2424
25namespace25namespace
26{26{
27static UScreen* default_screen_ = nullptr;
28nux::logging::Logger logger("unity.screen");27nux::logging::Logger logger("unity.screen");
29}28}
3029
30UScreen* UScreen::default_screen_ = nullptr;
31
31UScreen::UScreen()32UScreen::UScreen()
32 : screen_(gdk_screen_get_default(), glib::AddRef())33 : primary_(0)
34 , screen_(gdk_screen_get_default(), glib::AddRef())
33 , proxy_("org.freedesktop.UPower",35 , proxy_("org.freedesktop.UPower",
34 "/org/freedesktop/UPower",36 "/org/freedesktop/UPower",
35 "org.freedesktop.UPower",37 "org.freedesktop.UPower",
36 G_BUS_TYPE_SYSTEM)38 G_BUS_TYPE_SYSTEM)
37 , primary_(0)
38{39{
39 size_changed_signal_.Connect(screen_, "size-changed", sigc::mem_fun(this, &UScreen::Changed));40 size_changed_signal_.Connect(screen_, "size-changed", sigc::mem_fun(this, &UScreen::Changed));
40 monitors_changed_signal_.Connect(screen_, "monitors-changed", sigc::mem_fun(this, &UScreen::Changed));41 monitors_changed_signal_.Connect(screen_, "monitors-changed", sigc::mem_fun(this, &UScreen::Changed));
4142
=== modified file 'unity-shared/UScreen.h'
--- unity-shared/UScreen.h 2012-06-18 02:57:23 +0000
+++ unity-shared/UScreen.h 2012-07-26 13:13:33 +0000
@@ -55,14 +55,17 @@
55 void Changed(GdkScreen* screen);55 void Changed(GdkScreen* screen);
56 void Refresh();56 void Refresh();
5757
58private:58protected:
59 static UScreen* default_screen_;
59 std::vector<nux::Geometry> monitors_;60 std::vector<nux::Geometry> monitors_;
61 int primary_;
62
63private:
60 glib::Object<GdkScreen> screen_;64 glib::Object<GdkScreen> screen_;
61 glib::DBusProxy proxy_;65 glib::DBusProxy proxy_;
62 glib::Signal<void, GdkScreen*> size_changed_signal_;66 glib::Signal<void, GdkScreen*> size_changed_signal_;
63 glib::Signal<void, GdkScreen*> monitors_changed_signal_;67 glib::Signal<void, GdkScreen*> monitors_changed_signal_;
64 glib::Source::UniquePtr refresh_idle_;68 glib::Source::UniquePtr refresh_idle_;
65 int primary_;
66};69};
6770
68} // Namespace71} // Namespace