Merge lp:~3v1n0/unity/dynamic-app-spread into lp:unity
- dynamic-app-spread
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4046 |
Proposed branch: | lp:~3v1n0/unity/dynamic-app-spread |
Merge into: | lp:unity |
Diff against target: |
301 lines (+71/-28) 5 files modified
launcher/ApplicationLauncherIcon.cpp (+20/-13) unity-shared/PluginAdapter.cpp (+22/-5) unity-shared/PluginAdapter.h (+3/-0) unity-shared/SpreadFilter.cpp (+23/-10) unity-shared/SpreadFilter.h (+3/-0) |
To merge this branch: | bzr merge lp:~3v1n0/unity/dynamic-app-spread |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+277873@code.launchpad.net |
Commit message
ApplicationLaun
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:4041
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:4041
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:4041
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'launcher/ApplicationLauncherIcon.cpp' | |||
2 | --- launcher/ApplicationLauncherIcon.cpp 2015-10-27 19:21:27 +0000 | |||
3 | +++ launcher/ApplicationLauncherIcon.cpp 2015-11-18 16:34:03 +0000 | |||
4 | @@ -157,6 +157,9 @@ | |||
5 | 157 | signals_conn_.Add(app_->window_opened.connect([this](ApplicationWindowPtr const& win) { | 157 | signals_conn_.Add(app_->window_opened.connect([this](ApplicationWindowPtr const& win) { |
6 | 158 | signals_conn_.Add(win->monitor.changed.connect([this] (int) { EnsureWindowsLocation(); })); | 158 | signals_conn_.Add(win->monitor.changed.connect([this] (int) { EnsureWindowsLocation(); })); |
7 | 159 | EnsureWindowsLocation(); | 159 | EnsureWindowsLocation(); |
8 | 160 | |||
9 | 161 | if (WindowManager::Default().IsScaleActiveForGroup() && IsActive()) | ||
10 | 162 | Spread(true, 0, false); | ||
11 | 160 | })); | 163 | })); |
12 | 161 | 164 | ||
13 | 162 | auto ensure_win_location_cb = sigc::hide(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowsLocation)); | 165 | auto ensure_win_location_cb = sigc::hide(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowsLocation)); |
14 | @@ -291,12 +294,7 @@ | |||
15 | 291 | return; | 294 | return; |
16 | 292 | } | 295 | } |
17 | 293 | 296 | ||
24 | 294 | bool scaleWasActive = wm.IsScaleActive(); | 297 | bool scale_was_active = wm.IsScaleActive(); |
19 | 295 | if (scaleWasActive) | ||
20 | 296 | { | ||
21 | 297 | wm.TerminateScale(); | ||
22 | 298 | } | ||
23 | 299 | |||
25 | 300 | bool active = IsActive(); | 298 | bool active = IsActive(); |
26 | 301 | bool user_visible = IsRunning(); | 299 | bool user_visible = IsRunning(); |
27 | 302 | /* We should check each child to see if there is | 300 | /* We should check each child to see if there is |
28 | @@ -389,6 +387,7 @@ | |||
29 | 389 | if (GetQuirk(Quirk::STARTING, arg.monitor)) | 387 | if (GetQuirk(Quirk::STARTING, arg.monitor)) |
30 | 390 | return; | 388 | return; |
31 | 391 | 389 | ||
32 | 390 | wm.TerminateScale(); | ||
33 | 392 | SetQuirk(Quirk::STARTING, true, arg.monitor); | 391 | SetQuirk(Quirk::STARTING, true, arg.monitor); |
34 | 393 | OpenInstanceLauncherIcon(arg.timestamp); | 392 | OpenInstanceLauncherIcon(arg.timestamp); |
35 | 394 | } | 393 | } |
36 | @@ -396,8 +395,10 @@ | |||
37 | 396 | { | 395 | { |
38 | 397 | if (active) | 396 | if (active) |
39 | 398 | { | 397 | { |
41 | 399 | if (scaleWasActive) // #5 above | 398 | if (scale_was_active) // #5 above |
42 | 400 | { | 399 | { |
43 | 400 | wm.TerminateScale(); | ||
44 | 401 | |||
45 | 401 | if (minimize_window_on_click()) | 402 | if (minimize_window_on_click()) |
46 | 402 | { | 403 | { |
47 | 403 | for (auto const& win : GetWindows(WindowFilter::ON_CURRENT_DESKTOP)) | 404 | for (auto const& win : GetWindows(WindowFilter::ON_CURRENT_DESKTOP)) |
48 | @@ -414,7 +415,7 @@ | |||
49 | 414 | { | 415 | { |
50 | 415 | bool minimized = false; | 416 | bool minimized = false; |
51 | 416 | 417 | ||
53 | 417 | if (minimize_window_on_click) | 418 | if (minimize_window_on_click()) |
54 | 418 | { | 419 | { |
55 | 419 | WindowList const& windows = GetWindows(WindowFilter::ON_CURRENT_DESKTOP); | 420 | WindowList const& windows = GetWindows(WindowFilter::ON_CURRENT_DESKTOP); |
56 | 420 | 421 | ||
57 | @@ -434,9 +435,13 @@ | |||
58 | 434 | } | 435 | } |
59 | 435 | else | 436 | else |
60 | 436 | { | 437 | { |
62 | 437 | if (scaleWasActive) // #4 above | 438 | if (scale_was_active) // #4 above |
63 | 438 | { | 439 | { |
64 | 440 | if (GetWindows(WindowFilter::ON_CURRENT_DESKTOP).size() <= 1) | ||
65 | 441 | wm.TerminateScale(); | ||
66 | 442 | |||
67 | 439 | Focus(arg); | 443 | Focus(arg); |
68 | 444 | |||
69 | 440 | if (arg.source != ActionArg::Source::SWITCHER) | 445 | if (arg.source != ActionArg::Source::SWITCHER) |
70 | 441 | Spread(true, 0, false); | 446 | Spread(true, 0, false); |
71 | 442 | } | 447 | } |
72 | @@ -704,9 +709,8 @@ | |||
73 | 704 | { | 709 | { |
74 | 705 | std::vector<Window> windows; | 710 | std::vector<Window> windows; |
75 | 706 | for (auto& window : GetWindows(current_desktop ? WindowFilter::ON_CURRENT_DESKTOP : 0)) | 711 | for (auto& window : GetWindows(current_desktop ? WindowFilter::ON_CURRENT_DESKTOP : 0)) |
76 | 707 | { | ||
77 | 708 | windows.push_back(window->window_id()); | 712 | windows.push_back(window->window_id()); |
79 | 709 | } | 713 | |
80 | 710 | return WindowManager::Default().ScaleWindowGroup(windows, state, force); | 714 | return WindowManager::Default().ScaleWindowGroup(windows, state, force); |
81 | 711 | } | 715 | } |
82 | 712 | 716 | ||
83 | @@ -1171,7 +1175,10 @@ | |||
84 | 1171 | auto timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp; | 1175 | auto timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp; |
85 | 1172 | 1176 | ||
86 | 1173 | _source_manager.AddTimeout(1000, [this, timestamp] { | 1177 | _source_manager.AddTimeout(1000, [this, timestamp] { |
88 | 1174 | WindowManager::Default().TerminateScale(); | 1178 | bool to_spread = GetWindows(WindowFilter::ON_CURRENT_DESKTOP).size() > 1; |
89 | 1179 | |||
90 | 1180 | if (!to_spread) | ||
91 | 1181 | WindowManager::Default().TerminateScale(); | ||
92 | 1175 | 1182 | ||
93 | 1176 | if (!IsRunning()) | 1183 | if (!IsRunning()) |
94 | 1177 | return false; | 1184 | return false; |
95 | @@ -1179,7 +1186,7 @@ | |||
96 | 1179 | UBusManager::SendMessage(UBUS_OVERLAY_CLOSE_REQUEST); | 1186 | UBusManager::SendMessage(UBUS_OVERLAY_CLOSE_REQUEST); |
97 | 1180 | Focus(ActionArg(ActionArg::Source::LAUNCHER, 1, timestamp)); | 1187 | Focus(ActionArg(ActionArg::Source::LAUNCHER, 1, timestamp)); |
98 | 1181 | 1188 | ||
100 | 1182 | if (GetWindows(WindowFilter::ON_CURRENT_DESKTOP).size() > 1) | 1189 | if (to_spread) |
101 | 1183 | Spread(true, COMPIZ_SCALE_DND_SPREAD, false); | 1190 | Spread(true, COMPIZ_SCALE_DND_SPREAD, false); |
102 | 1184 | 1191 | ||
103 | 1185 | return false; | 1192 | return false; |
104 | 1186 | 1193 | ||
105 | === modified file 'unity-shared/PluginAdapter.cpp' | |||
106 | --- unity-shared/PluginAdapter.cpp 2015-10-21 14:28:00 +0000 | |||
107 | +++ unity-shared/PluginAdapter.cpp 2015-11-18 16:34:03 +0000 | |||
108 | @@ -72,8 +72,10 @@ | |||
109 | 72 | PluginAdapter::PluginAdapter(CompScreen* screen) | 72 | PluginAdapter::PluginAdapter(CompScreen* screen) |
110 | 73 | : bias_active_to_viewport(false) | 73 | : bias_active_to_viewport(false) |
111 | 74 | , m_Screen(screen) | 74 | , m_Screen(screen) |
112 | 75 | , _scale_screen(ScaleScreen::get(screen)) | ||
113 | 75 | , _coverage_area_before_automaximize(0.75) | 76 | , _coverage_area_before_automaximize(0.75) |
114 | 76 | , _spread_state(false) | 77 | , _spread_state(false) |
115 | 78 | , _spread_requested_state(false) | ||
116 | 77 | , _spread_windows_state(false) | 79 | , _spread_windows_state(false) |
117 | 78 | , _expo_state(false) | 80 | , _expo_state(false) |
118 | 79 | , _vp_switch_started(false) | 81 | , _vp_switch_started(false) |
119 | @@ -95,6 +97,7 @@ | |||
120 | 95 | if (!_spread_state && screen->grabExist("scale")) | 97 | if (!_spread_state && screen->grabExist("scale")) |
121 | 96 | { | 98 | { |
122 | 97 | _spread_state = true; | 99 | _spread_state = true; |
123 | 100 | _spread_requested_state = true; | ||
124 | 98 | initiate_spread.emit(); | 101 | initiate_spread.emit(); |
125 | 99 | } | 102 | } |
126 | 100 | 103 | ||
127 | @@ -110,6 +113,7 @@ | |||
128 | 110 | if (_spread_state && !screen->grabExist("scale")) | 113 | if (_spread_state && !screen->grabExist("scale")) |
129 | 111 | { | 114 | { |
130 | 112 | _spread_state = false; | 115 | _spread_state = false; |
131 | 116 | _spread_requested_state = false; | ||
132 | 113 | _spread_windows_state = false; | 117 | _spread_windows_state = false; |
133 | 114 | terminate_spread.emit(); | 118 | terminate_spread.emit(); |
134 | 115 | } | 119 | } |
135 | @@ -216,6 +220,7 @@ | |||
136 | 216 | if (_spread_state != new_state) | 220 | if (_spread_state != new_state) |
137 | 217 | { | 221 | { |
138 | 218 | _spread_state = new_state; | 222 | _spread_state = new_state; |
139 | 223 | _spread_requested_state = new_state; | ||
140 | 219 | _spread_state ? initiate_spread.emit() : terminate_spread.emit(); | 224 | _spread_state ? initiate_spread.emit() : terminate_spread.emit(); |
141 | 220 | 225 | ||
142 | 221 | if (!_spread_state) | 226 | if (!_spread_state) |
143 | @@ -230,10 +235,12 @@ | |||
144 | 230 | 235 | ||
145 | 231 | bool old_windows_state = _spread_windows_state; | 236 | bool old_windows_state = _spread_windows_state; |
146 | 232 | _spread_state = false; | 237 | _spread_state = false; |
147 | 238 | _spread_requested_state = false; | ||
148 | 233 | _spread_windows_state = false; | 239 | _spread_windows_state = false; |
149 | 234 | terminate_spread.emit(); | 240 | terminate_spread.emit(); |
150 | 235 | 241 | ||
151 | 236 | _spread_state = true; | 242 | _spread_state = true; |
152 | 243 | _spread_requested_state = true; | ||
153 | 237 | _spread_windows_state = old_windows_state; | 244 | _spread_windows_state = old_windows_state; |
154 | 238 | initiate_spread.emit(); | 245 | initiate_spread.emit(); |
155 | 239 | } | 246 | } |
156 | @@ -391,16 +398,26 @@ | |||
157 | 391 | 398 | ||
158 | 392 | void PluginAdapter::InitiateScale(std::string const& match, int state) | 399 | void PluginAdapter::InitiateScale(std::string const& match, int state) |
159 | 393 | { | 400 | { |
165 | 394 | CompOption::Vector argument(1); | 401 | if (!_spread_requested_state || !_scale_screen) |
166 | 395 | argument[0].setName("match", CompOption::TypeMatch); | 402 | { |
167 | 396 | argument[0].value().set(CompMatch(match)); | 403 | _spread_requested_state = true; |
168 | 397 | 404 | CompOption::Vector argument(1); | |
169 | 398 | m_ScaleActionList.InitiateAll(argument, state); | 405 | argument[0].setName("match", CompOption::TypeMatch); |
170 | 406 | argument[0].value().set(CompMatch(match)); | ||
171 | 407 | m_ScaleActionList.InitiateAll(argument, state); | ||
172 | 408 | } | ||
173 | 409 | else | ||
174 | 410 | { | ||
175 | 411 | terminate_spread.emit(); | ||
176 | 412 | _scale_screen->relayoutSlots(CompMatch(match)); | ||
177 | 413 | initiate_spread.emit(); | ||
178 | 414 | } | ||
179 | 399 | } | 415 | } |
180 | 400 | 416 | ||
181 | 401 | void PluginAdapter::TerminateScale() | 417 | void PluginAdapter::TerminateScale() |
182 | 402 | { | 418 | { |
183 | 403 | m_ScaleActionList.TerminateAll(); | 419 | m_ScaleActionList.TerminateAll(); |
184 | 420 | _spread_requested_state = false; | ||
185 | 404 | } | 421 | } |
186 | 405 | 422 | ||
187 | 406 | bool PluginAdapter::IsScaleActive() const | 423 | bool PluginAdapter::IsScaleActive() const |
188 | 407 | 424 | ||
189 | === modified file 'unity-shared/PluginAdapter.h' | |||
190 | --- unity-shared/PluginAdapter.h 2015-10-21 14:28:00 +0000 | |||
191 | +++ unity-shared/PluginAdapter.h 2015-11-18 16:34:03 +0000 | |||
192 | @@ -23,6 +23,7 @@ | |||
193 | 23 | /* Compiz */ | 23 | /* Compiz */ |
194 | 24 | #include <core/core.h> | 24 | #include <core/core.h> |
195 | 25 | #include <core/atoms.h> | 25 | #include <core/atoms.h> |
196 | 26 | #include <scale/scale.h> | ||
197 | 26 | 27 | ||
198 | 27 | #include <NuxCore/Property.h> | 28 | #include <NuxCore/Property.h> |
199 | 28 | 29 | ||
200 | @@ -214,11 +215,13 @@ | |||
201 | 214 | bool IsCurrentViewportEmpty() const; | 215 | bool IsCurrentViewportEmpty() const; |
202 | 215 | 216 | ||
203 | 216 | CompScreen* m_Screen; | 217 | CompScreen* m_Screen; |
204 | 218 | ScaleScreen* _scale_screen; | ||
205 | 217 | MultiActionList m_ExpoActionList; | 219 | MultiActionList m_ExpoActionList; |
206 | 218 | MultiActionList m_ScaleActionList; | 220 | MultiActionList m_ScaleActionList; |
207 | 219 | 221 | ||
208 | 220 | float _coverage_area_before_automaximize; | 222 | float _coverage_area_before_automaximize; |
209 | 221 | bool _spread_state; | 223 | bool _spread_state; |
210 | 224 | bool _spread_requested_state; | ||
211 | 222 | bool _spread_windows_state; | 225 | bool _spread_windows_state; |
212 | 223 | bool _expo_state; | 226 | bool _expo_state; |
213 | 224 | bool _vp_switch_started; | 227 | bool _vp_switch_started; |
214 | 225 | 228 | ||
215 | === modified file 'unity-shared/SpreadFilter.cpp' | |||
216 | --- unity-shared/SpreadFilter.cpp 2015-04-07 22:29:54 +0000 | |||
217 | +++ unity-shared/SpreadFilter.cpp 2015-11-18 16:34:03 +0000 | |||
218 | @@ -106,6 +106,8 @@ | |||
219 | 106 | search_bar_->SetSearchFinished(); | 106 | search_bar_->SetSearchFinished(); |
220 | 107 | } | 107 | } |
221 | 108 | }); | 108 | }); |
222 | 109 | |||
223 | 110 | ApplicationManager::Default().window_opened.connect(sigc::hide(sigc::mem_fun(this, &Filter::OnWindowChanged))); | ||
224 | 109 | } | 111 | } |
225 | 110 | 112 | ||
226 | 111 | bool Filter::Visible() const | 113 | bool Filter::Visible() const |
227 | @@ -127,26 +129,37 @@ | |||
228 | 127 | { | 129 | { |
229 | 128 | auto const& lower_search = casefold_copy(text()); | 130 | auto const& lower_search = casefold_copy(text()); |
230 | 129 | filtered_windows_.clear(); | 131 | filtered_windows_.clear(); |
231 | 132 | title_connections_.Clear(); | ||
232 | 130 | 133 | ||
233 | 131 | if (lower_search.empty()) | 134 | if (lower_search.empty()) |
234 | 132 | return; | 135 | return; |
235 | 133 | 136 | ||
236 | 137 | auto update_cb = sigc::hide(sigc::mem_fun(this, &Filter::OnWindowChanged)); | ||
237 | 138 | |||
238 | 134 | for (auto const& app : ApplicationManager::Default().GetRunningApplications()) | 139 | for (auto const& app : ApplicationManager::Default().GetRunningApplications()) |
239 | 135 | { | 140 | { |
240 | 141 | title_connections_.Add(app->title.changed.connect(update_cb)); | ||
241 | 142 | |||
242 | 136 | if (casefold_copy(app->title()).find(lower_search) != std::string::npos) | 143 | if (casefold_copy(app->title()).find(lower_search) != std::string::npos) |
243 | 137 | { | 144 | { |
244 | 138 | for (auto const& win : app->GetWindows()) | 145 | for (auto const& win : app->GetWindows()) |
245 | 139 | filtered_windows_.insert(win->window_id()); | 146 | filtered_windows_.insert(win->window_id()); |
256 | 140 | 147 | } | |
257 | 141 | continue; | 148 | } |
258 | 142 | } | 149 | |
259 | 143 | 150 | for (auto const& win : ApplicationManager::Default().GetWindowsForMonitor(-1)) | |
260 | 144 | for (auto const& win : app->GetWindows()) | 151 | { |
261 | 145 | { | 152 | title_connections_.Add(win->title.changed.connect(update_cb)); |
262 | 146 | if (casefold_copy(win->title()).find(lower_search) != std::string::npos) | 153 | |
263 | 147 | filtered_windows_.insert(win->window_id()); | 154 | if (casefold_copy(win->title()).find(lower_search) != std::string::npos) |
264 | 148 | } | 155 | filtered_windows_.insert(win->window_id()); |
265 | 149 | } | 156 | } |
266 | 157 | } | ||
267 | 158 | |||
268 | 159 | void Filter::OnWindowChanged() | ||
269 | 160 | { | ||
270 | 161 | UpdateFilteredWindows(); | ||
271 | 162 | text.changed.emit(text); | ||
272 | 150 | } | 163 | } |
273 | 151 | 164 | ||
274 | 152 | // | 165 | // |
275 | 153 | 166 | ||
276 | === modified file 'unity-shared/SpreadFilter.h' | |||
277 | --- unity-shared/SpreadFilter.h 2015-04-07 22:29:54 +0000 | |||
278 | +++ unity-shared/SpreadFilter.h 2015-11-18 16:34:03 +0000 | |||
279 | @@ -25,6 +25,7 @@ | |||
280 | 25 | #include <Nux/Nux.h> | 25 | #include <Nux/Nux.h> |
281 | 26 | #include <Nux/BaseWindow.h> | 26 | #include <Nux/BaseWindow.h> |
282 | 27 | #include <NuxCore/Animation.h> | 27 | #include <NuxCore/Animation.h> |
283 | 28 | #include <UnityCore/ConnectionManager.h> | ||
284 | 28 | #include "Introspectable.h" | 29 | #include "Introspectable.h" |
285 | 29 | 30 | ||
286 | 30 | namespace unity | 31 | namespace unity |
287 | @@ -54,12 +55,14 @@ | |||
288 | 54 | void AddProperties(debug::IntrospectionData&); | 55 | void AddProperties(debug::IntrospectionData&); |
289 | 55 | 56 | ||
290 | 56 | private: | 57 | private: |
291 | 58 | void OnWindowChanged(); | ||
292 | 57 | void UpdateFilteredWindows(); | 59 | void UpdateFilteredWindows(); |
293 | 58 | 60 | ||
294 | 59 | nux::ObjectPtr<SearchBar> search_bar_; | 61 | nux::ObjectPtr<SearchBar> search_bar_; |
295 | 60 | nux::ObjectPtr<nux::BaseWindow> view_window_; | 62 | nux::ObjectPtr<nux::BaseWindow> view_window_; |
296 | 61 | nux::animation::AnimateValue<double> fade_animator_; | 63 | nux::animation::AnimateValue<double> fade_animator_; |
297 | 62 | std::set<uint64_t> filtered_windows_; | 64 | std::set<uint64_t> filtered_windows_; |
298 | 65 | connection::Manager title_connections_; | ||
299 | 63 | }; | 66 | }; |
300 | 64 | 67 | ||
301 | 65 | } // namespace spread | 68 | } // namespace spread |
PASSED: Continuous integration, rev:4041 jenkins. qa.ubuntu. com/job/ unity-ci/ 1354/ jenkins. qa.ubuntu. com/job/ unity-xenial- amd64-ci/ 6 jenkins. qa.ubuntu. com/job/ unity-xenial- armhf-ci/ 6 jenkins. qa.ubuntu. com/job/ unity-xenial- i386-ci/ 6
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- ci/1354/ rebuild
http://