Merge lp:~jassmith/unity/unity.mm-options into lp:unity
- unity.mm-options
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Jason Smith |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2094 |
Proposed branch: | lp:~jassmith/unity/unity.mm-options |
Merge into: | lp:unity |
Diff against target: |
617 lines (+191/-61) 16 files modified
manual-tests/MMOptions.txt (+22/-0) plugins/unityshell/src/AbstractLauncherIcon.h (+2/-0) plugins/unityshell/src/DashController.cpp (+16/-4) plugins/unityshell/src/DashController.h (+2/-0) plugins/unityshell/src/Launcher.cpp (+48/-32) plugins/unityshell/src/Launcher.h (+3/-0) plugins/unityshell/src/LauncherController.cpp (+44/-16) plugins/unityshell/src/LauncherController.h (+1/-0) plugins/unityshell/src/LauncherIcon.cpp (+9/-0) plugins/unityshell/src/LauncherIcon.h (+2/-0) plugins/unityshell/src/LauncherOptions.cpp (+3/-0) plugins/unityshell/src/LauncherOptions.h (+2/-0) plugins/unityshell/src/MockLauncherIcon.h (+5/-0) plugins/unityshell/src/UScreen.cpp (+1/-9) plugins/unityshell/src/unityshell.cpp (+10/-0) plugins/unityshell/unityshell.xml.in (+21/-0) |
To merge this branch: | bzr merge lp:~jassmith/unity/unity.mm-options |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Penhey (community) | Approve | ||
Review via email: mp+97133@code.launchpad.net |
Commit message
Description of the change
== The Problem ==
Design requested changes to multi-monitor to provide support for toggling barriers and multiple-launchers
== The Solution ==
Implement the options
== Testing ==
Interactions should be covered under existing tests
Tim Penhey (thumper) wrote : | # |
Thanks for the updates.
Didier Roche-Tolomelli (didrocks) wrote : | # |
Can you please open a bug (or ask design to do so for a FFe?)
Omer Akram (om26er) wrote : | # |
bugs are 950136 and 946104
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
387 +nux::ObjectPtr
388 +{
389 + nux::ObjectPtr<
390 + int best = std::max<int> (launchers.size() - 1, MonitorWithMous
391 + if (best >= 0)
392 + result = launchers[best];
393 + return result;
394 +}
This is causing that the right-most monitor is always used for keyboard navigation, while the MonitorWithMouse is actually ignored.
Using std::min of course fixes the issue.
Also, there are some autopilot tests failing when using this in multimonitor (some of them should be related to the problem above).
Preview Diff
1 | === added file 'manual-tests/MMOptions.txt' |
2 | --- manual-tests/MMOptions.txt 1970-01-01 00:00:00 +0000 |
3 | +++ manual-tests/MMOptions.txt 2012-03-13 03:12:20 +0000 |
4 | @@ -0,0 +1,22 @@ |
5 | +Test Barrier Toggle |
6 | +----------- |
7 | +This test is to ensure the barrier toggle works on multiple-monitor systems |
8 | + |
9 | +#. Get a system with 2 monitors, ensure the left most monitor is set as primary |
10 | +#. Disable the "Capture Mouse" setting in CCSM |
11 | +#. Move your mouse between the left and right monitor |
12 | + |
13 | +Outcome |
14 | + The mouse should move freely between monitors, without a launcher blocking its movement. |
15 | + |
16 | + |
17 | +Test Number of Launchers |
18 | +----------- |
19 | +This test is to ensure that the number of launchers created and positioned can be properly configured |
20 | + |
21 | +#. Get a system with 2 monitors, ensure the left most monitor is set as primary |
22 | +#. Open CCSM and changed the Number of Launchers option to "Primary Only" |
23 | +#. Check for the existence of a launcher on your non-primary monitor |
24 | + |
25 | +Outcome |
26 | + There should only be a launcher on the primary monitor. |
27 | \ No newline at end of file |
28 | |
29 | === modified file 'plugins/unityshell/src/AbstractLauncherIcon.h' |
30 | --- plugins/unityshell/src/AbstractLauncherIcon.h 2012-02-12 10:43:11 +0000 |
31 | +++ plugins/unityshell/src/AbstractLauncherIcon.h 2012-03-13 03:12:20 +0000 |
32 | @@ -151,6 +151,8 @@ |
33 | |
34 | virtual const bool WindowVisibleOnMonitor(int monitor) = 0; |
35 | |
36 | + virtual const bool WindowVisibleOnViewport() = 0; |
37 | + |
38 | virtual bool IsSpacer() = 0; |
39 | |
40 | virtual float PresentUrgency() = 0; |
41 | |
42 | === modified file 'plugins/unityshell/src/DashController.cpp' |
43 | --- plugins/unityshell/src/DashController.cpp 2012-03-11 23:00:59 +0000 |
44 | +++ plugins/unityshell/src/DashController.cpp 2012-03-13 03:12:20 +0000 |
45 | @@ -39,6 +39,7 @@ |
46 | |
47 | Controller::Controller() |
48 | : launcher_width(64) |
49 | + , use_primary(false) |
50 | , window_(0) |
51 | , visible_(false) |
52 | , need_show_(false) |
53 | @@ -160,11 +161,22 @@ |
54 | geo = self->GetIdealWindowGeometry(); |
55 | } |
56 | |
57 | +int Controller::GetIdealMonitor() |
58 | +{ |
59 | + UScreen *uscreen = UScreen::GetDefault(); |
60 | + int primary_monitor; |
61 | + if (use_primary) |
62 | + primary_monitor = uscreen->GetPrimaryMonitor(); |
63 | + else |
64 | + primary_monitor = uscreen->GetMonitorWithMouse(); |
65 | + |
66 | + return primary_monitor; |
67 | +} |
68 | + |
69 | nux::Geometry Controller::GetIdealWindowGeometry() |
70 | { |
71 | UScreen *uscreen = UScreen::GetDefault(); |
72 | - int primary_monitor = uscreen->GetMonitorWithMouse(); |
73 | - auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor); |
74 | + auto monitor_geo = uscreen->GetMonitorGeometry(GetIdealMonitor()); |
75 | |
76 | // We want to cover as much of the screen as possible to grab any mouse events outside |
77 | // of our window |
78 | @@ -260,7 +272,7 @@ |
79 | |
80 | StartShowHideTimeline(); |
81 | |
82 | - GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, UScreen::GetDefault()->GetMonitorWithMouse()); |
83 | + GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, GetIdealMonitor()); |
84 | ubus_manager_.SendMessage(UBUS_OVERLAY_SHOWN, info); |
85 | } |
86 | |
87 | @@ -286,7 +298,7 @@ |
88 | |
89 | StartShowHideTimeline(); |
90 | |
91 | - GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, g_variant_new_int32(UScreen::GetDefault()->GetMonitorWithMouse())); |
92 | + GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, GetIdealMonitor()); |
93 | ubus_manager_.SendMessage(UBUS_OVERLAY_HIDDEN, info); |
94 | } |
95 | |
96 | |
97 | === modified file 'plugins/unityshell/src/DashController.h' |
98 | --- plugins/unityshell/src/DashController.h 2012-02-15 10:54:48 +0000 |
99 | +++ plugins/unityshell/src/DashController.h 2012-03-13 03:12:20 +0000 |
100 | @@ -52,6 +52,7 @@ |
101 | std::vector<char> GetAllShortcuts(); |
102 | |
103 | nux::Property<int> launcher_width; |
104 | + nux::Property<bool> use_primary; |
105 | |
106 | sigc::signal<void> on_realize; |
107 | |
108 | @@ -67,6 +68,7 @@ |
109 | void RegisterUBusInterests(); |
110 | |
111 | nux::Geometry GetIdealWindowGeometry(); |
112 | + int GetIdealMonitor(); |
113 | void Relayout(GdkScreen*screen=NULL); |
114 | |
115 | void OnMouseDownOutsideWindow(int x, int y, unsigned long bflags, unsigned long kflags); |
116 | |
117 | === modified file 'plugins/unityshell/src/Launcher.cpp' |
118 | --- plugins/unityshell/src/Launcher.cpp 2012-02-29 16:09:07 +0000 |
119 | +++ plugins/unityshell/src/Launcher.cpp 2012-03-13 03:12:20 +0000 |
120 | @@ -221,6 +221,7 @@ |
121 | _autoscroll_handle = 0; |
122 | _start_dragicon_handle = 0; |
123 | _dnd_check_handle = 0; |
124 | + _strut_hack_handle = 0; |
125 | _last_reveal_progress = 0; |
126 | |
127 | _shortcuts_shown = false; |
128 | @@ -313,6 +314,8 @@ |
129 | g_source_remove(_start_dragicon_handle); |
130 | if (_launcher_animation_timeout > 0) |
131 | g_source_remove(_launcher_animation_timeout); |
132 | + if (_strut_hack_handle) |
133 | + g_source_remove(_strut_hack_handle); |
134 | |
135 | if (_on_data_collected_connection.connected()) |
136 | _on_data_collected_connection.disconnect(); |
137 | @@ -881,7 +884,6 @@ |
138 | arg.colorify = nux::color::White; |
139 | arg.running_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING); |
140 | arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT); |
141 | - arg.running_on_viewport = icon->WindowVisibleOnMonitor(monitor); |
142 | arg.draw_edge_only = IconDrawEdgeOnly(icon); |
143 | arg.active_colored = false; |
144 | arg.x_rotation = 0.0f; |
145 | @@ -905,6 +907,11 @@ |
146 | else |
147 | arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE); |
148 | |
149 | + if (options()->show_for_all) |
150 | + arg.running_on_viewport = icon->WindowVisibleOnViewport(); |
151 | + else |
152 | + arg.running_on_viewport = icon->WindowVisibleOnMonitor(monitor); |
153 | + |
154 | guint64 shortcut = icon->GetShortcut(); |
155 | if (shortcut > 32) |
156 | arg.shortcut_label = (char) shortcut; |
157 | @@ -924,7 +931,10 @@ |
158 | } |
159 | else |
160 | { |
161 | - arg.window_indicators = std::max<int> (icon->WindowsForMonitor(monitor).size(), 1); |
162 | + if (options()->show_for_all) |
163 | + arg.window_indicators = std::max<int> (icon->Windows().size(), 1); |
164 | + else |
165 | + arg.window_indicators = std::max<int> (icon->WindowsForMonitor(monitor).size(), 1); |
166 | } |
167 | |
168 | arg.backlight_intensity = IconBackgroundIntensity(icon, current); |
169 | @@ -1483,6 +1493,7 @@ |
170 | if (self->options()->hide_mode == LAUNCHER_HIDE_NEVER) |
171 | self->_parent->InputWindowEnableStruts(true); |
172 | |
173 | + self->_strut_hack_handle = 0; |
174 | return false; |
175 | } |
176 | |
177 | @@ -1506,24 +1517,37 @@ |
178 | SetHideMode(options->hide_mode); |
179 | SetIconSize(options->tile_size, options->icon_size); |
180 | |
181 | - // make the effect half as strong as specified as other values shouldn't scale |
182 | - // as quickly as the max velocity multiplier |
183 | - float decay_responsiveness_mult = ((options->edge_responsiveness() - 1) * .3f) + 1; |
184 | - float reveal_responsiveness_mult = ((options->edge_responsiveness() - 1) * .025f) + 1; |
185 | - float overcome_responsiveness_mult = ((options->edge_responsiveness() - 1) * 1.0f) + 1; |
186 | - |
187 | - decaymulator_->rate_of_decay = options->edge_decay_rate() * decay_responsiveness_mult; |
188 | - _edge_overcome_pressure = options->edge_overcome_pressure() * overcome_responsiveness_mult; |
189 | - |
190 | - _pointer_barrier->threshold = options->edge_stop_velocity(); |
191 | - _pointer_barrier->max_velocity_multiplier = options->edge_responsiveness(); |
192 | + ConfigureBarrier(); |
193 | + EnsureAnimation(); |
194 | +} |
195 | + |
196 | +void Launcher::ConfigureBarrier() |
197 | +{ |
198 | + nux::Geometry geo = GetAbsoluteGeometry(); |
199 | _pointer_barrier->DestroyBarrier(); |
200 | - _pointer_barrier->ConstructBarrier(); |
201 | - |
202 | - _hide_machine->reveal_pressure = options->edge_reveal_pressure() * reveal_responsiveness_mult; |
203 | - _hide_machine->edge_decay_rate = options->edge_decay_rate() * decay_responsiveness_mult; |
204 | - |
205 | - EnsureAnimation(); |
206 | + |
207 | + if (options()->edge_resist || geo.x == 0) |
208 | + { |
209 | + unity::panel::Style &panel_style = panel::Style::Instance(); |
210 | + |
211 | + _pointer_barrier->x1 = geo.x; |
212 | + _pointer_barrier->x2 = geo.x; |
213 | + _pointer_barrier->y1 = geo.y - panel_style.panel_height; |
214 | + _pointer_barrier->y2 = geo.y + geo.height; |
215 | + |
216 | + float decay_responsiveness_mult = ((options()->edge_responsiveness() - 1) * .3f) + 1; |
217 | + float reveal_responsiveness_mult = ((options()->edge_responsiveness() - 1) * .025f) + 1; |
218 | + float overcome_responsiveness_mult = ((options()->edge_responsiveness() - 1) * 1.0f) + 1; |
219 | + decaymulator_->rate_of_decay = options()->edge_decay_rate() * decay_responsiveness_mult; |
220 | + _edge_overcome_pressure = options()->edge_overcome_pressure() * overcome_responsiveness_mult; |
221 | + |
222 | + _pointer_barrier->threshold = options()->edge_stop_velocity(); |
223 | + _pointer_barrier->max_velocity_multiplier = options()->edge_responsiveness(); |
224 | + _pointer_barrier->ConstructBarrier(); |
225 | + |
226 | + _hide_machine->reveal_pressure = options()->edge_reveal_pressure() * reveal_responsiveness_mult; |
227 | + _hide_machine->edge_decay_rate = options()->edge_decay_rate() * decay_responsiveness_mult; |
228 | + } |
229 | } |
230 | |
231 | void Launcher::SetHideMode(LauncherHideMode hidemode) |
232 | @@ -1535,7 +1559,8 @@ |
233 | else |
234 | { |
235 | _parent->EnableInputWindow(true, "launcher", false, false); |
236 | - g_timeout_add(1000, &Launcher::StrutHack, this); |
237 | + if (!_strut_hack_handle) |
238 | + _strut_hack_handle = g_timeout_add(1000, &Launcher::StrutHack, this); |
239 | _parent->InputWindowEnableStruts(true); |
240 | } |
241 | |
242 | @@ -1690,18 +1715,9 @@ |
243 | nux::Geometry new_geometry(geo.x, geo.y + panel_style.panel_height, width, geo.height - panel_style.panel_height); |
244 | SetMaximumHeight(new_geometry.height); |
245 | _parent->SetGeometry(new_geometry); |
246 | - SetGeometry(new_geometry); |
247 | - |
248 | - _pointer_barrier->DestroyBarrier(); |
249 | - |
250 | - _pointer_barrier->x1 = new_geometry.x; |
251 | - _pointer_barrier->x2 = new_geometry.x; |
252 | - _pointer_barrier->y1 = new_geometry.y - panel_style.panel_height; |
253 | - _pointer_barrier->y2 = new_geometry.y + new_geometry.height; |
254 | - _pointer_barrier->threshold = options()->edge_stop_velocity(); |
255 | - |
256 | - _pointer_barrier->ConstructBarrier(); |
257 | - |
258 | + SetGeometry(nux::Geometry(0, 0, new_geometry.width, new_geometry.height)); |
259 | + |
260 | + ConfigureBarrier(); |
261 | } |
262 | |
263 | void Launcher::OnIconAdded(AbstractLauncherIcon::Ptr icon) |
264 | |
265 | === modified file 'plugins/unityshell/src/Launcher.h' |
266 | --- plugins/unityshell/src/Launcher.h 2012-02-12 10:43:11 +0000 |
267 | +++ plugins/unityshell/src/Launcher.h 2012-03-13 03:12:20 +0000 |
268 | @@ -166,6 +166,8 @@ |
269 | TIME_LAST |
270 | } LauncherActionTimes; |
271 | |
272 | + void ConfigureBarrier(); |
273 | + |
274 | void OnOptionsChanged(Options::Ptr options); |
275 | void OnOptionChanged(); |
276 | void UpdateOptions(Options::Ptr options); |
277 | @@ -355,6 +357,7 @@ |
278 | guint _autoscroll_handle; |
279 | guint _start_dragicon_handle; |
280 | guint _dnd_check_handle; |
281 | + guint _strut_hack_handle; |
282 | |
283 | nux::Point2 _mouse_position; |
284 | nux::BaseWindow* _parent; |
285 | |
286 | === modified file 'plugins/unityshell/src/LauncherController.cpp' |
287 | --- plugins/unityshell/src/LauncherController.cpp 2012-02-29 17:05:43 +0000 |
288 | +++ plugins/unityshell/src/LauncherController.cpp 2012-03-13 03:12:20 +0000 |
289 | @@ -80,6 +80,8 @@ |
290 | void Save(); |
291 | void SortAndUpdate(); |
292 | |
293 | + nux::ObjectPtr<Launcher> CurrentLauncher(); |
294 | + |
295 | void OnIconAdded(AbstractLauncherIcon::Ptr icon); |
296 | void OnIconRemoved(AbstractLauncherIcon::Ptr icon); |
297 | |
298 | @@ -119,6 +121,8 @@ |
299 | |
300 | void SetupBamf(); |
301 | |
302 | + void EnsureLaunchers(std::vector<nux::Geometry> const& monitors); |
303 | + |
304 | void OnExpoActivated(); |
305 | |
306 | void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors); |
307 | @@ -194,13 +198,7 @@ |
308 | reactivate_keynav = false; |
309 | keynav_restore_window_ = true; |
310 | |
311 | - int i = 0; |
312 | - for (auto monitor : monitors) |
313 | - { |
314 | - Launcher* launcher = CreateLauncher(i); |
315 | - launchers.push_back(nux::ObjectPtr<Launcher> (launcher)); |
316 | - i++; |
317 | - } |
318 | + EnsureLaunchers(monitors); |
319 | |
320 | launcher_ = launchers[0]; |
321 | |
322 | @@ -264,9 +262,17 @@ |
323 | delete device_section_; |
324 | } |
325 | |
326 | -void Controller::Impl::OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors) |
327 | +void Controller::Impl::EnsureLaunchers(std::vector<nux::Geometry> const& monitors) |
328 | { |
329 | - unsigned int num_monitors = monitors.size(); |
330 | + unsigned int num_monitors; |
331 | + if (parent_->multiple_launchers) |
332 | + { |
333 | + num_monitors = monitors.size(); |
334 | + } |
335 | + else |
336 | + { |
337 | + num_monitors = 1; |
338 | + } |
339 | |
340 | unsigned int i; |
341 | for (i = 0; i < num_monitors; i++) |
342 | @@ -286,6 +292,11 @@ |
343 | launchers.resize(num_monitors); |
344 | } |
345 | |
346 | +void Controller::Impl::OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors) |
347 | +{ |
348 | + EnsureLaunchers(monitors); |
349 | +} |
350 | + |
351 | void Controller::Impl::OnWindowFocusChanged (guint32 xid) |
352 | { |
353 | static bool keynav_first_focus = false; |
354 | @@ -780,10 +791,16 @@ |
355 | } |
356 | |
357 | Controller::Controller(Display* display) |
358 | + : options(Options::Ptr(new Options())) |
359 | + , multiple_launchers(true) |
360 | + , pimpl(new Impl(display, this)) |
361 | { |
362 | - options = Options::Ptr(new Options()); |
363 | - // options must be set before creating pimpl which loads launchers |
364 | - pimpl = new Impl(display, this); |
365 | + multiple_launchers.changed.connect([&](bool value) -> void { |
366 | + UScreen* uscreen = UScreen::GetDefault(); |
367 | + auto monitors = uscreen->GetMonitors(); |
368 | + pimpl->EnsureLaunchers(monitors); |
369 | + options()->show_for_all = !value; |
370 | + }); |
371 | } |
372 | |
373 | Controller::~Controller() |
374 | @@ -834,6 +851,8 @@ |
375 | |
376 | Window Controller::LauncherWindowId(int launcher) const |
377 | { |
378 | + if (launcher >= (int)pimpl->launchers.size()) |
379 | + return 0; |
380 | return pimpl->launchers[launcher]->GetParent()->GetInputWindowId(); |
381 | } |
382 | |
383 | @@ -868,6 +887,15 @@ |
384 | return uscreen->GetMonitorWithMouse(); |
385 | } |
386 | |
387 | +nux::ObjectPtr<Launcher> Controller::Impl::CurrentLauncher() |
388 | +{ |
389 | + nux::ObjectPtr<Launcher> result; |
390 | + int best = std::max<int> (launchers.size() - 1, MonitorWithMouse()); |
391 | + if (best >= 0) |
392 | + result = launchers[best]; |
393 | + return result; |
394 | +} |
395 | + |
396 | void Controller::HandleLauncherKeyPress() |
397 | { |
398 | unity::TimeUtil::SetTimeStruct(&pimpl->launcher_key_press_time_); |
399 | @@ -876,7 +904,7 @@ |
400 | { |
401 | Impl* self = static_cast<Impl*>(user_data); |
402 | if (self->keyboard_launcher_.IsNull()) |
403 | - self->keyboard_launcher_ = self->launchers[self->MonitorWithMouse()]; |
404 | + self->keyboard_launcher_ = self->CurrentLauncher(); |
405 | |
406 | if (self->launcher_hide_handler_id_ > 0) |
407 | { |
408 | @@ -897,7 +925,7 @@ |
409 | if (!self->launcher_keynav) |
410 | { |
411 | if (self->keyboard_launcher_.IsNull()) |
412 | - self->keyboard_launcher_ = self->launchers[self->MonitorWithMouse()]; |
413 | + self->keyboard_launcher_ = self->CurrentLauncher(); |
414 | |
415 | self->keyboard_launcher_->ShowShortcuts(true); |
416 | self->launcher_open = true; |
417 | @@ -1021,7 +1049,7 @@ |
418 | pimpl->reactivate_keynav = false; |
419 | pimpl->launcher_keynav = true; |
420 | pimpl->keynav_restore_window_ = true; |
421 | - pimpl->keyboard_launcher_ = pimpl->launchers[pimpl->MonitorWithMouse()]; |
422 | + pimpl->keyboard_launcher_ = pimpl->CurrentLauncher(); |
423 | |
424 | pimpl->keyboard_launcher_->EnterKeyNavMode(); |
425 | pimpl->model_->SetSelection(0); |
426 | @@ -1087,7 +1115,7 @@ |
427 | .add("key_nav_launcher_monitor", pimpl->keyboard_launcher_.IsValid() ? pimpl->keyboard_launcher_->monitor : -1) |
428 | .add("key_nav_selection", pimpl->model_->SelectionIndex()) |
429 | .add("key_nav_is_grabbed", pimpl->launcher_grabbed) |
430 | - .add("keyboard_launcher", pimpl->launchers[pimpl->MonitorWithMouse()]->monitor); |
431 | + .add("keyboard_launcher", pimpl->CurrentLauncher()->monitor); |
432 | } |
433 | |
434 | void Controller::Impl::ReceiveLauncherKeyPress(unsigned long eventType, |
435 | |
436 | === modified file 'plugins/unityshell/src/LauncherController.h' |
437 | --- plugins/unityshell/src/LauncherController.h 2012-02-29 01:56:47 +0000 |
438 | +++ plugins/unityshell/src/LauncherController.h 2012-03-13 03:12:20 +0000 |
439 | @@ -42,6 +42,7 @@ |
440 | typedef std::vector<nux::ObjectPtr<Launcher> > LauncherList; |
441 | |
442 | nux::Property<Options::Ptr> options; |
443 | + nux::Property<bool> multiple_launchers; |
444 | |
445 | Controller(Display* display); |
446 | ~Controller(); |
447 | |
448 | === modified file 'plugins/unityshell/src/LauncherIcon.cpp' |
449 | --- plugins/unityshell/src/LauncherIcon.cpp 2012-02-21 02:03:40 +0000 |
450 | +++ plugins/unityshell/src/LauncherIcon.cpp 2012-03-13 03:12:20 +0000 |
451 | @@ -166,6 +166,15 @@ |
452 | return _has_visible_window[monitor]; |
453 | } |
454 | |
455 | +const bool LauncherIcon::WindowVisibleOnViewport() |
456 | +{ |
457 | + for (int i = 0; i < max_num_monitors; ++i) |
458 | + if (_has_visible_window[i]) |
459 | + return true; |
460 | + |
461 | + return false; |
462 | +} |
463 | + |
464 | std::string |
465 | LauncherIcon::GetName() const |
466 | { |
467 | |
468 | === modified file 'plugins/unityshell/src/LauncherIcon.h' |
469 | --- plugins/unityshell/src/LauncherIcon.h 2012-02-14 23:52:22 +0000 |
470 | +++ plugins/unityshell/src/LauncherIcon.h 2012-03-13 03:12:20 +0000 |
471 | @@ -110,6 +110,8 @@ |
472 | |
473 | const bool WindowVisibleOnMonitor(int monitor); |
474 | |
475 | + const bool WindowVisibleOnViewport(); |
476 | + |
477 | virtual bool IsSpacer() |
478 | { |
479 | return false; |
480 | |
481 | === modified file 'plugins/unityshell/src/LauncherOptions.cpp' |
482 | --- plugins/unityshell/src/LauncherOptions.cpp 2012-02-08 18:34:43 +0000 |
483 | +++ plugins/unityshell/src/LauncherOptions.cpp 2012-03-13 03:12:20 +0000 |
484 | @@ -42,6 +42,8 @@ |
485 | reveal_trigger = RevealTrigger::EDGE; |
486 | tile_size = 54; |
487 | urgent_animation = URGENT_ANIMATION_WIGGLE; |
488 | + edge_resist = true; |
489 | + show_for_all = false; |
490 | |
491 | auto_hide_animation.changed.connect ([&] (AutoHideAnimation value)-> void { option_changed.emit(); }); |
492 | background_alpha.changed.connect ([&] (float value) -> void { option_changed.emit(); }); |
493 | @@ -57,6 +59,7 @@ |
494 | reveal_trigger.changed.connect ([&] (RevealTrigger vallue) -> void { option_changed.emit(); }); |
495 | tile_size.changed.connect ([&] (int value) -> void { option_changed.emit(); }); |
496 | urgent_animation.changed.connect ([&] (UrgentAnimation value) -> void { option_changed.emit(); }); |
497 | + edge_resist.changed.connect ([&] (bool value) -> void { option_changed.emit(); }); |
498 | } |
499 | |
500 | |
501 | |
502 | === modified file 'plugins/unityshell/src/LauncherOptions.h' |
503 | --- plugins/unityshell/src/LauncherOptions.h 2012-02-08 17:22:28 +0000 |
504 | +++ plugins/unityshell/src/LauncherOptions.h 2012-03-13 03:12:20 +0000 |
505 | @@ -97,6 +97,8 @@ |
506 | nux::Property<int> edge_stop_velocity; |
507 | nux::Property<int> edge_reveal_pressure; |
508 | nux::Property<float> edge_responsiveness; |
509 | + nux::Property<bool> edge_resist; |
510 | + nux::Property<bool> show_for_all; |
511 | |
512 | sigc::signal<void> option_changed; |
513 | }; |
514 | |
515 | === modified file 'plugins/unityshell/src/MockLauncherIcon.h' |
516 | --- plugins/unityshell/src/MockLauncherIcon.h 2012-02-12 10:43:11 +0000 |
517 | +++ plugins/unityshell/src/MockLauncherIcon.h 2012-03-13 03:12:20 +0000 |
518 | @@ -137,6 +137,11 @@ |
519 | return 7; |
520 | } |
521 | |
522 | + const bool WindowVisibleOnViewport() |
523 | + { |
524 | + return false; |
525 | + } |
526 | + |
527 | const bool WindowVisibleOnMonitor(int monitor) |
528 | { |
529 | return false; |
530 | |
531 | === modified file 'plugins/unityshell/src/UScreen.cpp' |
532 | --- plugins/unityshell/src/UScreen.cpp 2012-02-04 05:28:23 +0000 |
533 | +++ plugins/unityshell/src/UScreen.cpp 2012-03-13 03:12:20 +0000 |
534 | @@ -119,8 +119,7 @@ |
535 | |
536 | g_print("\nScreen geometry changed:\n"); |
537 | |
538 | - int lowest_x = std::numeric_limits<int>::max(); |
539 | - int highest_y = std::numeric_limits<int>::min(); |
540 | + primary_ = gdk_screen_get_primary_monitor(screen); |
541 | for (int i = 0; i < gdk_screen_get_n_monitors(screen); i++) |
542 | { |
543 | GdkRectangle rect = { 0 }; |
544 | @@ -136,13 +135,6 @@ |
545 | |
546 | _monitors.push_back(geo); |
547 | |
548 | - if (geo.x < lowest_x || (geo.x == lowest_x && geo.y > highest_y)) |
549 | - { |
550 | - lowest_x = geo.x; |
551 | - highest_y = geo.y; |
552 | - primary_ = i; |
553 | - } |
554 | - |
555 | g_print(" %dx%dx%dx%d\n", geo.x, geo.y, geo.width, geo.height); |
556 | } |
557 | |
558 | |
559 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
560 | --- plugins/unityshell/src/unityshell.cpp 2012-03-13 00:35:02 +0000 |
561 | +++ plugins/unityshell/src/unityshell.cpp 2012-03-13 03:12:20 +0000 |
562 | @@ -337,6 +337,9 @@ |
563 | optionSetDecayRateNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
564 | optionSetShowMinimizedWindowsNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
565 | |
566 | + optionSetNumLaunchersNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
567 | + optionSetLauncherCaptureMouseNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
568 | + |
569 | ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV, |
570 | sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav)); |
571 | |
572 | @@ -2452,6 +2455,13 @@ |
573 | unity::launcher::Options::Ptr launcher_options = launcher_controller_->options(); |
574 | switch (num) |
575 | { |
576 | + case UnityshellOptions::NumLaunchers: |
577 | + launcher_controller_->multiple_launchers = optionGetNumLaunchers() == 0; |
578 | + dash_controller_->use_primary = !launcher_controller_->multiple_launchers(); |
579 | + break; |
580 | + case UnityshellOptions::LauncherCaptureMouse: |
581 | + launcher_options->edge_resist = optionGetLauncherCaptureMouse(); |
582 | + break; |
583 | case UnityshellOptions::BackgroundColor: |
584 | { |
585 | nux::Color override_color (optionGetBackgroundColorRed() / 65535.0f, |
586 | |
587 | === modified file 'plugins/unityshell/unityshell.xml.in' |
588 | --- plugins/unityshell/unityshell.xml.in 2012-03-12 18:26:30 +0000 |
589 | +++ plugins/unityshell/unityshell.xml.in 2012-03-13 03:12:20 +0000 |
590 | @@ -453,6 +453,27 @@ |
591 | <default>300</default> |
592 | </option> |
593 | |
594 | + <option name="num_launchers" type="int"> |
595 | + <_short>Launcher Monitors</_short> |
596 | + <_long>Monitors on which launchers will be displayed</_long> |
597 | + <min>0</min> |
598 | + <max>1</max> |
599 | + <default>0</default> |
600 | + <desc> |
601 | + <value>0</value> |
602 | + <_name>All Desktops</_name> |
603 | + </desc> |
604 | + <desc> |
605 | + <value>1</value> |
606 | + <_name>Primary Desktop</_name> |
607 | + </desc> |
608 | + </option> |
609 | + |
610 | + <option name="launcher_capture_mouse" type="bool"> |
611 | + <_short>Launcher Capture Mouse</_short> |
612 | + <_long>Determines if the launcher edges should capture the mouse</_long> |
613 | + <default>true</default> |
614 | + </option> |
615 | </group> |
616 | </options> |
617 | </plugin> |
You hit my rule of three, same code in three places should be a simple method:
int get_monitor(bool use_primary) :GetDefault( ); >GetPrimaryMoni tor(); >GetMonitorWith Mouse() ;
{
UScreen *uscreen = UScreen:
if (use_primary)
return uscreen-
else
return uscreen-
}
// ... then >GetMonitorGeom etry(get_ monitor( use_primary) );
auto monitor_geo = uscreen-