Merge lp:~laney/unity/xpathselect-v5 into lp:unity
- xpathselect-v5
- Merge into trunk
Proposed by
Iain Lane
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3998 |
Proposed branch: | lp:~laney/unity/xpathselect-v5 |
Merge into: | lp:unity |
Diff against target: |
2309 lines (+508/-512) 45 files modified
dash/DashView.cpp (+34/-0) dash/DashView.h (+2/-0) dash/PlacesGroup.cpp (+21/-7) dash/PlacesGroup.h (+2/-0) dash/ResultViewGrid.cpp (+6/-6) debian/changelog (+29/-0) debian/control (+1/-1) decorations/DecoratedWindow.cpp (+5/-0) decorations/DecoratedWindow.h (+1/-0) decorations/DecorationsForceQuitDialog.cpp (+8/-0) decorations/DecorationsManager.cpp (+5/-1) launcher/ApplicationLauncherIcon.cpp (+19/-26) launcher/ApplicationLauncherIcon.h (+1/-1) launcher/Launcher.cpp (+7/-1) panel/PanelMenuView.cpp (+15/-0) panel/PanelMenuView.h (+1/-0) shutdown/SessionButton.cpp (+7/-0) shutdown/SessionButton.h (+1/-0) shutdown/SessionView.cpp (+1/-1) tests/autopilot/unity/emulators/__init__.py (+24/-0) tests/autopilot/unity/emulators/dash.py (+26/-67) tests/autopilot/unity/emulators/hud.py (+2/-2) tests/autopilot/unity/emulators/icons.py (+2/-9) tests/autopilot/unity/emulators/launcher.py (+3/-7) tests/autopilot/unity/emulators/panel.py (+35/-45) tests/autopilot/unity/emulators/quicklist.py (+6/-9) tests/autopilot/unity/emulators/screen.py (+5/-4) tests/autopilot/unity/emulators/window_manager.py (+3/-2) tests/autopilot/unity/tests/launcher/test_icon_behavior.py (+1/-1) tests/autopilot/unity/tests/launcher/test_visual.py (+1/-3) tests/autopilot/unity/tests/test_dash.py (+59/-200) tests/autopilot/unity/tests/test_panel.py (+12/-16) tests/autopilot/unity/tests/test_quicklist.py (+3/-3) tests/autopilot/unity/tests/test_spread.py (+5/-16) tests/autopilot/unity/tests/test_switcher.py (+5/-6) tests/bamf-mock-application.c (+16/-2) tests/mock-application.h (+3/-4) tests/test_bamf_application.cpp (+3/-2) unity-shared/ApplicationManager.h (+3/-2) unity-shared/BamfApplicationManager.cpp (+82/-38) unity-shared/BamfApplicationManager.h (+10/-9) unity-shared/IconTexture.cpp (+3/-1) unity-shared/PluginAdapter.cpp (+4/-0) unity-shared/StandaloneAppManager.cpp (+18/-12) unity-shared/WindowButtons.cpp (+8/-8) |
To merge this branch: | bzr merge lp:~laney/unity/xpathselect-v5 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
Review via email:
|
Commit message
Depend on v5-renamed xpathselect package
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'dash/DashView.cpp' | |||
2 | --- dash/DashView.cpp 2015-05-22 13:21:01 +0000 | |||
3 | +++ dash/DashView.cpp 2015-08-24 17:01:53 +0000 | |||
4 | @@ -1547,6 +1547,32 @@ | |||
5 | 1547 | ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST); | 1547 | ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST); |
6 | 1548 | } | 1548 | } |
7 | 1549 | 1549 | ||
8 | 1550 | nux::Area* DashView::SkipUnexpandableHeaderKeyNav() | ||
9 | 1551 | { | ||
10 | 1552 | PlacesGroup::Ptr prev_view; | ||
11 | 1553 | auto category_views = active_scope_view_->GetOrderedCategoryViews(); | ||
12 | 1554 | |||
13 | 1555 | for (auto category : category_views) | ||
14 | 1556 | { | ||
15 | 1557 | if (category->GetLayout() != nullptr) | ||
16 | 1558 | { | ||
17 | 1559 | auto header = category->GetHeaderFocusableView(); | ||
18 | 1560 | if (header && header->HasKeyFocus() && !category->IsExpandable()) | ||
19 | 1561 | { | ||
20 | 1562 | if (prev_view) | ||
21 | 1563 | return prev_view->GetChildView(); | ||
22 | 1564 | else | ||
23 | 1565 | return search_bar_->text_entry(); | ||
24 | 1566 | } | ||
25 | 1567 | |||
26 | 1568 | if (category->IsVisible()) | ||
27 | 1569 | prev_view = category; | ||
28 | 1570 | } | ||
29 | 1571 | } | ||
30 | 1572 | |||
31 | 1573 | return nullptr; | ||
32 | 1574 | } | ||
33 | 1575 | |||
34 | 1550 | nux::Area* DashView::FindKeyFocusArea(unsigned int key_symbol, | 1576 | nux::Area* DashView::FindKeyFocusArea(unsigned int key_symbol, |
35 | 1551 | unsigned long x11_key_code, | 1577 | unsigned long x11_key_code, |
36 | 1552 | unsigned long special_keys_state) | 1578 | unsigned long special_keys_state) |
37 | @@ -1698,6 +1724,14 @@ | |||
38 | 1698 | } | 1724 | } |
39 | 1699 | } | 1725 | } |
40 | 1700 | 1726 | ||
41 | 1727 | if (direction == KEY_NAV_UP) | ||
42 | 1728 | { | ||
43 | 1729 | if (auto skip_view = SkipUnexpandableHeaderKeyNav()) | ||
44 | 1730 | { | ||
45 | 1731 | return skip_view; | ||
46 | 1732 | } | ||
47 | 1733 | } | ||
48 | 1734 | |||
49 | 1701 | bool search_key = false; | 1735 | bool search_key = false; |
50 | 1702 | 1736 | ||
51 | 1703 | if (direction == KEY_NAV_NONE) | 1737 | if (direction == KEY_NAV_NONE) |
52 | 1704 | 1738 | ||
53 | === modified file 'dash/DashView.h' | |||
54 | --- dash/DashView.h 2015-04-24 12:59:57 +0000 | |||
55 | +++ dash/DashView.h 2015-08-24 17:01:53 +0000 | |||
56 | @@ -137,6 +137,8 @@ | |||
57 | 137 | 137 | ||
58 | 138 | nux::Area* KeyNavIteration(nux::KeyNavDirection direction); | 138 | nux::Area* KeyNavIteration(nux::KeyNavDirection direction); |
59 | 139 | 139 | ||
60 | 140 | nux::Area* SkipUnexpandableHeaderKeyNav(); | ||
61 | 141 | |||
62 | 140 | UBusManager ubus_manager_; | 142 | UBusManager ubus_manager_; |
63 | 141 | Scopes::Ptr scopes_; | 143 | Scopes::Ptr scopes_; |
64 | 142 | ScopeViews scope_views_; | 144 | ScopeViews scope_views_; |
65 | 143 | 145 | ||
66 | === modified file 'dash/PlacesGroup.cpp' | |||
67 | --- dash/PlacesGroup.cpp 2014-07-10 16:39:12 +0000 | |||
68 | +++ dash/PlacesGroup.cpp 2015-08-24 17:01:53 +0000 | |||
69 | @@ -212,7 +212,12 @@ | |||
70 | 212 | if(direction == nux::KEY_NAV_UP) | 212 | if(direction == nux::KEY_NAV_UP) |
71 | 213 | nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction); | 213 | nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction); |
72 | 214 | else | 214 | else |
74 | 215 | nux::GetWindowCompositor().SetKeyFocusArea(GetHeaderFocusableView(), direction); | 215 | { |
75 | 216 | if (IsExpandable()) | ||
76 | 217 | nux::GetWindowCompositor().SetKeyFocusArea(GetHeaderFocusableView(), direction); | ||
77 | 218 | else | ||
78 | 219 | nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction); | ||
79 | 220 | } | ||
80 | 216 | }); | 221 | }); |
81 | 217 | 222 | ||
82 | 218 | UpdatePlacesGroupSize(); | 223 | UpdatePlacesGroupSize(); |
83 | @@ -343,15 +348,18 @@ | |||
84 | 343 | UpdateResultViewPadding(); | 348 | UpdateResultViewPadding(); |
85 | 344 | _group_layout->AddLayout(_child_layout, 1); | 349 | _group_layout->AddLayout(_child_layout, 1); |
86 | 345 | 350 | ||
92 | 346 | view->results_per_row.changed.connect([this] (int results_per_row) | 351 | UpdateVisibleItems(view->results_per_row()); |
93 | 347 | { | 352 | view->results_per_row.changed.connect(sigc::mem_fun(this, &PlacesGroup::UpdateVisibleItems)); |
89 | 348 | _n_visible_items_in_unexpand_mode = results_per_row; | ||
90 | 349 | RefreshLabel(); | ||
91 | 350 | }); | ||
94 | 351 | 353 | ||
95 | 352 | QueueDraw(); | 354 | QueueDraw(); |
96 | 353 | } | 355 | } |
97 | 354 | 356 | ||
98 | 357 | void PlacesGroup::UpdateVisibleItems(int visible_items) | ||
99 | 358 | { | ||
100 | 359 | _n_visible_items_in_unexpand_mode = visible_items; | ||
101 | 360 | RefreshLabel(); | ||
102 | 361 | } | ||
103 | 362 | |||
104 | 355 | dash::ResultView* | 363 | dash::ResultView* |
105 | 356 | PlacesGroup::GetChildView() | 364 | PlacesGroup::GetChildView() |
106 | 357 | { | 365 | { |
107 | @@ -567,6 +575,12 @@ | |||
108 | 567 | } | 575 | } |
109 | 568 | 576 | ||
110 | 569 | bool | 577 | bool |
111 | 578 | PlacesGroup::IsExpandable() const | ||
112 | 579 | { | ||
113 | 580 | return (_n_visible_items_in_unexpand_mode < _n_total_items); | ||
114 | 581 | } | ||
115 | 582 | |||
116 | 583 | bool | ||
117 | 570 | PlacesGroup::GetExpanded() const | 584 | PlacesGroup::GetExpanded() const |
118 | 571 | { | 585 | { |
119 | 572 | return _is_expanded; | 586 | return _is_expanded; |
120 | @@ -649,7 +663,7 @@ | |||
121 | 649 | 663 | ||
122 | 650 | bool PlacesGroup::ShouldBeHighlighted() const | 664 | bool PlacesGroup::ShouldBeHighlighted() const |
123 | 651 | { | 665 | { |
125 | 652 | return HeaderHasKeyFocus(); | 666 | return (HeaderHasKeyFocus() && IsExpandable()); |
126 | 653 | } | 667 | } |
127 | 654 | 668 | ||
128 | 655 | void PlacesGroup::SetResultsPreviewAnimationValue(float preview_animation) | 669 | void PlacesGroup::SetResultsPreviewAnimationValue(float preview_animation) |
129 | 656 | 670 | ||
130 | === modified file 'dash/PlacesGroup.h' | |||
131 | --- dash/PlacesGroup.h 2014-03-20 04:05:39 +0000 | |||
132 | +++ dash/PlacesGroup.h 2015-08-24 17:01:53 +0000 | |||
133 | @@ -77,6 +77,7 @@ | |||
134 | 77 | 77 | ||
135 | 78 | void SetCounts(unsigned n_total_items); | 78 | void SetCounts(unsigned n_total_items); |
136 | 79 | 79 | ||
137 | 80 | virtual bool IsExpandable() const; | ||
138 | 80 | virtual void SetExpanded(bool is_expanded); | 81 | virtual void SetExpanded(bool is_expanded); |
139 | 81 | virtual bool GetExpanded() const; | 82 | virtual bool GetExpanded() const; |
140 | 82 | 83 | ||
141 | @@ -127,6 +128,7 @@ | |||
142 | 127 | void UpdatePlacesGroupSize(); | 128 | void UpdatePlacesGroupSize(); |
143 | 128 | void UpdateResultViewPadding(); | 129 | void UpdateResultViewPadding(); |
144 | 129 | void UpdateScale(double scale); | 130 | void UpdateScale(double scale); |
145 | 131 | void UpdateVisibleItems(int visible_items); | ||
146 | 130 | 132 | ||
147 | 131 | private: | 133 | private: |
148 | 132 | std::string _category_id; | 134 | std::string _category_id; |
149 | 133 | 135 | ||
150 | === modified file 'dash/ResultViewGrid.cpp' | |||
151 | --- dash/ResultViewGrid.cpp 2015-05-22 13:20:52 +0000 | |||
152 | +++ dash/ResultViewGrid.cpp 2015-08-24 17:01:53 +0000 | |||
153 | @@ -85,11 +85,11 @@ | |||
154 | 85 | EnableDoubleClick(true); | 85 | EnableDoubleClick(true); |
155 | 86 | SetAcceptKeyNavFocusOnMouseDown(false); | 86 | SetAcceptKeyNavFocusOnMouseDown(false); |
156 | 87 | 87 | ||
162 | 88 | auto needredraw_lambda = [this](int value) { NeedRedraw(); }; | 88 | auto queue_draw_cb = sigc::hide(sigc::mem_fun(this, &ResultViewGrid::QueueDraw)); |
163 | 89 | horizontal_spacing.changed.connect(needredraw_lambda); | 89 | horizontal_spacing.changed.connect(queue_draw_cb); |
164 | 90 | vertical_spacing.changed.connect(needredraw_lambda); | 90 | vertical_spacing.changed.connect(queue_draw_cb); |
165 | 91 | padding.changed.connect(needredraw_lambda); | 91 | padding.changed.connect(queue_draw_cb); |
166 | 92 | selected_index_.changed.connect(needredraw_lambda); | 92 | selected_index_.changed.connect(queue_draw_cb); |
167 | 93 | expanded.changed.connect([this](bool value) { if (value) all_results_preloaded_ = false; }); | 93 | expanded.changed.connect([this](bool value) { if (value) all_results_preloaded_ = false; }); |
168 | 94 | results_per_row.changed.connect([this](int value) { if (value > 0) all_results_preloaded_ = false; }); | 94 | results_per_row.changed.connect([this](int value) { if (value > 0) all_results_preloaded_ = false; }); |
169 | 95 | scale.changed.connect(sigc::mem_fun(this, &ResultViewGrid::UpdateScale)); | 95 | scale.changed.connect(sigc::mem_fun(this, &ResultViewGrid::UpdateScale)); |
170 | @@ -119,7 +119,7 @@ | |||
171 | 119 | NeedRedraw(); | 119 | NeedRedraw(); |
172 | 120 | }); | 120 | }); |
173 | 121 | 121 | ||
175 | 122 | WindowManager::Default().average_color.changed.connect(sigc::hide(sigc::mem_fun(this, &View::QueueDraw))); | 122 | WindowManager::Default().average_color.changed.connect(queue_draw_cb); |
176 | 123 | 123 | ||
177 | 124 | ubus_.RegisterInterest(UBUS_DASH_SIZE_CHANGED, [this] (GVariant* data) { | 124 | ubus_.RegisterInterest(UBUS_DASH_SIZE_CHANGED, [this] (GVariant* data) { |
178 | 125 | // on dash size changed, we update our stored values, this sucks | 125 | // on dash size changed, we update our stored values, this sucks |
179 | 126 | 126 | ||
180 | === modified file 'debian/changelog' | |||
181 | --- debian/changelog 2015-08-03 12:35:24 +0000 | |||
182 | +++ debian/changelog 2015-08-24 17:01:53 +0000 | |||
183 | @@ -1,3 +1,32 @@ | |||
184 | 1 | unity (7.3.2+15.10.20150819-0ubuntu1) wily; urgency=medium | ||
185 | 2 | |||
186 | 3 | [ Andrea Azzarone andrea.azzarone@canonical.com ] | ||
187 | 4 | * Do not handle events coming from viewports not actually containing | ||
188 | 5 | the window. (LP: #1449654) | ||
189 | 6 | |||
190 | 7 | [ Chris Townsend ] | ||
191 | 8 | * Also use the Compiz show() method when forcing an unmapped window to | ||
192 | 9 | be visible when clicking on it's active Launcher icon. (LP: #989588) | ||
193 | 10 | * When using keyboard navigation in the Dash, skip category headers | ||
194 | 11 | that are not expandable. Also, do not highlight the category header | ||
195 | 12 | when the mouse cursor is over it. (LP: #1045933) | ||
196 | 13 | |||
197 | 14 | [ Marco Trevisan (Treviño) ] | ||
198 | 15 | * ApplicationManager: rely on windows monitor property changes for | ||
199 | 16 | updating Pips (LP: #1027191) | ||
200 | 17 | * Autopilot: modernize some tests, use stronger methods to ensure | ||
201 | 18 | false positive | ||
202 | 19 | * DecorationsForceQuitDialog: override the background of the window | ||
203 | 20 | with transparent color (LP: #1470292) | ||
204 | 21 | * Launcher: Always unfold an active icon (LP: #1472339) | ||
205 | 22 | * PanelMenuView: ensure that we connect to window signals as soon as | ||
206 | 23 | the AppManager knows it (LP: #1472326) | ||
207 | 24 | * PlacesGroup: connect to view changes using a function instead of a | ||
208 | 25 | lambda (LP: #1470298) | ||
209 | 26 | * SessionButton: set button opacity to 75% when pressed (LP: #1301655) | ||
210 | 27 | |||
211 | 28 | -- CI Train Bot <ci-train-bot@canonical.com> Wed, 19 Aug 2015 14:45:18 +0000 | ||
212 | 29 | |||
213 | 1 | unity (7.3.2+15.10.20150803.1-0ubuntu1) wily; urgency=medium | 30 | unity (7.3.2+15.10.20150803.1-0ubuntu1) wily; urgency=medium |
214 | 2 | 31 | ||
215 | 3 | [ Andrea Azzarone andrea.azzarone@canonical.com ] | 32 | [ Andrea Azzarone andrea.azzarone@canonical.com ] |
216 | 4 | 33 | ||
217 | === modified file 'debian/control' | |||
218 | --- debian/control 2015-04-05 22:07:47 +0000 | |||
219 | +++ debian/control 2015-08-24 17:01:53 +0000 | |||
220 | @@ -192,7 +192,7 @@ | |||
221 | 192 | python-testtools, | 192 | python-testtools, |
222 | 193 | python-xdg, | 193 | python-xdg, |
223 | 194 | python-xlib, | 194 | python-xlib, |
225 | 195 | libxpathselect1.4 (>= 1.4), | 195 | libxpathselect1.4v5 (>= 1.4), |
226 | 196 | mesa-utils, | 196 | mesa-utils, |
227 | 197 | Description: Autopiloted tests for Unity | 197 | Description: Autopiloted tests for Unity |
228 | 198 | Unity is tested automatically through autopilot, a framework which enables | 198 | Unity is tested automatically through autopilot, a framework which enables |
229 | 199 | 199 | ||
230 | === modified file 'decorations/DecoratedWindow.cpp' | |||
231 | --- decorations/DecoratedWindow.cpp 2015-02-03 10:28:30 +0000 | |||
232 | +++ decorations/DecoratedWindow.cpp 2015-08-24 17:01:53 +0000 | |||
233 | @@ -842,6 +842,11 @@ | |||
234 | 842 | , impl_(new Impl(this, cwin)) | 842 | , impl_(new Impl(this, cwin)) |
235 | 843 | {} | 843 | {} |
236 | 844 | 844 | ||
237 | 845 | CompWindow* Window::GetCompWindow() | ||
238 | 846 | { | ||
239 | 847 | return impl_->win_; | ||
240 | 848 | } | ||
241 | 849 | |||
242 | 845 | void Window::Update() | 850 | void Window::Update() |
243 | 846 | { | 851 | { |
244 | 847 | impl_->Update(); | 852 | impl_->Update(); |
245 | 848 | 853 | ||
246 | === modified file 'decorations/DecoratedWindow.h' | |||
247 | --- decorations/DecoratedWindow.h 2014-03-03 19:07:56 +0000 | |||
248 | +++ decorations/DecoratedWindow.h 2015-08-24 17:01:53 +0000 | |||
249 | @@ -45,6 +45,7 @@ | |||
250 | 45 | nux::Property<bool> scaled; | 45 | nux::Property<bool> scaled; |
251 | 46 | nux::ROProperty<double> dpi_scale; | 46 | nux::ROProperty<double> dpi_scale; |
252 | 47 | 47 | ||
253 | 48 | CompWindow* GetCompWindow(); | ||
254 | 48 | void Update(); | 49 | void Update(); |
255 | 49 | void Undecorate(); | 50 | void Undecorate(); |
256 | 50 | void UpdateDecorationPosition(); | 51 | void UpdateDecorationPosition(); |
257 | 51 | 52 | ||
258 | === modified file 'decorations/DecorationsForceQuitDialog.cpp' | |||
259 | --- decorations/DecorationsForceQuitDialog.cpp 2015-06-12 12:15:40 +0000 | |||
260 | +++ decorations/DecorationsForceQuitDialog.cpp 2015-08-24 17:01:53 +0000 | |||
261 | @@ -169,6 +169,14 @@ | |||
262 | 169 | gtk_widget_set_visual(GTK_WIDGET(self), gdk_screen_get_rgba_visual(screen)); | 169 | gtk_widget_set_visual(GTK_WIDGET(self), gdk_screen_get_rgba_visual(screen)); |
263 | 170 | gtk_widget_realize(GTK_WIDGET(self)); | 170 | gtk_widget_realize(GTK_WIDGET(self)); |
264 | 171 | 171 | ||
265 | 172 | glib::Object<GtkCssProvider> style(gtk_css_provider_new()); | ||
266 | 173 | gtk_css_provider_load_from_data(style, R"( | ||
267 | 174 | * { background-color: transparent; } | ||
268 | 175 | )", -1, nullptr); | ||
269 | 176 | |||
270 | 177 | auto* style_ctx = gtk_widget_get_style_context(GTK_WIDGET(self)); | ||
271 | 178 | gtk_style_context_add_provider(style_ctx, glib::object_cast<GtkStyleProvider>(style), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); | ||
272 | 179 | |||
273 | 172 | gtk_container_add(GTK_CONTAINER(self), sheet_style_dialog_new(main_dialog, parent_xid, parent_pid)); | 180 | gtk_container_add(GTK_CONTAINER(self), sheet_style_dialog_new(main_dialog, parent_xid, parent_pid)); |
274 | 173 | 181 | ||
275 | 174 | gtk_window_set_modal(self, TRUE); | 182 | gtk_window_set_modal(self, TRUE); |
276 | 175 | 183 | ||
277 | === modified file 'decorations/DecorationsManager.cpp' | |||
278 | --- decorations/DecorationsManager.cpp 2015-02-03 08:38:19 +0000 | |||
279 | +++ decorations/DecorationsManager.cpp 2015-08-24 17:01:53 +0000 | |||
280 | @@ -172,7 +172,7 @@ | |||
281 | 172 | { | 172 | { |
282 | 173 | auto const& win = GetWindowByXid(xid); | 173 | auto const& win = GetWindowByXid(xid); |
283 | 174 | 174 | ||
285 | 175 | if (win && !win->impl_->win_->hasUnmapReference()) | 175 | if (win && !win->GetCompWindow()->hasUnmapReference()) |
286 | 176 | { | 176 | { |
287 | 177 | win->Update(); | 177 | win->Update(); |
288 | 178 | return true; | 178 | return true; |
289 | @@ -306,6 +306,10 @@ | |||
290 | 306 | return false; | 306 | return false; |
291 | 307 | 307 | ||
292 | 308 | auto const& win = GetWindowByFrame(event->xany.window); | 308 | auto const& win = GetWindowByFrame(event->xany.window); |
293 | 309 | CompWindow* comp_window = win ? win->GetCompWindow() : nullptr; | ||
294 | 310 | |||
295 | 311 | if (comp_window && comp_window->defaultViewport() != screen->vp()) | ||
296 | 312 | return false; | ||
297 | 309 | 313 | ||
298 | 310 | // ButtonRelease events might happen also outside the frame window, in this | 314 | // ButtonRelease events might happen also outside the frame window, in this |
299 | 311 | // case we must unset the mouse owner, wherever the event happens. | 315 | // case we must unset the mouse owner, wherever the event happens. |
300 | 312 | 316 | ||
301 | === modified file 'launcher/ApplicationLauncherIcon.cpp' | |||
302 | --- launcher/ApplicationLauncherIcon.cpp 2015-04-22 23:43:16 +0000 | |||
303 | +++ launcher/ApplicationLauncherIcon.cpp 2015-08-24 17:01:53 +0000 | |||
304 | @@ -48,7 +48,6 @@ | |||
305 | 48 | namespace | 48 | namespace |
306 | 49 | { | 49 | { |
307 | 50 | // We use the "bamf-" prefix since the manager is protected, to avoid name clash | 50 | // We use the "bamf-" prefix since the manager is protected, to avoid name clash |
308 | 51 | const std::string WINDOW_MOVE_TIMEOUT = "bamf-window-move"; | ||
309 | 52 | const std::string ICON_REMOVE_TIMEOUT = "bamf-icon-remove"; | 51 | const std::string ICON_REMOVE_TIMEOUT = "bamf-icon-remove"; |
310 | 53 | const std::string ICON_DND_OVER_TIMEOUT = "bamf-icon-dnd-over"; | 52 | const std::string ICON_DND_OVER_TIMEOUT = "bamf-icon-dnd-over"; |
311 | 54 | const std::string DEFAULT_ICON = "application-default-icon"; | 53 | const std::string DEFAULT_ICON = "application-default-icon"; |
312 | @@ -87,12 +86,11 @@ | |||
313 | 87 | 86 | ||
314 | 88 | WindowManager& wm = WindowManager::Default(); | 87 | WindowManager& wm = WindowManager::Default(); |
315 | 89 | wm.window_minimized.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::OnWindowMinimized)); | 88 | wm.window_minimized.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::OnWindowMinimized)); |
316 | 90 | wm.window_moved.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::OnWindowMoved)); | ||
317 | 91 | wm.screen_viewport_switch_ended.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowState)); | 89 | wm.screen_viewport_switch_ended.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowState)); |
318 | 92 | wm.terminate_expo.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowState)); | 90 | wm.terminate_expo.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowState)); |
320 | 93 | UScreen::GetDefault()->changed.connect(sigc::hide(sigc::hide(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowState)))); | 91 | UScreen::GetDefault()->changed.connect(sigc::hide(sigc::hide(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowsLocation)))); |
321 | 94 | 92 | ||
323 | 95 | EnsureWindowState(); | 93 | EnsureWindowsLocation(); |
324 | 96 | } | 94 | } |
325 | 97 | 95 | ||
326 | 98 | ApplicationLauncherIcon::~ApplicationLauncherIcon() | 96 | ApplicationLauncherIcon::~ApplicationLauncherIcon() |
327 | @@ -156,14 +154,16 @@ | |||
328 | 156 | { | 154 | { |
329 | 157 | // Lambda functions should be fine here because when the application the icon | 155 | // Lambda functions should be fine here because when the application the icon |
330 | 158 | // is only ever removed when the application is closed. | 156 | // is only ever removed when the application is closed. |
334 | 159 | signals_conn_.Add(app_->window_opened.connect([this](ApplicationWindowPtr const&) { | 157 | signals_conn_.Add(app_->window_opened.connect([this](ApplicationWindowPtr const& win) { |
335 | 160 | EnsureWindowState(); | 158 | signals_conn_.Add(win->monitor.changed.connect([this] (int) { EnsureWindowsLocation(); })); |
336 | 161 | UpdateIconGeometries(GetCenters()); | 159 | EnsureWindowsLocation(); |
337 | 162 | })); | 160 | })); |
338 | 163 | 161 | ||
342 | 164 | auto ensure_windows_cb = sigc::hide(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowState)); | 162 | auto ensure_win_location_cb = sigc::hide(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowsLocation)); |
343 | 165 | signals_conn_.Add(app_->window_closed.connect(ensure_windows_cb)); | 163 | signals_conn_.Add(app_->window_closed.connect(ensure_win_location_cb)); |
344 | 166 | signals_conn_.Add(app_->window_moved.connect(ensure_windows_cb)); | 164 | |
345 | 165 | for (auto& win : app_->GetWindows()) | ||
346 | 166 | signals_conn_.Add(win->monitor.changed.connect(ensure_win_location_cb)); | ||
347 | 167 | 167 | ||
348 | 168 | signals_conn_.Add(app_->urgent.changed.connect([this](bool const& urgent) { | 168 | signals_conn_.Add(app_->urgent.changed.connect([this](bool const& urgent) { |
349 | 169 | LOG_DEBUG(logger) << tooltip_text() << " urgent now " << (urgent ? "true" : "false"); | 169 | LOG_DEBUG(logger) << tooltip_text() << " urgent now " << (urgent ? "true" : "false"); |
350 | @@ -535,19 +535,6 @@ | |||
351 | 535 | } | 535 | } |
352 | 536 | } | 536 | } |
353 | 537 | 537 | ||
354 | 538 | void ApplicationLauncherIcon::OnWindowMoved(guint32 moved_win) | ||
355 | 539 | { | ||
356 | 540 | if (!app_->OwnsWindow(moved_win)) | ||
357 | 541 | return; | ||
358 | 542 | |||
359 | 543 | _source_manager.AddTimeout(250, [this] { | ||
360 | 544 | EnsureWindowState(); | ||
361 | 545 | UpdateIconGeometries(GetCenters()); | ||
362 | 546 | |||
363 | 547 | return false; | ||
364 | 548 | }, WINDOW_MOVE_TIMEOUT); | ||
365 | 549 | } | ||
366 | 550 | |||
367 | 551 | void ApplicationLauncherIcon::UpdateDesktopFile() | 538 | void ApplicationLauncherIcon::UpdateDesktopFile() |
368 | 552 | { | 539 | { |
369 | 553 | std::string const& filename = app_->desktop_file(); | 540 | std::string const& filename = app_->desktop_file(); |
370 | @@ -738,8 +725,8 @@ | |||
371 | 738 | // If monitor is -1 (or negative), show on all monitors. | 725 | // If monitor is -1 (or negative), show on all monitors. |
372 | 739 | if (monitor < 0) | 726 | if (monitor < 0) |
373 | 740 | { | 727 | { |
376 | 741 | for (unsigned j; j < monitors::MAX; j++) | 728 | for (unsigned j; j < monitors::MAX; ++j) |
377 | 742 | ++number_of_windows_on_monitor[j]; | 729 | ++number_of_windows_on_monitor[j]; |
378 | 743 | } | 730 | } |
379 | 744 | else | 731 | else |
380 | 745 | { | 732 | { |
381 | @@ -748,12 +735,18 @@ | |||
382 | 748 | } | 735 | } |
383 | 749 | } | 736 | } |
384 | 750 | 737 | ||
386 | 751 | for (unsigned i = 0; i < monitors::MAX; i++) | 738 | for (unsigned i = 0; i < monitors::MAX; ++i) |
387 | 752 | SetNumberOfWindowsVisibleOnMonitor(number_of_windows_on_monitor[i], i); | 739 | SetNumberOfWindowsVisibleOnMonitor(number_of_windows_on_monitor[i], i); |
388 | 753 | 740 | ||
389 | 754 | WindowsChanged.emit(); | 741 | WindowsChanged.emit(); |
390 | 755 | } | 742 | } |
391 | 756 | 743 | ||
392 | 744 | void ApplicationLauncherIcon::EnsureWindowsLocation() | ||
393 | 745 | { | ||
394 | 746 | EnsureWindowState(); | ||
395 | 747 | UpdateIconGeometries(GetCenters()); | ||
396 | 748 | } | ||
397 | 749 | |||
398 | 757 | void ApplicationLauncherIcon::UpdateDesktopQuickList() | 750 | void ApplicationLauncherIcon::UpdateDesktopQuickList() |
399 | 758 | { | 751 | { |
400 | 759 | std::string const& desktop_file = DesktopFile(); | 752 | std::string const& desktop_file = DesktopFile(); |
401 | 760 | 753 | ||
402 | === modified file 'launcher/ApplicationLauncherIcon.h' | |||
403 | --- launcher/ApplicationLauncherIcon.h 2014-06-07 16:27:16 +0000 | |||
404 | +++ launcher/ApplicationLauncherIcon.h 2015-08-24 17:01:53 +0000 | |||
405 | @@ -116,6 +116,7 @@ | |||
406 | 116 | void UnsetApplication(); | 116 | void UnsetApplication(); |
407 | 117 | void SetupApplicationSignalsConnections(); | 117 | void SetupApplicationSignalsConnections(); |
408 | 118 | void EnsureWindowState(); | 118 | void EnsureWindowState(); |
409 | 119 | void EnsureWindowsLocation(); | ||
410 | 119 | void EnsureMenuItemsWindowsReady(); | 120 | void EnsureMenuItemsWindowsReady(); |
411 | 120 | void EnsureMenuItemsDefaultReady(); | 121 | void EnsureMenuItemsDefaultReady(); |
412 | 121 | void EnsureMenuItemsStaticQuicklist(); | 122 | void EnsureMenuItemsStaticQuicklist(); |
413 | @@ -127,7 +128,6 @@ | |||
414 | 127 | bool Spread(bool current_desktop, int state, bool force); | 128 | bool Spread(bool current_desktop, int state, bool force); |
415 | 128 | 129 | ||
416 | 129 | void OnWindowMinimized(guint32 xid); | 130 | void OnWindowMinimized(guint32 xid); |
417 | 130 | void OnWindowMoved(guint32 xid); | ||
418 | 131 | 131 | ||
419 | 132 | WindowList GetWindows(WindowFilterMask filter = 0, int monitor = -1); | 132 | WindowList GetWindows(WindowFilterMask filter = 0, int monitor = -1); |
420 | 133 | const std::set<std::string> GetSupportedTypes(); | 133 | const std::set<std::string> GetSupportedTypes(); |
421 | 134 | 134 | ||
422 | === modified file 'launcher/Launcher.cpp' | |||
423 | --- launcher/Launcher.cpp 2015-05-21 16:30:26 +0000 | |||
424 | +++ launcher/Launcher.cpp 2015-08-24 17:01:53 +0000 | |||
425 | @@ -677,7 +677,9 @@ | |||
426 | 677 | // goes for 0.0f when fully unfolded, to 1.0f folded | 677 | // goes for 0.0f when fully unfolded, to 1.0f folded |
427 | 678 | float folding_progress = CLAMP((center.y + c_icon_size - folding_threshold) / (float) c_icon_size, 0.0f, 1.0f); | 678 | float folding_progress = CLAMP((center.y + c_icon_size - folding_threshold) / (float) c_icon_size, 0.0f, 1.0f); |
428 | 679 | float unfold_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor()); | 679 | float unfold_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor()); |
429 | 680 | float active_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor()); | ||
430 | 680 | 681 | ||
431 | 682 | unfold_progress = CLAMP(unfold_progress + active_progress, 0.0f, 1.0f); | ||
432 | 681 | folding_progress *= 1.0f - unfold_progress; | 683 | folding_progress *= 1.0f - unfold_progress; |
433 | 682 | 684 | ||
434 | 683 | float half_size = (folded_size / 2.0f) + (c_icon_size / 2.0f - folded_size / 2.0f) * (1.0f - folding_progress); | 685 | float half_size = (folded_size / 2.0f) + (c_icon_size / 2.0f - folded_size / 2.0f) * (1.0f - folding_progress); |
435 | @@ -779,9 +781,12 @@ | |||
436 | 779 | sum += height; | 781 | sum += height; |
437 | 780 | 782 | ||
438 | 781 | // magic constant must some day be explained, for now suffice to say this constant prevents the bottom from "marching"; | 783 | // magic constant must some day be explained, for now suffice to say this constant prevents the bottom from "marching"; |
440 | 782 | float magic_constant = 1.3f; | 784 | const float magic_constant = 1.3f; |
441 | 783 | 785 | ||
442 | 784 | float unfold_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor()); | 786 | float unfold_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor()); |
443 | 787 | float active_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor()); | ||
444 | 788 | |||
445 | 789 | unfold_progress = CLAMP(unfold_progress + active_progress, 0.0f, 1.0f); | ||
446 | 785 | folding_threshold -= CLAMP(sum - launcher_height, 0.0f, height * magic_constant) * (folding_constant + (1.0f - folding_constant) * unfold_progress); | 790 | folding_threshold -= CLAMP(sum - launcher_height, 0.0f, height * magic_constant) * (folding_constant + (1.0f - folding_constant) * unfold_progress); |
447 | 786 | } | 791 | } |
448 | 787 | 792 | ||
449 | @@ -1597,6 +1602,7 @@ | |||
450 | 1597 | { | 1602 | { |
451 | 1598 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::VISIBLE, ANIM_DURATION_SHORT, monitor()); | 1603 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::VISIBLE, ANIM_DURATION_SHORT, monitor()); |
452 | 1599 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::RUNNING, ANIM_DURATION_SHORT, monitor()); | 1604 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::RUNNING, ANIM_DURATION_SHORT, monitor()); |
453 | 1605 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::ACTIVE, ANIM_DURATION_SHORT, monitor()); | ||
454 | 1600 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::STARTING, (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), monitor()); | 1606 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::STARTING, (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), monitor()); |
455 | 1601 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PULSE_ONCE, (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2), monitor()); | 1607 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PULSE_ONCE, (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2), monitor()); |
456 | 1602 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PRESENTED, ANIM_DURATION, monitor()); | 1608 | icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PRESENTED, ANIM_DURATION, monitor()); |
457 | 1603 | 1609 | ||
458 | === modified file 'panel/PanelMenuView.cpp' | |||
459 | --- panel/PanelMenuView.cpp 2015-04-20 18:42:25 +0000 | |||
460 | +++ panel/PanelMenuView.cpp 2015-08-24 17:01:53 +0000 | |||
461 | @@ -146,6 +146,8 @@ | |||
462 | 146 | am.active_application_changed.connect(sigc::mem_fun(this, &PanelMenuView::OnActiveAppChanged)); | 146 | am.active_application_changed.connect(sigc::mem_fun(this, &PanelMenuView::OnActiveAppChanged)); |
463 | 147 | am.application_started.connect(sigc::mem_fun(this, &PanelMenuView::OnApplicationStarted)); | 147 | am.application_started.connect(sigc::mem_fun(this, &PanelMenuView::OnApplicationStarted)); |
464 | 148 | am.application_stopped.connect(sigc::mem_fun(this, &PanelMenuView::OnApplicationClosed)); | 148 | am.application_stopped.connect(sigc::mem_fun(this, &PanelMenuView::OnApplicationClosed)); |
465 | 149 | am.window_opened.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowOpened)); | ||
466 | 150 | am.window_closed.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowClosed)); | ||
467 | 149 | 151 | ||
468 | 150 | mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter)); | 152 | mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter)); |
469 | 151 | mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave)); | 153 | mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave)); |
470 | @@ -1028,6 +1030,19 @@ | |||
471 | 1028 | } | 1030 | } |
472 | 1029 | } | 1031 | } |
473 | 1030 | 1032 | ||
474 | 1033 | void PanelMenuView::OnWindowOpened(ApplicationWindowPtr const& win) | ||
475 | 1034 | { | ||
476 | 1035 | if (win->window_id() == window_buttons_->controlled_window() && | ||
477 | 1036 | win->title.changed.empty()) | ||
478 | 1037 | { | ||
479 | 1038 | /* This is a not so nice workaround that we need to include here, since | ||
480 | 1039 | * BAMF might be late in informing us about a new window, and thus we | ||
481 | 1040 | * can't connect to it's signals (as not available in the App Manager). */ | ||
482 | 1041 | window_buttons_->controlled_window = 0; | ||
483 | 1042 | UpdateTargetWindowItems(); | ||
484 | 1043 | } | ||
485 | 1044 | } | ||
486 | 1045 | |||
487 | 1031 | void PanelMenuView::OnWindowClosed(ApplicationWindowPtr const& win) | 1046 | void PanelMenuView::OnWindowClosed(ApplicationWindowPtr const& win) |
488 | 1032 | { | 1047 | { |
489 | 1033 | /* FIXME, this can be removed when window_unmapped WindowManager signal | 1048 | /* FIXME, this can be removed when window_unmapped WindowManager signal |
490 | 1034 | 1049 | ||
491 | === modified file 'panel/PanelMenuView.h' | |||
492 | --- panel/PanelMenuView.h 2015-04-20 17:58:31 +0000 | |||
493 | +++ panel/PanelMenuView.h 2015-08-24 17:01:53 +0000 | |||
494 | @@ -89,6 +89,7 @@ | |||
495 | 89 | void OnEntryViewAdded(PanelIndicatorEntryView* view); | 89 | void OnEntryViewAdded(PanelIndicatorEntryView* view); |
496 | 90 | void OnApplicationStarted(ApplicationPtr const&); | 90 | void OnApplicationStarted(ApplicationPtr const&); |
497 | 91 | void OnApplicationClosed(ApplicationPtr const&); | 91 | void OnApplicationClosed(ApplicationPtr const&); |
498 | 92 | void OnWindowOpened(ApplicationWindowPtr const&); | ||
499 | 92 | void OnWindowClosed(ApplicationWindowPtr const&); | 93 | void OnWindowClosed(ApplicationWindowPtr const&); |
500 | 93 | void OnActiveWindowChanged(ApplicationWindowPtr const&); | 94 | void OnActiveWindowChanged(ApplicationWindowPtr const&); |
501 | 94 | void OnActiveAppChanged(ApplicationPtr const&); | 95 | void OnActiveAppChanged(ApplicationPtr const&); |
502 | 95 | 96 | ||
503 | === modified file 'shutdown/SessionButton.cpp' | |||
504 | --- shutdown/SessionButton.cpp 2014-05-08 04:04:18 +0000 | |||
505 | +++ shutdown/SessionButton.cpp 2015-08-24 17:01:53 +0000 | |||
506 | @@ -40,6 +40,7 @@ | |||
507 | 40 | : nux::View(NUX_FILE_LINE_PARAM) | 40 | : nux::View(NUX_FILE_LINE_PARAM) |
508 | 41 | , scale(1.0) | 41 | , scale(1.0) |
509 | 42 | , highlighted(false) | 42 | , highlighted(false) |
510 | 43 | , pressed(false) | ||
511 | 43 | , action([this] { return action_; }) | 44 | , action([this] { return action_; }) |
512 | 44 | , label([this] { return label_view_->GetText(); }) | 45 | , label([this] { return label_view_->GetText(); }) |
513 | 45 | , action_(action) | 46 | , action_(action) |
514 | @@ -107,6 +108,8 @@ | |||
515 | 107 | mouse_enter.connect([this] (int, int, unsigned long, unsigned long) { highlighted = true; }); | 108 | mouse_enter.connect([this] (int, int, unsigned long, unsigned long) { highlighted = true; }); |
516 | 108 | mouse_leave.connect([this] (int, int, unsigned long, unsigned long) { highlighted = false; }); | 109 | mouse_leave.connect([this] (int, int, unsigned long, unsigned long) { highlighted = false; }); |
517 | 109 | mouse_click.connect([this] (int, int, unsigned long, unsigned long) { activated.emit(); }); | 110 | mouse_click.connect([this] (int, int, unsigned long, unsigned long) { activated.emit(); }); |
518 | 111 | mouse_down.connect([this] (int, int, unsigned long, unsigned long) { pressed = true; }); | ||
519 | 112 | mouse_up.connect([this] (int, int, unsigned long, unsigned long) { pressed = false; }); | ||
520 | 110 | 113 | ||
521 | 111 | begin_key_focus.connect([this] { highlighted = true; }); | 114 | begin_key_focus.connect([this] { highlighted = true; }); |
522 | 112 | end_key_focus.connect([this] { highlighted = false; }); | 115 | end_key_focus.connect([this] { highlighted = false; }); |
523 | @@ -116,6 +119,10 @@ | |||
524 | 116 | image_view_->SetTexture(value ? highlight_tex_ : normal_tex_); | 119 | image_view_->SetTexture(value ? highlight_tex_ : normal_tex_); |
525 | 117 | label_view_->SetTextColor(value ? nux::color::White : nux::color::Transparent); | 120 | label_view_->SetTextColor(value ? nux::color::White : nux::color::Transparent); |
526 | 118 | }); | 121 | }); |
527 | 122 | |||
528 | 123 | pressed.changed.connect([this] (bool value) { | ||
529 | 124 | image_view_->SetOpacity(value ? 0.75 : 1.0); | ||
530 | 125 | }); | ||
531 | 119 | } | 126 | } |
532 | 120 | 127 | ||
533 | 121 | void Button::UpdateTextures(std::string const& texture_prefix) | 128 | void Button::UpdateTextures(std::string const& texture_prefix) |
534 | 122 | 129 | ||
535 | === modified file 'shutdown/SessionButton.h' | |||
536 | --- shutdown/SessionButton.h 2014-05-05 18:42:45 +0000 | |||
537 | +++ shutdown/SessionButton.h 2015-08-24 17:01:53 +0000 | |||
538 | @@ -52,6 +52,7 @@ | |||
539 | 52 | 52 | ||
540 | 53 | nux::Property<double> scale; | 53 | nux::Property<double> scale; |
541 | 54 | nux::Property<bool> highlighted; | 54 | nux::Property<bool> highlighted; |
542 | 55 | nux::Property<bool> pressed; | ||
543 | 55 | nux::ROProperty<Action> action; | 56 | nux::ROProperty<Action> action; |
544 | 56 | nux::ROProperty<std::string> label; | 57 | nux::ROProperty<std::string> label; |
545 | 57 | 58 | ||
546 | 58 | 59 | ||
547 | === modified file 'shutdown/SessionView.cpp' | |||
548 | --- shutdown/SessionView.cpp 2014-06-18 15:08:33 +0000 | |||
549 | +++ shutdown/SessionView.cpp 2015-08-24 17:01:53 +0000 | |||
550 | @@ -236,7 +236,7 @@ | |||
551 | 236 | { | 236 | { |
552 | 237 | if (mode() == Mode::FULL) | 237 | if (mode() == Mode::FULL) |
553 | 238 | { | 238 | { |
555 | 239 | if (manager_->CanLock()) | 239 | if (manager_->CanLock() && !manager_->is_locked()) |
556 | 240 | { | 240 | { |
557 | 241 | auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION); | 241 | auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION); |
558 | 242 | button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen)); | 242 | button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen)); |
559 | 243 | 243 | ||
560 | === modified file 'tests/autopilot/unity/emulators/__init__.py' | |||
561 | --- tests/autopilot/unity/emulators/__init__.py 2013-10-03 02:47:42 +0000 | |||
562 | +++ tests/autopilot/unity/emulators/__init__.py 2015-08-24 17:01:53 +0000 | |||
563 | @@ -28,6 +28,30 @@ | |||
564 | 28 | 28 | ||
565 | 29 | _Backend = DBusAddress.SessionBus(DBUS_SERVICE, DBUS_OBJECT) | 29 | _Backend = DBusAddress.SessionBus(DBUS_SERVICE, DBUS_OBJECT) |
566 | 30 | 30 | ||
567 | 31 | def _repr_string(self, obj_details=""): | ||
568 | 32 | geostr = "" | ||
569 | 33 | if hasattr(self, 'globalRect'): | ||
570 | 34 | geostr = " geo=[{r.x}x{r.y} {r.width}x{r.height}]".format(r=self.globalRect) | ||
571 | 35 | |||
572 | 36 | obj_details.strip() | ||
573 | 37 | obj_details = " "+obj_details if len(obj_details) else "" | ||
574 | 38 | |||
575 | 39 | return "<{cls} {addr} id={id}{geo}{details}>".format(cls=self.__class__.__name__, | ||
576 | 40 | addr=hex(id(self)), | ||
577 | 41 | id=self.id, | ||
578 | 42 | geo=geostr, | ||
579 | 43 | details=obj_details) | ||
580 | 44 | |||
581 | 45 | def __repr__(self): | ||
582 | 46 | with self.no_automatic_refreshing(): | ||
583 | 47 | return self._repr_string() | ||
584 | 48 | |||
585 | 49 | def __eq__(self, other): | ||
586 | 50 | return isinstance(other, self.__class__) and self.id == other.id | ||
587 | 51 | |||
588 | 52 | def __ne__(self, other): | ||
589 | 53 | return not self.__eq__(other) | ||
590 | 54 | |||
591 | 31 | 55 | ||
592 | 32 | def ensure_unity_is_running(timeout=300): | 56 | def ensure_unity_is_running(timeout=300): |
593 | 33 | """Poll the unity debug interface, and return when it's ready for use. | 57 | """Poll the unity debug interface, and return when it's ready for use. |
594 | 34 | 58 | ||
595 | === modified file 'tests/autopilot/unity/emulators/dash.py' | |||
596 | --- tests/autopilot/unity/emulators/dash.py 2015-04-10 16:22:23 +0000 | |||
597 | +++ tests/autopilot/unity/emulators/dash.py 2015-08-24 17:01:53 +0000 | |||
598 | @@ -158,7 +158,7 @@ | |||
599 | 158 | 158 | ||
600 | 159 | @property | 159 | @property |
601 | 160 | def geometry(self): | 160 | def geometry(self): |
603 | 161 | return (self.view.x, self.view.y, self.view.width, self.view.height) | 161 | return self.view.globalRect |
604 | 162 | 162 | ||
605 | 163 | 163 | ||
606 | 164 | class DashView(UnityIntrospectionObject): | 164 | class DashView(UnityIntrospectionObject): |
607 | @@ -225,10 +225,12 @@ | |||
608 | 225 | class ScopeView(UnityIntrospectionObject): | 225 | class ScopeView(UnityIntrospectionObject): |
609 | 226 | """A Scope View.""" | 226 | """A Scope View.""" |
610 | 227 | 227 | ||
612 | 228 | def get_groups(self): | 228 | def get_categories(self, only_visible=False): |
613 | 229 | """Get a list of all groups within this scopeview. May return an empty list.""" | 229 | """Get a list of all groups within this scopeview. May return an empty list.""" |
616 | 230 | groups = self.get_children_by_type(PlacesGroup) | 230 | if only_visible: |
617 | 231 | return groups | 231 | return self.get_children_by_type(PlacesGroup, is_visible=True) |
618 | 232 | |||
619 | 233 | return self.get_children_by_type(PlacesGroup) | ||
620 | 232 | 234 | ||
621 | 233 | def get_focused_category(self): | 235 | def get_focused_category(self): |
622 | 234 | """Return a PlacesGroup instance for the category whose header has keyboard focus. | 236 | """Return a PlacesGroup instance for the category whose header has keyboard focus. |
623 | @@ -236,30 +238,22 @@ | |||
624 | 236 | Returns None if no category headers have keyboard focus. | 238 | Returns None if no category headers have keyboard focus. |
625 | 237 | 239 | ||
626 | 238 | """ | 240 | """ |
632 | 239 | categories = self.get_children_by_type(PlacesGroup) | 241 | matches = self.get_children_by_type(PlacesGroup, header_has_keyfocus=True) |
633 | 240 | matches = [m for m in categories if m.header_has_keyfocus] | 242 | return matches[0] if matches else None |
629 | 241 | if matches: | ||
630 | 242 | return matches[0] | ||
631 | 243 | return None | ||
634 | 244 | 243 | ||
635 | 245 | def get_category_by_name(self, category_name): | 244 | def get_category_by_name(self, category_name): |
636 | 246 | """Return a PlacesGroup instance with the given name, or None.""" | 245 | """Return a PlacesGroup instance with the given name, or None.""" |
642 | 247 | categories = self.get_children_by_type(PlacesGroup) | 246 | matches = self.get_children_by_type(PlacesGroup, name=category_name) |
643 | 248 | matches = [m for m in categories if m.name == category_name] | 247 | return matches[0] if matches else None |
639 | 249 | if matches: | ||
640 | 250 | return matches[0] | ||
641 | 251 | return None | ||
644 | 252 | 248 | ||
645 | 253 | def get_num_visible_categories(self): | 249 | def get_num_visible_categories(self): |
646 | 254 | """Get the number of visible categories in this scope.""" | 250 | """Get the number of visible categories in this scope.""" |
648 | 255 | return len([c for c in self.get_children_by_type(PlacesGroup) if c.is_visible]) | 251 | return len(self.get_categories(only_visible=True)) |
649 | 256 | 252 | ||
650 | 257 | def get_filterbar(self): | 253 | def get_filterbar(self): |
651 | 258 | """Get the filter bar for the current scope, or None if it doesn't have one.""" | 254 | """Get the filter bar for the current scope, or None if it doesn't have one.""" |
652 | 259 | bars = self.get_children_by_type(FilterBar) | 255 | bars = self.get_children_by_type(FilterBar) |
656 | 260 | if bars: | 256 | return bars[0] if bars else None |
654 | 261 | return bars[0] | ||
655 | 262 | return None | ||
657 | 263 | 257 | ||
658 | 264 | 258 | ||
659 | 265 | class PlacesGroup(UnityIntrospectionObject): | 259 | class PlacesGroup(UnityIntrospectionObject): |
660 | @@ -279,26 +273,16 @@ | |||
661 | 279 | """A single result in the dash.""" | 273 | """A single result in the dash.""" |
662 | 280 | 274 | ||
663 | 281 | def activate(self, double_click=True): | 275 | def activate(self, double_click=True): |
664 | 282 | tx = self.x + (self.width / 2) | ||
665 | 283 | ty = self.y + (self.height / 2) | ||
666 | 284 | m = Mouse.create() | 276 | m = Mouse.create() |
669 | 285 | m.move(tx, ty) | 277 | m.click_object(self, button=1) |
668 | 286 | m.click(1) | ||
670 | 287 | if double_click: | 278 | if double_click: |
672 | 288 | m.click(1) | 279 | m.click_object(self, button=1) |
673 | 289 | 280 | ||
674 | 290 | def preview(self, button=1): | 281 | def preview(self, button=1): |
680 | 291 | tx = self.x + (self.width / 2) | 282 | Mouse.create().click_object(self, button) |
676 | 292 | ty = self.y + (self.height / 2) | ||
677 | 293 | m = Mouse.create() | ||
678 | 294 | m.move(tx, ty) | ||
679 | 295 | m.click(button) | ||
681 | 296 | 283 | ||
682 | 297 | def preview_key(self): | 284 | def preview_key(self): |
687 | 298 | tx = self.x + (self.width / 2) | 285 | Mouse.create().move_to_object(self) |
684 | 299 | ty = self.y + (self.height / 2) | ||
685 | 300 | m = Mouse.create() | ||
686 | 301 | m.move(tx, ty) | ||
688 | 302 | 286 | ||
689 | 303 | k = Keyboard.create() | 287 | k = Keyboard.create() |
690 | 304 | k.press_and_release('Menu') | 288 | k.press_and_release('Menu') |
691 | @@ -313,11 +297,8 @@ | |||
692 | 313 | 297 | ||
693 | 314 | def get_focused_filter(self): | 298 | def get_focused_filter(self): |
694 | 315 | """Returns the id of the focused filter widget.""" | 299 | """Returns the id of the focused filter widget.""" |
700 | 316 | filters = self.get_children_by_type(FilterExpanderLabel) | 300 | filters = self.get_children_by_type(FilterExpanderLabel, expander_has_focus=True) |
701 | 317 | for filter_label in filters: | 301 | return filters[0] if filters else None |
697 | 318 | if filter_label.expander_has_focus: | ||
698 | 319 | return filter_label | ||
699 | 320 | return None | ||
702 | 321 | 302 | ||
703 | 322 | @property | 303 | @property |
704 | 323 | def expanded(self): | 304 | def expanded(self): |
705 | @@ -366,21 +347,13 @@ | |||
706 | 366 | def ensure_expanded(self): | 347 | def ensure_expanded(self): |
707 | 367 | """Expand the filter expander label, if it's not already""" | 348 | """Expand the filter expander label, if it's not already""" |
708 | 368 | if not self.expanded: | 349 | if not self.expanded: |
714 | 369 | tx = self.x + self.width / 2 | 350 | Mouse.create().click_object(self) |
710 | 370 | ty = self.y + self.height / 2 | ||
711 | 371 | m = Mouse.create() | ||
712 | 372 | m.move(tx, ty) | ||
713 | 373 | m.click() | ||
715 | 374 | self.expanded.wait_for(True) | 351 | self.expanded.wait_for(True) |
716 | 375 | 352 | ||
717 | 376 | def ensure_collapsed(self): | 353 | def ensure_collapsed(self): |
718 | 377 | """Collapse the filter expander label, if it's not already""" | 354 | """Collapse the filter expander label, if it's not already""" |
719 | 378 | if self.expanded: | 355 | if self.expanded: |
725 | 379 | tx = self.x + self.width / 2 | 356 | Mouse.create().click_object(self) |
721 | 380 | ty = self.y + self.height / 2 | ||
722 | 381 | m = Mouse.create() | ||
723 | 382 | m.move(tx, ty) | ||
724 | 383 | m.click() | ||
726 | 384 | self.expanded.wait_for(False) | 357 | self.expanded.wait_for(False) |
727 | 385 | 358 | ||
728 | 386 | 359 | ||
729 | @@ -402,21 +375,14 @@ | |||
730 | 402 | 375 | ||
731 | 403 | def get_action_by_id(self, action_id): | 376 | def get_action_by_id(self, action_id): |
732 | 404 | """Returns the action given it's action hint.""" | 377 | """Returns the action given it's action hint.""" |
738 | 405 | actions = self.get_children_by_type(ActionButton) | 378 | actions = self.get_children_by_type(ActionButton, action=action_id) |
739 | 406 | for action in actions: | 379 | return actions[0] if actions else None |
735 | 407 | if action.action == action_id: | ||
736 | 408 | return action | ||
737 | 409 | return None | ||
740 | 410 | 380 | ||
741 | 411 | def execute_action_by_id(self, action_id): | 381 | def execute_action_by_id(self, action_id): |
742 | 412 | """Executes an action given by the id.""" | 382 | """Executes an action given by the id.""" |
743 | 413 | action = self.get_action_by_id(action_id) | 383 | action = self.get_action_by_id(action_id) |
744 | 414 | if action: | 384 | if action: |
750 | 415 | tx = action.x + (action.width / 2) | 385 | Mouse.create().click_object(action) |
746 | 416 | ty = action.y + (action.height / 2) | ||
747 | 417 | m = Mouse.create() | ||
748 | 418 | m.move(tx, ty) | ||
749 | 419 | m.click() | ||
751 | 420 | 386 | ||
752 | 421 | @property | 387 | @property |
753 | 422 | def cover_art(self): | 388 | def cover_art(self): |
754 | @@ -495,12 +461,8 @@ | |||
755 | 495 | 461 | ||
756 | 496 | def navigate_left(self, count=1): | 462 | def navigate_left(self, count=1): |
757 | 497 | """Navigate preview left""" | 463 | """Navigate preview left""" |
758 | 498 | navigator = self.get_left_navigator() | ||
759 | 499 | |||
760 | 500 | tx = navigator.button_x + (navigator.button_width / 2) | ||
761 | 501 | ty = navigator.button_y + (navigator.button_height / 2) | ||
762 | 502 | m = Mouse.create() | 464 | m = Mouse.create() |
764 | 503 | m.move(tx, ty) | 465 | m.move_to_object(self.get_left_navigator().button_geo) |
765 | 504 | 466 | ||
766 | 505 | old_preview_initiate_count = self.preview_initiate_count | 467 | old_preview_initiate_count = self.preview_initiate_count |
767 | 506 | 468 | ||
768 | @@ -512,12 +474,8 @@ | |||
769 | 512 | 474 | ||
770 | 513 | def navigate_right(self, count=1): | 475 | def navigate_right(self, count=1): |
771 | 514 | """Navigate preview right""" | 476 | """Navigate preview right""" |
772 | 515 | navigator = self.get_right_navigator() | ||
773 | 516 | |||
774 | 517 | tx = navigator.button_x + (navigator.button_width / 2) | ||
775 | 518 | ty = navigator.button_y + (navigator.button_height / 2) | ||
776 | 519 | m = Mouse.create() | 477 | m = Mouse.create() |
778 | 520 | m.move(tx, ty) | 478 | m.move_to_object(self.get_right_navigator().button_geo) |
779 | 521 | 479 | ||
780 | 522 | old_preview_initiate_count = self.preview_initiate_count | 480 | old_preview_initiate_count = self.preview_initiate_count |
781 | 523 | 481 | ||
782 | @@ -607,3 +565,4 @@ | |||
783 | 607 | 565 | ||
784 | 608 | class StaticCairoText(UnityIntrospectionObject): | 566 | class StaticCairoText(UnityIntrospectionObject): |
785 | 609 | """Text boxes in the preview""" | 567 | """Text boxes in the preview""" |
786 | 568 | |||
787 | 610 | 569 | ||
788 | === modified file 'tests/autopilot/unity/emulators/hud.py' | |||
789 | --- tests/autopilot/unity/emulators/hud.py 2013-10-03 01:33:53 +0000 | |||
790 | +++ tests/autopilot/unity/emulators/hud.py 2015-08-24 17:01:53 +0000 | |||
791 | @@ -105,7 +105,7 @@ | |||
792 | 105 | 105 | ||
793 | 106 | @property | 106 | @property |
794 | 107 | def geometry(self): | 107 | def geometry(self): |
796 | 108 | return (self.x, self.y, self.width, self.height) | 108 | return self.globalRect |
797 | 109 | 109 | ||
798 | 110 | @property | 110 | @property |
799 | 111 | def selected_button(self): | 111 | def selected_button(self): |
800 | @@ -156,7 +156,7 @@ | |||
801 | 156 | 156 | ||
802 | 157 | @property | 157 | @property |
803 | 158 | def geometry(self): | 158 | def geometry(self): |
805 | 159 | return (self.x, self.y, self.width, self.height) | 159 | return self.globalRect |
806 | 160 | 160 | ||
807 | 161 | 161 | ||
808 | 162 | class HudButton(UnityIntrospectionObject): | 162 | class HudButton(UnityIntrospectionObject): |
809 | 163 | 163 | ||
810 | === modified file 'tests/autopilot/unity/emulators/icons.py' | |||
811 | --- tests/autopilot/unity/emulators/icons.py 2013-11-14 01:56:41 +0000 | |||
812 | +++ tests/autopilot/unity/emulators/icons.py 2015-08-24 17:01:53 +0000 | |||
813 | @@ -58,10 +58,6 @@ | |||
814 | 58 | 58 | ||
815 | 59 | return self.xids.contains(xid) | 59 | return self.xids.contains(xid) |
816 | 60 | 60 | ||
817 | 61 | def __repr__(self): | ||
818 | 62 | with self.no_automatic_refreshing(): | ||
819 | 63 | return "<%s id=%d>" % (self.__class__.__name__, self.id) | ||
820 | 64 | |||
821 | 65 | 61 | ||
822 | 66 | class BFBLauncherIcon(SimpleLauncherIcon): | 62 | class BFBLauncherIcon(SimpleLauncherIcon): |
823 | 67 | """Represents the BFB button in the launcher.""" | 63 | """Represents the BFB button in the launcher.""" |
824 | @@ -80,10 +76,7 @@ | |||
825 | 80 | 76 | ||
826 | 81 | def __repr__(self): | 77 | def __repr__(self): |
827 | 82 | with self.no_automatic_refreshing(): | 78 | with self.no_automatic_refreshing(): |
832 | 83 | return "<%s %s id=%d>" % ( | 79 | return self._repr_string("{0.desktop_id}".format(self)) |
829 | 84 | self.__class__.__name__, | ||
830 | 85 | self.desktop_id, | ||
831 | 86 | self.id) | ||
833 | 87 | 80 | ||
834 | 88 | class TrashLauncherIcon(SimpleLauncherIcon): | 81 | class TrashLauncherIcon(SimpleLauncherIcon): |
835 | 89 | """Represents the trash launcher icon.""" | 82 | """Represents the trash launcher icon.""" |
836 | @@ -110,7 +103,7 @@ | |||
837 | 110 | 103 | ||
838 | 111 | @property | 104 | @property |
839 | 112 | def geometry(self): | 105 | def geometry(self): |
841 | 113 | return (self.x, self.y, self.width, self.height) | 106 | return self.globalRect |
842 | 114 | 107 | ||
843 | 115 | 108 | ||
844 | 116 | class LauncherEntry(UnityIntrospectionObject): | 109 | class LauncherEntry(UnityIntrospectionObject): |
845 | 117 | 110 | ||
846 | === modified file 'tests/autopilot/unity/emulators/launcher.py' | |||
847 | --- tests/autopilot/unity/emulators/launcher.py 2014-01-23 15:51:46 +0000 | |||
848 | +++ tests/autopilot/unity/emulators/launcher.py 2015-08-24 17:01:53 +0000 | |||
849 | @@ -118,12 +118,8 @@ | |||
850 | 118 | def move_mouse_over_launcher(self): | 118 | def move_mouse_over_launcher(self): |
851 | 119 | """Move the mouse over this launcher.""" | 119 | """Move the mouse over this launcher.""" |
852 | 120 | move_mouse_to_screen(self.monitor) | 120 | move_mouse_to_screen(self.monitor) |
853 | 121 | (x, y, w, h) = self.geometry | ||
854 | 122 | target_x = x + w / 2 | ||
855 | 123 | target_y = y + h / 2 | ||
856 | 124 | |||
857 | 125 | logger.debug("Moving mouse to center of launcher.") | 121 | logger.debug("Moving mouse to center of launcher.") |
859 | 126 | self._mouse.move(target_x, target_y) | 122 | self._mouse.move_to_object(self) |
860 | 127 | 123 | ||
861 | 128 | def move_mouse_to_icon(self, icon, autoscroll_offset=0): | 124 | def move_mouse_to_icon(self, icon, autoscroll_offset=0): |
862 | 129 | """Move the mouse to a specific icon.""" | 125 | """Move the mouse to a specific icon.""" |
863 | @@ -438,8 +434,8 @@ | |||
864 | 438 | 434 | ||
865 | 439 | @property | 435 | @property |
866 | 440 | def geometry(self): | 436 | def geometry(self): |
869 | 441 | """Returns a tuple of (x,y,w,h) for the current launcher.""" | 437 | """Returns a Rectangle (x,y,w,h) for the current launcher.""" |
870 | 442 | return (self.x, self.y, self.width, self.height) | 438 | return self.globalRect |
871 | 443 | 439 | ||
872 | 444 | 440 | ||
873 | 445 | class LauncherModel(UnityIntrospectionObject): | 441 | class LauncherModel(UnityIntrospectionObject): |
874 | 446 | 442 | ||
875 | === modified file 'tests/autopilot/unity/emulators/panel.py' | |||
876 | --- tests/autopilot/unity/emulators/panel.py 2015-02-18 00:49:47 +0000 | |||
877 | +++ tests/autopilot/unity/emulators/panel.py 2015-08-24 17:01:53 +0000 | |||
878 | @@ -14,6 +14,7 @@ | |||
879 | 14 | 14 | ||
880 | 15 | from autopilot.input import Mouse | 15 | from autopilot.input import Mouse |
881 | 16 | from autopilot.keybindings import KeybindingsHelper | 16 | from autopilot.keybindings import KeybindingsHelper |
882 | 17 | from autopilot.introspection.types import Rectangle | ||
883 | 17 | 18 | ||
884 | 18 | from unity.emulators import UnityIntrospectionObject | 19 | from unity.emulators import UnityIntrospectionObject |
885 | 19 | logger = logging.getLogger(__name__) | 20 | logger = logging.getLogger(__name__) |
886 | @@ -107,30 +108,18 @@ | |||
887 | 107 | 108 | ||
888 | 108 | def move_mouse_over_grab_area(self): | 109 | def move_mouse_over_grab_area(self): |
889 | 109 | """Move the mouse over the grab area for this panel.""" | 110 | """Move the mouse over the grab area for this panel.""" |
890 | 110 | (x, y, w, h) = self.grab_area.geometry | ||
891 | 111 | target_x = x + w / 2 | ||
892 | 112 | target_y = y + h / 2 | ||
893 | 113 | |||
894 | 114 | logger.debug("Moving mouse to center of grab area.") | 111 | logger.debug("Moving mouse to center of grab area.") |
896 | 115 | self._mouse.move(target_x, target_y) | 112 | self._mouse.move_to_object(self.grab_area) |
897 | 116 | 113 | ||
898 | 117 | def move_mouse_over_window_buttons(self): | 114 | def move_mouse_over_window_buttons(self): |
899 | 118 | """Move the mouse over the center of the window buttons area for this panel.""" | 115 | """Move the mouse over the center of the window buttons area for this panel.""" |
900 | 119 | (x, y, w, h) = self.window_buttons.geometry | ||
901 | 120 | target_x = x + w / 2 | ||
902 | 121 | target_y = y + h / 2 | ||
903 | 122 | |||
904 | 123 | logger.debug("Moving mouse to center of the window buttons.") | 116 | logger.debug("Moving mouse to center of the window buttons.") |
906 | 124 | self._mouse.move(target_x, target_y) | 117 | self._mouse.move_to_object(self.window_buttons) |
907 | 125 | 118 | ||
908 | 126 | def move_mouse_over_indicators(self): | 119 | def move_mouse_over_indicators(self): |
909 | 127 | """Move the mouse over the center of the indicators area for this panel.""" | 120 | """Move the mouse over the center of the indicators area for this panel.""" |
910 | 128 | (x, y, w, h) = self.indicators.geometry | ||
911 | 129 | target_x = x + w / 2 | ||
912 | 130 | target_y = y + h / 2 | ||
913 | 131 | |||
914 | 132 | logger.debug("Moving mouse to center of the indicators area.") | 121 | logger.debug("Moving mouse to center of the indicators area.") |
916 | 133 | self._mouse.move(target_x, target_y) | 122 | self._mouse.move_to_object(self.indicators) |
917 | 134 | 123 | ||
918 | 135 | def get_indicator_entries(self, visible_only=True, include_hidden_menus=False): | 124 | def get_indicator_entries(self, visible_only=True, include_hidden_menus=False): |
919 | 136 | """Returns a list of entries for this panel including both menus and indicators""" | 125 | """Returns a list of entries for this panel including both menus and indicators""" |
920 | @@ -192,8 +181,8 @@ | |||
921 | 192 | 181 | ||
922 | 193 | @property | 182 | @property |
923 | 194 | def geometry(self): | 183 | def geometry(self): |
926 | 195 | """Returns a tuple of (x,y,w,h) for the current panel.""" | 184 | """Returns a Rectangle (x,y,w,h) for the current panel.""" |
927 | 196 | return (self.x, self.y, self.width, self.height) | 185 | return self.globalRect |
928 | 197 | 186 | ||
929 | 198 | 187 | ||
930 | 199 | class MenuView(UnityIntrospectionObject): | 188 | class MenuView(UnityIntrospectionObject): |
931 | @@ -215,8 +204,8 @@ | |||
932 | 215 | 204 | ||
933 | 216 | @property | 205 | @property |
934 | 217 | def geometry(self): | 206 | def geometry(self): |
937 | 218 | """Returns a tuple of (x,y,w,h) for the current menu view.""" | 207 | """Returns a Rectangle (x,y,w,h) for the current menu view.""" |
938 | 219 | return (self.x, self.y, self.width, self.height) | 208 | return self.globalRect |
939 | 220 | 209 | ||
940 | 221 | 210 | ||
941 | 222 | class WindowButtons(UnityIntrospectionObject): | 211 | class WindowButtons(UnityIntrospectionObject): |
942 | @@ -256,8 +245,8 @@ | |||
943 | 256 | 245 | ||
944 | 257 | @property | 246 | @property |
945 | 258 | def geometry(self): | 247 | def geometry(self): |
948 | 259 | """Returns a tuple of (x,y,w,h) for the current panel.""" | 248 | """Returns a Rectangle (x,y,w,h) for the current panel.""" |
949 | 260 | return (self.x, self.y, self.width, self.height) | 249 | return self.globalRect |
950 | 261 | 250 | ||
951 | 262 | 251 | ||
952 | 263 | class WindowButton(UnityIntrospectionObject): | 252 | class WindowButton(UnityIntrospectionObject): |
953 | @@ -268,20 +257,25 @@ | |||
954 | 268 | self._mouse = Mouse.create() | 257 | self._mouse = Mouse.create() |
955 | 269 | 258 | ||
956 | 270 | def mouse_move_to(self): | 259 | def mouse_move_to(self): |
960 | 271 | target_x = self.x + self.width / 2 | 260 | self._mouse.move_to_object(self) |
958 | 272 | target_y = self.y + self.height / 2 | ||
959 | 273 | self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005) | ||
961 | 274 | 261 | ||
962 | 275 | def mouse_click(self): | 262 | def mouse_click(self): |
966 | 276 | self.mouse_move_to() | 263 | # Ignore buttons that are placed at 0x0, as they're invisible yet |
967 | 277 | sleep(.2) | 264 | if not self.x and not self.y and not self.visible: |
968 | 278 | self._mouse.click(press_duration=.1) | 265 | return |
969 | 266 | |||
970 | 267 | self._mouse.click_object(self) | ||
971 | 279 | sleep(.01) | 268 | sleep(.01) |
972 | 280 | 269 | ||
973 | 281 | @property | 270 | @property |
974 | 282 | def geometry(self): | 271 | def geometry(self): |
977 | 283 | """Returns a tuple of (x,y,w,h) for the window button.""" | 272 | """Returns a Rectangle (x,y,w,h) for the window button.""" |
978 | 284 | return (self.x, self.y, self.width, self.height) | 273 | return self.globalRect |
979 | 274 | |||
980 | 275 | def __repr__(self): | ||
981 | 276 | with self.no_automatic_refreshing(): | ||
982 | 277 | details = "type={0.type} state={0.visual_state} sensitive={0.sensitive}".format(self) | ||
983 | 278 | return self._repr_string(details) | ||
984 | 285 | 279 | ||
985 | 286 | 280 | ||
986 | 287 | class GrabArea(UnityIntrospectionObject): | 281 | class GrabArea(UnityIntrospectionObject): |
987 | @@ -289,8 +283,8 @@ | |||
988 | 289 | 283 | ||
989 | 290 | @property | 284 | @property |
990 | 291 | def geometry(self): | 285 | def geometry(self): |
993 | 292 | """Returns a tuple of (x,y,w,h) for the grab area.""" | 286 | """Returns a Rectangle (x,y,w,h) for the grab area.""" |
994 | 293 | return (self.x, self.y, self.width, self.height) | 287 | return self.globalRect |
995 | 294 | 288 | ||
996 | 295 | 289 | ||
997 | 296 | class Indicators(UnityIntrospectionObject): | 290 | class Indicators(UnityIntrospectionObject): |
998 | @@ -314,8 +308,8 @@ | |||
999 | 314 | 308 | ||
1000 | 315 | @property | 309 | @property |
1001 | 316 | def geometry(self): | 310 | def geometry(self): |
1004 | 317 | """Returns a tuple of (x,y,w,h) for the indicators area.""" | 311 | """Returns a Rectangle (x,y,w,h) for the indicators area.""" |
1005 | 318 | return (self.x, self.y, self.width, self.height) | 312 | return self.globalRect |
1006 | 319 | 313 | ||
1007 | 320 | 314 | ||
1008 | 321 | class IndicatorEntry(UnityIntrospectionObject): | 315 | class IndicatorEntry(UnityIntrospectionObject): |
1009 | @@ -326,30 +320,26 @@ | |||
1010 | 326 | self._mouse = Mouse.create() | 320 | self._mouse = Mouse.create() |
1011 | 327 | 321 | ||
1012 | 328 | def mouse_move_to(self): | 322 | def mouse_move_to(self): |
1016 | 329 | target_x = self.x + self.width / 2 | 323 | self._mouse.move_to_object(self) |
1014 | 330 | target_y = self.y + self.height / 2 | ||
1015 | 331 | self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005) | ||
1017 | 332 | 324 | ||
1018 | 333 | def mouse_click(self, button=1): | 325 | def mouse_click(self, button=1): |
1023 | 334 | self.mouse_move_to() | 326 | self._mouse.click_object(self, button=button) |
1020 | 335 | sleep(.2) | ||
1021 | 336 | assert(self.visible) | ||
1022 | 337 | self._mouse.click(press_duration=.1) | ||
1024 | 338 | sleep(.01) | 327 | sleep(.01) |
1025 | 339 | 328 | ||
1026 | 340 | @property | 329 | @property |
1027 | 341 | def geometry(self): | 330 | def geometry(self): |
1030 | 342 | """Returns a tuple of (x,y,w,h) for the indicator entry.""" | 331 | """Returns a Rectangle (x,y,w,h) for the indicator entry.""" |
1031 | 343 | return (self.x, self.y, self.width, self.height) | 332 | return self.globalRect |
1032 | 344 | 333 | ||
1033 | 345 | @property | 334 | @property |
1034 | 346 | def menu_geometry(self): | 335 | def menu_geometry(self): |
1037 | 347 | """Returns a tuple of (x,y,w,h) for the opened menu geometry.""" | 336 | """Returns a Rectangle (x,y,w,h) for the opened menu geometry.""" |
1038 | 348 | return (self.menu_x, self.menu_y, self.menu_width, self.menu_height) | 337 | return Rectangle(self.menu_x, self.menu_y, self.menu_width, self.menu_height) |
1039 | 349 | 338 | ||
1040 | 350 | def __repr__(self): | 339 | def __repr__(self): |
1041 | 351 | with self.no_automatic_refreshing(): | 340 | with self.no_automatic_refreshing(): |
1043 | 352 | return "<IndicatorEntry 0x%x (%s)>" % (id(self), self.label) | 341 | details = "label={0.label}".format(self) |
1044 | 342 | return self._repr_string(details) | ||
1045 | 353 | 343 | ||
1046 | 354 | 344 | ||
1047 | 355 | class Tray(UnityIntrospectionObject): | 345 | class Tray(UnityIntrospectionObject): |
1048 | 356 | 346 | ||
1049 | === modified file 'tests/autopilot/unity/emulators/quicklist.py' | |||
1050 | --- tests/autopilot/unity/emulators/quicklist.py 2013-05-10 05:16:07 +0000 | |||
1051 | +++ tests/autopilot/unity/emulators/quicklist.py 2015-08-24 17:01:53 +0000 | |||
1052 | @@ -66,8 +66,8 @@ | |||
1053 | 66 | 66 | ||
1054 | 67 | @property | 67 | @property |
1055 | 68 | def geometry(self): | 68 | def geometry(self): |
1058 | 69 | """Returns a tuple of (x,y,w,h) for the quicklist.""" | 69 | """Returns a Rectangle (x,y,w,h) for the quicklist.""" |
1059 | 70 | return (self.x, self.y, self.width, self.height) | 70 | return self.globalRect |
1060 | 71 | 71 | ||
1061 | 72 | 72 | ||
1062 | 73 | class QuicklistMenuItem(UnityIntrospectionObject): | 73 | class QuicklistMenuItem(UnityIntrospectionObject): |
1063 | @@ -79,20 +79,17 @@ | |||
1064 | 79 | 79 | ||
1065 | 80 | @property | 80 | @property |
1066 | 81 | def geometry(self): | 81 | def geometry(self): |
1069 | 82 | """Returns a tuple of (x,y,w,h) for the quicklist item.""" | 82 | """Returns a Rectangle (x,y,w,h) for the quicklist item.""" |
1070 | 83 | return (self.x, self.y, self.width, self.height) | 83 | return self.globalRect |
1071 | 84 | 84 | ||
1072 | 85 | def mouse_move_to(self): | 85 | def mouse_move_to(self): |
1073 | 86 | assert(self.visible) | 86 | assert(self.visible) |
1074 | 87 | logger.debug("Moving mouse over quicklist item %r", self) | 87 | logger.debug("Moving mouse over quicklist item %r", self) |
1078 | 88 | target_x = self.x + self.width / 2 | 88 | self._mouse.move_to_object(self) |
1076 | 89 | target_y = self.y + self.height / 2 | ||
1077 | 90 | self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005) | ||
1079 | 91 | 89 | ||
1080 | 92 | def mouse_click(self, button=1): | 90 | def mouse_click(self, button=1): |
1081 | 93 | logger.debug("Clicking on quicklist item %r", self) | 91 | logger.debug("Clicking on quicklist item %r", self) |
1084 | 94 | self.mouse_move_to() | 92 | self._mouse.click_object(self) |
1083 | 95 | self._mouse.click() | ||
1085 | 96 | 93 | ||
1086 | 97 | 94 | ||
1087 | 98 | class QuicklistMenuItemLabel(QuicklistMenuItem): | 95 | class QuicklistMenuItemLabel(QuicklistMenuItem): |
1088 | 99 | 96 | ||
1089 | === modified file 'tests/autopilot/unity/emulators/screen.py' | |||
1090 | --- tests/autopilot/unity/emulators/screen.py 2014-02-20 21:37:37 +0000 | |||
1091 | +++ tests/autopilot/unity/emulators/screen.py 2015-08-24 17:01:53 +0000 | |||
1092 | @@ -13,6 +13,7 @@ | |||
1093 | 13 | from unity.emulators import UnityIntrospectionObject | 13 | from unity.emulators import UnityIntrospectionObject |
1094 | 14 | from testtools.matchers import GreaterThan | 14 | from testtools.matchers import GreaterThan |
1095 | 15 | 15 | ||
1096 | 16 | from autopilot.introspection.types import Rectangle | ||
1097 | 16 | from unity.emulators.dash import SearchBar | 17 | from unity.emulators.dash import SearchBar |
1098 | 17 | 18 | ||
1099 | 18 | logger = logging.getLogger(__name__) | 19 | logger = logging.getLogger(__name__) |
1100 | @@ -54,15 +55,15 @@ | |||
1101 | 54 | 55 | ||
1102 | 55 | @property | 56 | @property |
1103 | 56 | def geometry(self): | 57 | def geometry(self): |
1106 | 57 | """Returns a tuple of (x,y,w,h) for the current window.""" | 58 | """Returns a Rectangle (x,y,w,h) for the current window.""" |
1107 | 58 | return (self.x, self.y, self.width, self.height) | 59 | return self.globalRect |
1108 | 59 | 60 | ||
1109 | 60 | @property | 61 | @property |
1110 | 61 | def scale_close_geometry(self): | 62 | def scale_close_geometry(self): |
1112 | 62 | """Returns a tuple of (x,y,w,h) for the scale close button.""" | 63 | """Returns a Rectangle (x,y,w,h) for the scale close button.""" |
1113 | 63 | self.scaled_close_width.wait_for(GreaterThan(0)) | 64 | self.scaled_close_width.wait_for(GreaterThan(0)) |
1114 | 64 | self.scaled_close_height.wait_for(GreaterThan(0)) | 65 | self.scaled_close_height.wait_for(GreaterThan(0)) |
1116 | 65 | return (self.scaled_close_x, self.scaled_close_y, self.scaled_close_width, self.scaled_close_height) | 66 | return Rectangle(self.scaled_close_x, self.scaled_close_y, self.scaled_close_width, self.scaled_close_height) |
1117 | 66 | 67 | ||
1118 | 67 | 68 | ||
1119 | 68 | class SpreadFilter(UnityIntrospectionObject): | 69 | class SpreadFilter(UnityIntrospectionObject): |
1120 | 69 | 70 | ||
1121 | === modified file 'tests/autopilot/unity/emulators/window_manager.py' | |||
1122 | --- tests/autopilot/unity/emulators/window_manager.py 2013-10-02 23:33:55 +0000 | |||
1123 | +++ tests/autopilot/unity/emulators/window_manager.py 2015-08-24 17:01:53 +0000 | |||
1124 | @@ -10,6 +10,7 @@ | |||
1125 | 10 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
1126 | 11 | 11 | ||
1127 | 12 | import logging | 12 | import logging |
1128 | 13 | from autopilot.introspection.types import Rectangle | ||
1129 | 13 | from autopilot.keybindings import KeybindingsHelper | 14 | from autopilot.keybindings import KeybindingsHelper |
1130 | 14 | 15 | ||
1131 | 15 | from unity.emulators import UnityIntrospectionObject | 16 | from unity.emulators import UnityIntrospectionObject |
1132 | @@ -22,8 +23,8 @@ | |||
1133 | 22 | 23 | ||
1134 | 23 | @property | 24 | @property |
1135 | 24 | def screen_geometry(self): | 25 | def screen_geometry(self): |
1138 | 25 | """Returns a tuple of (x,y,w,h) for the screen.""" | 26 | """Returns a Rectangle (x,y,w,h) for the screen.""" |
1139 | 26 | return (self.x, self.y, self.width, self.height) | 27 | return self.globalRect |
1140 | 27 | 28 | ||
1141 | 28 | def initiate_spread(self): | 29 | def initiate_spread(self): |
1142 | 29 | self.keybinding("spread/start") | 30 | self.keybinding("spread/start") |
1143 | 30 | 31 | ||
1144 | === modified file 'tests/autopilot/unity/tests/launcher/test_icon_behavior.py' | |||
1145 | --- tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2015-03-25 14:59:04 +0000 | |||
1146 | +++ tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2015-08-24 17:01:53 +0000 | |||
1147 | @@ -384,7 +384,7 @@ | |||
1148 | 384 | self.drag_type) | 384 | self.drag_type) |
1149 | 385 | moved_icon = self.unity.launcher.model.\ | 385 | moved_icon = self.unity.launcher.model.\ |
1150 | 386 | get_launcher_icons_for_monitor(self.launcher_monitor)[1] | 386 | get_launcher_icons_for_monitor(self.launcher_monitor)[1] |
1152 | 387 | self.assertThat(moved_icon.id, Equals(calc_icon.id)) | 387 | self.assertThat(moved_icon, Equals(calc_icon)) |
1153 | 388 | 388 | ||
1154 | 389 | def test_can_drag_icon_below_window_switcher(self): | 389 | def test_can_drag_icon_below_window_switcher(self): |
1155 | 390 | """Application icons must be dragable to below the workspace switcher icon.""" | 390 | """Application icons must be dragable to below the workspace switcher icon.""" |
1156 | 391 | 391 | ||
1157 | === modified file 'tests/autopilot/unity/tests/launcher/test_visual.py' | |||
1158 | --- tests/autopilot/unity/tests/launcher/test_visual.py 2013-12-11 19:12:58 +0000 | |||
1159 | +++ tests/autopilot/unity/tests/launcher/test_visual.py 2015-08-24 17:01:53 +0000 | |||
1160 | @@ -71,14 +71,12 @@ | |||
1161 | 71 | 71 | ||
1162 | 72 | def test_mouse_over_with_dash_open_desaturates_icons(self): | 72 | def test_mouse_over_with_dash_open_desaturates_icons(self): |
1163 | 73 | """Moving mouse over launcher with dash open must saturate icons.""" | 73 | """Moving mouse over launcher with dash open must saturate icons.""" |
1164 | 74 | launcher_instance = self.get_launcher() | ||
1165 | 75 | self.unity.dash.ensure_visible() | 74 | self.unity.dash.ensure_visible() |
1166 | 76 | current_monitor = self.unity.dash.monitor | 75 | current_monitor = self.unity.dash.monitor |
1167 | 77 | 76 | ||
1168 | 78 | self.addCleanup(self.unity.dash.ensure_hidden) | 77 | self.addCleanup(self.unity.dash.ensure_hidden) |
1169 | 79 | sleep(.5) | 78 | sleep(.5) |
1172 | 80 | x,y,w,h = launcher_instance.geometry | 79 | self.mouse.move_to_object(self.get_launcher()) |
1171 | 81 | self.mouse.move(x + w/2, y + h/2) | ||
1173 | 82 | sleep(.5) | 80 | sleep(.5) |
1174 | 83 | for icon in self.unity.launcher.model.get_launcher_icons(): | 81 | for icon in self.unity.launcher.model.get_launcher_icons(): |
1175 | 84 | self.assertFalse(icon.monitors_desaturated[current_monitor]) | 82 | self.assertFalse(icon.monitors_desaturated[current_monitor]) |
1176 | 85 | 83 | ||
1177 | === modified file 'tests/autopilot/unity/tests/test_dash.py' | |||
1178 | --- tests/autopilot/unity/tests/test_dash.py 2015-02-19 19:23:39 +0000 | |||
1179 | +++ tests/autopilot/unity/tests/test_dash.py 2015-08-24 17:01:53 +0000 | |||
1180 | @@ -400,10 +400,11 @@ | |||
1181 | 400 | 400 | ||
1182 | 401 | # Test that tab cycles through the categories. | 401 | # Test that tab cycles through the categories. |
1183 | 402 | # + 1 is the filter bar | 402 | # + 1 is the filter bar |
1185 | 403 | for i in range(scope.get_num_visible_categories()): | 403 | for category in scope.get_categories(only_visible=True): |
1186 | 404 | self.keyboard.press_and_release('Tab') | 404 | self.keyboard.press_and_release('Tab') |
1189 | 405 | category = scope.get_focused_category() | 405 | selected = scope.get_focused_category() |
1190 | 406 | self.assertIsNot(category, None) | 406 | expected = category if category.expand_label_is_visible else None |
1191 | 407 | self.assertEqual(selected, expected) | ||
1192 | 407 | 408 | ||
1193 | 408 | def test_tab_with_filter_bar(self): | 409 | def test_tab_with_filter_bar(self): |
1194 | 409 | """ This test makes sure that Tab works well with the filter bara.""" | 410 | """ This test makes sure that Tab works well with the filter bara.""" |
1195 | @@ -544,10 +545,7 @@ | |||
1196 | 544 | 545 | ||
1197 | 545 | self.unity.dash.ensure_visible() | 546 | self.unity.dash.ensure_visible() |
1198 | 546 | 547 | ||
1203 | 547 | self.mouse.move(self.unity.dash.searchbar.x + self.unity.dash.searchbar.width / 2, | 548 | self.mouse.click_object(self.unity.dash.searchbar, button=2) |
1200 | 548 | self.unity.dash.searchbar.y + self.unity.dash.searchbar.height / 2) | ||
1201 | 549 | |||
1202 | 550 | self.mouse.click(button=2) | ||
1204 | 551 | 549 | ||
1205 | 552 | self.assertThat(self.unity.dash.search_string, Eventually(Equals('ThirdButtonPaste'))) | 550 | self.assertThat(self.unity.dash.search_string, Eventually(Equals('ThirdButtonPaste'))) |
1206 | 553 | 551 | ||
1207 | @@ -691,7 +689,7 @@ | |||
1208 | 691 | 689 | ||
1209 | 692 | self.unity.dash.ensure_visible() | 690 | self.unity.dash.ensure_visible() |
1210 | 693 | 691 | ||
1212 | 694 | self.assertThat(self.unity.dash.geometry[0], Eventually(Equals(launcher.geometry[0] + launcher.geometry[2] - 1))) | 692 | self.assertThat(self.unity.dash.view.x, Eventually(Equals(launcher.geometry.x + launcher.geometry.width - 1))) |
1213 | 695 | 693 | ||
1214 | 696 | 694 | ||
1215 | 697 | def test_see_more_result_alignment(self): | 695 | def test_see_more_result_alignment(self): |
1216 | @@ -701,11 +699,9 @@ | |||
1217 | 701 | self.unity.dash.reveal_application_scope() | 699 | self.unity.dash.reveal_application_scope() |
1218 | 702 | 700 | ||
1219 | 703 | scope = self.unity.dash.get_current_scope() | 701 | scope = self.unity.dash.get_current_scope() |
1225 | 704 | self.assertThat(lambda: len(scope.get_groups()), Eventually(GreaterThan(0), timeout=20)) | 702 | self.assertThat(lambda: len(scope.get_categories()), Eventually(GreaterThan(0), timeout=20)) |
1226 | 705 | 703 | ||
1227 | 706 | groups = scope.get_groups() | 704 | for group in scope.get_categories(): |
1223 | 707 | |||
1224 | 708 | for group in groups: | ||
1228 | 709 | if (group.is_visible and group.expand_label_is_visible): | 705 | if (group.is_visible and group.expand_label_is_visible): |
1229 | 710 | expand_label_y = group.expand_label_y + group.expand_label_baseline | 706 | expand_label_y = group.expand_label_y + group.expand_label_baseline |
1230 | 711 | name_label_y = group.name_label_y + group.name_label_baseline | 707 | name_label_y = group.name_label_y + group.name_label_baseline |
1231 | @@ -725,10 +721,7 @@ | |||
1232 | 725 | the rectangle outside of the icon. | 721 | the rectangle outside of the icon. |
1233 | 726 | """ | 722 | """ |
1234 | 727 | app_icon = self.scopebar.get_icon_by_name(u'applications.scope') | 723 | app_icon = self.scopebar.get_icon_by_name(u'applications.scope') |
1239 | 728 | 724 | self.mouse.click_object(app_icon) | |
1236 | 729 | self.mouse.move(app_icon.x + (app_icon.width / 2), | ||
1237 | 730 | app_icon.y + (app_icon.height / 2)) | ||
1238 | 731 | self.mouse.click() | ||
1240 | 732 | 725 | ||
1241 | 733 | self.assertThat(self.scopebar.active_scope, Eventually(Equals('applications.scope'))) | 726 | self.assertThat(self.scopebar.active_scope, Eventually(Equals('applications.scope'))) |
1242 | 734 | 727 | ||
1243 | @@ -1119,10 +1112,7 @@ | |||
1244 | 1119 | cover_art = self.get_current_preview().cover_art[0] | 1112 | cover_art = self.get_current_preview().cover_art[0] |
1245 | 1120 | 1113 | ||
1246 | 1121 | # click the cover-art (this will set focus) | 1114 | # click the cover-art (this will set focus) |
1251 | 1122 | tx = cover_art.x + (cover_art.width / 2) | 1115 | self.mouse.click_object(cover_art) |
1248 | 1123 | ty = cover_art.y + (cover_art.height / 2) | ||
1249 | 1124 | self.mouse.move(tx, ty) | ||
1250 | 1125 | self.mouse.click() | ||
1252 | 1126 | 1116 | ||
1253 | 1127 | self.keyboard.press_and_release("Escape") | 1117 | self.keyboard.press_and_release("Escape") |
1254 | 1128 | 1118 | ||
1255 | @@ -1138,13 +1128,21 @@ | |||
1256 | 1138 | class PreviewClickCancelTests(DashTestCase): | 1128 | class PreviewClickCancelTests(DashTestCase): |
1257 | 1139 | """Tests that the preview closes when left, middle, and right clicking in the preview""" | 1129 | """Tests that the preview closes when left, middle, and right clicking in the preview""" |
1258 | 1140 | 1130 | ||
1259 | 1131 | scenarios = [('Left button', {'clicked_button': 1}), | ||
1260 | 1132 | ('Middle button', {'clicked_button': 2}), | ||
1261 | 1133 | ('Right button', {'clicked_button': 3})] | ||
1262 | 1134 | |||
1263 | 1141 | def setUp(self): | 1135 | def setUp(self): |
1264 | 1142 | super(PreviewClickCancelTests, self).setUp() | 1136 | super(PreviewClickCancelTests, self).setUp() |
1265 | 1143 | gettext.install("unity-scope-applications") | 1137 | gettext.install("unity-scope-applications") |
1267 | 1144 | scope = self.unity.dash.reveal_application_scope() | 1138 | scope = self.unity.dash.reveal_application_scope(clear_search=False) |
1268 | 1145 | self.addCleanup(self.unity.dash.ensure_hidden) | 1139 | self.addCleanup(self.unity.dash.ensure_hidden) |
1269 | 1146 | # Only testing an application preview for this test. | 1140 | # Only testing an application preview for this test. |
1271 | 1147 | self.keyboard.type("Software Updater") | 1141 | |
1272 | 1142 | search_string = "Software Updater" | ||
1273 | 1143 | if self.unity.dash.search_string != search_string: | ||
1274 | 1144 | self.unity.dash.clear_search() | ||
1275 | 1145 | self.keyboard.type(search_string) | ||
1276 | 1148 | 1146 | ||
1277 | 1149 | # wait for "Installed" category | 1147 | # wait for "Installed" category |
1278 | 1150 | category = self.wait_for_category(scope, _("Installed")) | 1148 | category = self.wait_for_category(scope, _("Installed")) |
1279 | @@ -1159,183 +1157,43 @@ | |||
1280 | 1159 | 1157 | ||
1281 | 1160 | self.preview_container = self.unity.dash.view.get_preview_container() | 1158 | self.preview_container = self.unity.dash.view.get_preview_container() |
1282 | 1161 | 1159 | ||
1460 | 1162 | def test_left_click_on_preview_icon_cancel_preview(self): | 1160 | def test_click_on_preview_icon_cancel_preview(self): |
1461 | 1163 | """Left click on preview icon must close preview.""" | 1161 | """Clicking with any button on preview icon must close preview.""" |
1462 | 1164 | icon = self.get_current_preview().icon[0] | 1162 | icon = self.get_current_preview().icon[0] |
1463 | 1165 | self.assertThat(icon, NotEquals(None)) | 1163 | self.assertThat(icon, NotEquals(None)) |
1464 | 1166 | 1164 | ||
1465 | 1167 | tx = icon.x + icon.width | 1165 | self.mouse.click_object(icon, button=self.clicked_button) |
1466 | 1168 | ty = icon.y + (icon.height / 2) | 1166 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) |
1467 | 1169 | self.mouse.move(tx, ty) | 1167 | |
1468 | 1170 | self.mouse.click(button=1) | 1168 | def test_click_on_preview_image_cancel_preview(self): |
1469 | 1171 | 1169 | """Clicking with any button on preview image must cancel the preview.""" | |
1470 | 1172 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | 1170 | cover_art = self.get_current_preview().cover_art[0] |
1471 | 1173 | 1171 | self.assertThat(cover_art, NotEquals(None)) | |
1472 | 1174 | def test_middle_click_on_preview_icon_cancel_preview(self): | 1172 | |
1473 | 1175 | """Middle click on preview icon must close preview.""" | 1173 | self.mouse.click_object(cover_art, button=self.clicked_button) |
1474 | 1176 | icon = self.get_current_preview().icon[0] | 1174 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) |
1475 | 1177 | self.assertThat(icon, NotEquals(None)) | 1175 | |
1476 | 1178 | 1176 | def test_click_on_preview_text_cancel_preview(self): | |
1477 | 1179 | tx = icon.x + icon.width | 1177 | """Clicking with any button on some preview text must cancel the preview.""" |
1478 | 1180 | ty = icon.y + (icon.height / 2) | 1178 | text = self.get_current_preview().text_boxes[0] |
1479 | 1181 | self.mouse.move(tx, ty) | 1179 | self.assertThat(text, NotEquals(None)) |
1480 | 1182 | self.mouse.click(button=2) | 1180 | self.mouse.click_object(text, button=self.clicked_button) |
1481 | 1183 | 1181 | ||
1482 | 1184 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | 1182 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) |
1483 | 1185 | 1183 | ||
1484 | 1186 | def test_right_click_on_preview_icon_cancel_preview(self): | 1184 | def test_click_on_preview_ratings_widget_cancel_preview(self): |
1485 | 1187 | """Right click on preview icon must close preview.""" | 1185 | """Clicking with any button on the ratings widget must cancel the preview.""" |
1486 | 1188 | icon = self.get_current_preview().icon[0] | 1186 | ratings_widget = self.get_current_preview().ratings_widget[0] |
1487 | 1189 | self.assertThat(icon, NotEquals(None)) | 1187 | self.assertThat(ratings_widget, NotEquals(None)) |
1488 | 1190 | 1188 | self.mouse.click_object(ratings_widget, button=self.clicked_button) | |
1489 | 1191 | tx = icon.x + icon.width | 1189 | |
1490 | 1192 | ty = icon.y + (icon.height / 2) | 1190 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) |
1491 | 1193 | self.mouse.move(tx, ty) | 1191 | |
1492 | 1194 | self.mouse.click(button=3) | 1192 | def test_click_on_preview_info_hint_cancel_preview(self): |
1493 | 1195 | 1193 | """Clicking with any button on the info hint must cancel the preview.""" | |
1494 | 1196 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | 1194 | info_hint = self.get_current_preview().info_hint_widget[0] |
1495 | 1197 | 1195 | self.assertThat(info_hint, NotEquals(None)) | |
1496 | 1198 | def test_left_click_on_preview_image_cancel_preview(self): | 1196 | self.mouse.click_object(info_hint, button=self.clicked_button) |
1320 | 1199 | """Left click on preview image must cancel the preview.""" | ||
1321 | 1200 | cover_art = self.get_current_preview().cover_art[0] | ||
1322 | 1201 | self.assertThat(cover_art, NotEquals(None)) | ||
1323 | 1202 | |||
1324 | 1203 | tx = cover_art.x + (cover_art.width / 2) | ||
1325 | 1204 | ty = cover_art.y + (cover_art.height / 2) | ||
1326 | 1205 | self.mouse.move(tx, ty) | ||
1327 | 1206 | self.mouse.click(button=1) | ||
1328 | 1207 | |||
1329 | 1208 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1330 | 1209 | |||
1331 | 1210 | def test_middle_click_on_preview_image_cancel_preview(self): | ||
1332 | 1211 | """Middle click on preview image must cancel the preview.""" | ||
1333 | 1212 | cover_art = self.get_current_preview().cover_art[0] | ||
1334 | 1213 | self.assertThat(cover_art, NotEquals(None)) | ||
1335 | 1214 | |||
1336 | 1215 | tx = cover_art.x + (cover_art.width / 2) | ||
1337 | 1216 | ty = cover_art.y + (cover_art.height / 2) | ||
1338 | 1217 | self.mouse.move(tx, ty) | ||
1339 | 1218 | self.mouse.click(button=2) | ||
1340 | 1219 | |||
1341 | 1220 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1342 | 1221 | |||
1343 | 1222 | def test_right_click_on_preview_image_cancel_preview(self): | ||
1344 | 1223 | """Right click on preview image must cancel the preview.""" | ||
1345 | 1224 | cover_art = self.get_current_preview().cover_art[0] | ||
1346 | 1225 | self.assertThat(cover_art, NotEquals(None)) | ||
1347 | 1226 | |||
1348 | 1227 | tx = cover_art.x + (cover_art.width / 2) | ||
1349 | 1228 | ty = cover_art.y + (cover_art.height / 2) | ||
1350 | 1229 | self.mouse.move(tx, ty) | ||
1351 | 1230 | self.mouse.click(button=3) | ||
1352 | 1231 | |||
1353 | 1232 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1354 | 1233 | |||
1355 | 1234 | def test_left_click_on_preview_text_cancel_preview(self): | ||
1356 | 1235 | """Left click on some preview text must cancel the preview.""" | ||
1357 | 1236 | text = self.get_current_preview().text_boxes[0] | ||
1358 | 1237 | self.assertThat(text, NotEquals(None)) | ||
1359 | 1238 | |||
1360 | 1239 | tx = text.x + (text.width / 2) | ||
1361 | 1240 | ty = text.y + (text.height / 2) | ||
1362 | 1241 | self.mouse.move(tx, ty) | ||
1363 | 1242 | self.mouse.click(button=1) | ||
1364 | 1243 | |||
1365 | 1244 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1366 | 1245 | |||
1367 | 1246 | def test_middle_click_on_preview_text_cancel_preview(self): | ||
1368 | 1247 | """Middle click on some preview text must cancel the preview.""" | ||
1369 | 1248 | text = self.get_current_preview().text_boxes[0] | ||
1370 | 1249 | self.assertThat(text, NotEquals(None)) | ||
1371 | 1250 | |||
1372 | 1251 | tx = text.x + (text.width / 2) | ||
1373 | 1252 | ty = text.y + (text.height / 2) | ||
1374 | 1253 | self.mouse.move(tx, ty) | ||
1375 | 1254 | self.mouse.click(button=2) | ||
1376 | 1255 | |||
1377 | 1256 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1378 | 1257 | |||
1379 | 1258 | def test_right_click_on_preview_text_cancel_preview(self): | ||
1380 | 1259 | """Right click on some preview text must cancel the preview.""" | ||
1381 | 1260 | text = self.get_current_preview().text_boxes[0] | ||
1382 | 1261 | self.assertThat(text, NotEquals(None)) | ||
1383 | 1262 | |||
1384 | 1263 | tx = text.x + (text.width / 2) | ||
1385 | 1264 | ty = text.y + (text.height / 2) | ||
1386 | 1265 | self.mouse.move(tx, ty) | ||
1387 | 1266 | self.mouse.click(button=3) | ||
1388 | 1267 | |||
1389 | 1268 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1390 | 1269 | |||
1391 | 1270 | def test_left_click_on_preview_ratings_widget_cancel_preview(self): | ||
1392 | 1271 | """Left click on the ratings widget must cancel the preview.""" | ||
1393 | 1272 | ratings_widget = self.get_current_preview().ratings_widget[0] | ||
1394 | 1273 | self.assertThat(ratings_widget, NotEquals(None)) | ||
1395 | 1274 | |||
1396 | 1275 | tx = ratings_widget.x + (ratings_widget.width / 2) | ||
1397 | 1276 | ty = ratings_widget.y + (ratings_widget.height / 2) | ||
1398 | 1277 | self.mouse.move(tx, ty) | ||
1399 | 1278 | self.mouse.click(button=1) | ||
1400 | 1279 | |||
1401 | 1280 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1402 | 1281 | |||
1403 | 1282 | def test_middle_click_on_preview_ratings_widget_cancel_preview(self): | ||
1404 | 1283 | """Middle click on the ratings widget must cancel the preview.""" | ||
1405 | 1284 | ratings_widget = self.get_current_preview().ratings_widget[0] | ||
1406 | 1285 | self.assertThat(ratings_widget, NotEquals(None)) | ||
1407 | 1286 | |||
1408 | 1287 | tx = ratings_widget.x + (ratings_widget.width / 2) | ||
1409 | 1288 | ty = ratings_widget.y + (ratings_widget.height / 2) | ||
1410 | 1289 | self.mouse.move(tx, ty) | ||
1411 | 1290 | self.mouse.click(button=2) | ||
1412 | 1291 | |||
1413 | 1292 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1414 | 1293 | |||
1415 | 1294 | def test_right_click_on_preview_ratings_widget_cancel_preview(self): | ||
1416 | 1295 | """Right click on the ratings widget must cancel the preview.""" | ||
1417 | 1296 | ratings_widget = self.get_current_preview().ratings_widget[0] | ||
1418 | 1297 | self.assertThat(ratings_widget, NotEquals(None)) | ||
1419 | 1298 | |||
1420 | 1299 | tx = ratings_widget.x + (ratings_widget.width / 2) | ||
1421 | 1300 | ty = ratings_widget.y + (ratings_widget.height / 2) | ||
1422 | 1301 | self.mouse.move(tx, ty) | ||
1423 | 1302 | self.mouse.click(button=3) | ||
1424 | 1303 | |||
1425 | 1304 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1426 | 1305 | |||
1427 | 1306 | def test_left_click_on_preview_info_hint_cancel_preview(self): | ||
1428 | 1307 | """Left click on the info hint must cancel the preview.""" | ||
1429 | 1308 | info_hint = self.get_current_preview().info_hint_widget[0] | ||
1430 | 1309 | self.assertThat(info_hint, NotEquals(None)) | ||
1431 | 1310 | |||
1432 | 1311 | tx = info_hint.x + (info_hint.width / 2) | ||
1433 | 1312 | ty = info_hint.y + (info_hint.height / 8) | ||
1434 | 1313 | self.mouse.move(tx, ty) | ||
1435 | 1314 | self.mouse.click(button=1) | ||
1436 | 1315 | |||
1437 | 1316 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1438 | 1317 | |||
1439 | 1318 | def test_middle_click_on_preview_info_hint_cancel_preview(self): | ||
1440 | 1319 | """Middle click on the info hint must cancel the preview.""" | ||
1441 | 1320 | info_hint = self.get_current_preview().info_hint_widget[0] | ||
1442 | 1321 | self.assertThat(info_hint, NotEquals(None)) | ||
1443 | 1322 | |||
1444 | 1323 | tx = info_hint.x + (info_hint.width / 2) | ||
1445 | 1324 | ty = info_hint.y + (info_hint.height / 8) | ||
1446 | 1325 | self.mouse.move(tx, ty) | ||
1447 | 1326 | self.mouse.click(button=2) | ||
1448 | 1327 | |||
1449 | 1328 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | ||
1450 | 1329 | |||
1451 | 1330 | def test_right_click_on_preview_info_hint_cancel_preview(self): | ||
1452 | 1331 | """Right click on the info hint must cancel the preview.""" | ||
1453 | 1332 | info_hint = self.get_current_preview().info_hint_widget[0] | ||
1454 | 1333 | self.assertThat(info_hint, NotEquals(None)) | ||
1455 | 1334 | |||
1456 | 1335 | tx = info_hint.x + (info_hint.width / 2) | ||
1457 | 1336 | ty = info_hint.y + (info_hint.height / 8) | ||
1458 | 1337 | self.mouse.move(tx, ty) | ||
1459 | 1338 | self.mouse.click(button=3) | ||
1497 | 1339 | 1197 | ||
1498 | 1340 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) | 1198 | self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False))) |
1499 | 1341 | 1199 | ||
1500 | @@ -1401,3 +1259,4 @@ | |||
1501 | 1401 | self.addCleanup(self.unity.dash.ensure_hidden) | 1259 | self.addCleanup(self.unity.dash.ensure_hidden) |
1502 | 1402 | 1260 | ||
1503 | 1403 | self.assertThat(self.unity.dash.visible, Eventually(Equals(True))) | 1261 | self.assertThat(self.unity.dash.visible, Eventually(Equals(True))) |
1504 | 1262 | |||
1505 | 1404 | 1263 | ||
1506 | === modified file 'tests/autopilot/unity/tests/test_panel.py' | |||
1507 | --- tests/autopilot/unity/tests/test_panel.py 2015-02-19 14:41:09 +0000 | |||
1508 | +++ tests/autopilot/unity/tests/test_panel.py 2015-08-24 17:01:53 +0000 | |||
1509 | @@ -78,8 +78,7 @@ | |||
1510 | 78 | self.keybinding("window/restore") | 78 | self.keybinding("window/restore") |
1511 | 79 | self.addCleanup(self.keybinding, "window/maximize") | 79 | self.addCleanup(self.keybinding, "window/maximize") |
1512 | 80 | 80 | ||
1515 | 81 | sleep(.25) | 81 | self.assertThat(lambda: win.is_maximized, Eventually(Equals(maximized))) |
1514 | 82 | self.assertProperty(win, is_maximized=maximized) | ||
1516 | 83 | 82 | ||
1517 | 84 | def open_new_application_window(self, app_name, maximized=False, move_to_monitor=True): | 83 | def open_new_application_window(self, app_name, maximized=False, move_to_monitor=True): |
1518 | 85 | """Opens a new instance of the requested application, ensuring that only | 84 | """Opens a new instance of the requested application, ensuring that only |
1519 | @@ -93,8 +92,8 @@ | |||
1520 | 93 | app = app_win.application | 92 | app = app_win.application |
1521 | 94 | 93 | ||
1522 | 95 | app_win.set_focus() | 94 | app_win.set_focus() |
1525 | 96 | self.assertTrue(app.is_active) | 95 | self.assertThat(lambda: app.is_active, Eventually(Equals(True))) |
1526 | 97 | self.assertTrue(app_win.is_focused) | 96 | self.assertThat(lambda: app_win.is_focused, Eventually(Equals(True))) |
1527 | 98 | self.assertThat(app.desktop_file, Equals(app_win.application.desktop_file)) | 97 | self.assertThat(app.desktop_file, Equals(app_win.application.desktop_file)) |
1528 | 99 | 98 | ||
1529 | 100 | if move_to_monitor: | 99 | if move_to_monitor: |
1530 | @@ -431,7 +430,6 @@ | |||
1531 | 431 | self.addCleanup(self.unity.hud.ensure_hidden) | 430 | self.addCleanup(self.unity.hud.ensure_hidden) |
1532 | 432 | 431 | ||
1533 | 433 | self.panel.window_buttons.maximize.mouse_click() | 432 | self.panel.window_buttons.maximize.mouse_click() |
1534 | 434 | |||
1535 | 435 | self.assertThat(self.unity.hud.visible, Eventually(Equals(True))) | 433 | self.assertThat(self.unity.hud.visible, Eventually(Equals(True))) |
1536 | 436 | 434 | ||
1537 | 437 | def test_hud_maximize_button_does_not_change_dash_form_factor(self): | 435 | def test_hud_maximize_button_does_not_change_dash_form_factor(self): |
1538 | @@ -986,7 +984,7 @@ | |||
1539 | 986 | 984 | ||
1540 | 987 | def open_app_and_get_menu_entry(self): | 985 | def open_app_and_get_menu_entry(self): |
1541 | 988 | """Open the test app and wait for the menu entry to appear.""" | 986 | """Open the test app and wait for the menu entry to appear.""" |
1543 | 989 | self.open_new_application_window("Remmina" if self.lim else "Calculator", | 987 | self.open_new_application_window("Text Editor" if self.lim else "Calculator", |
1544 | 990 | maximized=self.lim) | 988 | maximized=self.lim) |
1545 | 991 | 989 | ||
1546 | 992 | refresh_fn = lambda: len(self.panel.menus.get_entries()) | 990 | refresh_fn = lambda: len(self.panel.menus.get_entries()) |
1547 | @@ -1043,7 +1041,8 @@ | |||
1548 | 1043 | self.assertThat(menu_entry.active, Eventually(Equals(True))) | 1041 | self.assertThat(menu_entry.active, Eventually(Equals(True))) |
1549 | 1044 | 1042 | ||
1550 | 1045 | self.open_new_application_window("Text Editor") | 1043 | self.open_new_application_window("Text Editor") |
1552 | 1046 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) | 1044 | get_active_indicator_fn = lambda: self.unity.panels.get_active_indicator() |
1553 | 1045 | self.assertThat(get_active_indicator_fn, Eventually(Equals(None))) | ||
1554 | 1047 | 1046 | ||
1555 | 1048 | def test_indicator_opens_when_dash_is_open(self): | 1047 | def test_indicator_opens_when_dash_is_open(self): |
1556 | 1049 | """When the dash is open and a click is on an indicator the dash | 1048 | """When the dash is open and a click is on an indicator the dash |
1557 | @@ -1068,8 +1067,9 @@ | |||
1558 | 1068 | This method will wait until the active indicator has been set. | 1067 | This method will wait until the active indicator has been set. |
1559 | 1069 | 1068 | ||
1560 | 1070 | """ | 1069 | """ |
1563 | 1071 | self.assertThat(self.panel.get_active_indicator, Eventually(NotEquals(None))) | 1070 | get_active_indicator_fn = lambda: self.panel.get_active_indicator() |
1564 | 1072 | return self.panel.get_active_indicator() | 1071 | self.assertThat(get_active_indicator_fn, Eventually(NotEquals(None))) |
1565 | 1072 | return get_active_indicator_fn() | ||
1566 | 1073 | 1073 | ||
1567 | 1074 | def test_panel_first_menu_show_works(self): | 1074 | def test_panel_first_menu_show_works(self): |
1568 | 1075 | """Pressing the open-menus keybinding must open the first indicator.""" | 1075 | """Pressing the open-menus keybinding must open the first indicator.""" |
1569 | @@ -1185,9 +1185,7 @@ | |||
1570 | 1185 | self.assertProperty(text_win, is_focused=False) | 1185 | self.assertProperty(text_win, is_focused=False) |
1571 | 1186 | self.assertProperty(calc_win, is_focused=True) | 1186 | self.assertProperty(calc_win, is_focused=True) |
1572 | 1187 | 1187 | ||
1576 | 1188 | self.move_mouse_over_grab_area() | 1188 | self.mouse.click_object(self.panel.grab_area, button=1) |
1574 | 1189 | self.mouse.click() | ||
1575 | 1190 | |||
1577 | 1191 | self.assertProperty(text_win, is_focused=True) | 1189 | self.assertProperty(text_win, is_focused=True) |
1578 | 1192 | 1190 | ||
1579 | 1193 | def test_lower_the_maximized_window_works(self): | 1191 | def test_lower_the_maximized_window_works(self): |
1580 | @@ -1198,8 +1196,7 @@ | |||
1581 | 1198 | self.assertProperty(text_win, is_focused=True) | 1196 | self.assertProperty(text_win, is_focused=True) |
1582 | 1199 | self.assertProperty(calc_win, is_focused=False) | 1197 | self.assertProperty(calc_win, is_focused=False) |
1583 | 1200 | 1198 | ||
1586 | 1201 | self.move_mouse_over_grab_area() | 1199 | self.mouse.click_object(self.panel.grab_area, button=2) |
1585 | 1202 | self.mouse.click(2) | ||
1587 | 1203 | 1200 | ||
1588 | 1204 | self.assertProperty(calc_win, is_focused=True) | 1201 | self.assertProperty(calc_win, is_focused=True) |
1589 | 1205 | 1202 | ||
1590 | @@ -1209,8 +1206,7 @@ | |||
1591 | 1209 | self.addCleanup(self.unity.hud.ensure_hidden) | 1206 | self.addCleanup(self.unity.hud.ensure_hidden) |
1592 | 1210 | 1207 | ||
1593 | 1211 | self.keyboard.type("Hello") | 1208 | self.keyboard.type("Hello") |
1596 | 1212 | self.move_mouse_over_grab_area() | 1209 | self.mouse.click_object(self.panel.grab_area) |
1595 | 1213 | self.mouse.click() | ||
1597 | 1214 | self.keyboard.type("World") | 1210 | self.keyboard.type("World") |
1598 | 1215 | 1211 | ||
1599 | 1216 | self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld"))) | 1212 | self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld"))) |
1600 | 1217 | 1213 | ||
1601 | === modified file 'tests/autopilot/unity/tests/test_quicklist.py' | |||
1602 | --- tests/autopilot/unity/tests/test_quicklist.py 2015-03-25 14:59:04 +0000 | |||
1603 | +++ tests/autopilot/unity/tests/test_quicklist.py 2015-08-24 17:01:53 +0000 | |||
1604 | @@ -269,7 +269,7 @@ | |||
1605 | 269 | def assertCorrectItemSelected(self, item): | 269 | def assertCorrectItemSelected(self, item): |
1606 | 270 | """Ensure the item considers itself selected and that quicklist agrees.""" | 270 | """Ensure the item considers itself selected and that quicklist agrees.""" |
1607 | 271 | self.assertThat(item.selected, Eventually(Equals(True))) | 271 | self.assertThat(item.selected, Eventually(Equals(True))) |
1609 | 272 | self.assertThat(self.quicklist.selected_item.id, Equals(item.id)) | 272 | self.assertThat(self.quicklist.selected_item, Equals(item)) |
1610 | 273 | 273 | ||
1611 | 274 | def test_keynav_selects_first_item_when_unselected(self): | 274 | def test_keynav_selects_first_item_when_unselected(self): |
1612 | 275 | """Home key MUST select the first selectable item in a quicklist.""" | 275 | """Home key MUST select the first selectable item in a quicklist.""" |
1613 | @@ -402,11 +402,11 @@ | |||
1614 | 402 | 402 | ||
1615 | 403 | # Moving the mouse horizontally doesn't change the selection | 403 | # Moving the mouse horizontally doesn't change the selection |
1616 | 404 | self.mouse.move(mouse_item.x + mouse_item.width - 10, mouse_item.y + mouse_item.height / 2) | 404 | self.mouse.move(mouse_item.x + mouse_item.width - 10, mouse_item.y + mouse_item.height / 2) |
1618 | 405 | self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id)) | 405 | self.assertThat(self.quicklist.selected_item, Equals(key_item)) |
1619 | 406 | 406 | ||
1620 | 407 | # Moving the mouse outside doesn't change the selection | 407 | # Moving the mouse outside doesn't change the selection |
1621 | 408 | self.mouse.move(mouse_item.x + mouse_item.width + 50, mouse_item.y + mouse_item.height / 2) | 408 | self.mouse.move(mouse_item.x + mouse_item.width + 50, mouse_item.y + mouse_item.height / 2) |
1623 | 409 | self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id)) | 409 | self.assertThat(self.quicklist.selected_item, Equals(key_item)) |
1624 | 410 | 410 | ||
1625 | 411 | # Moving the mouse to another entry, changes the selection | 411 | # Moving the mouse to another entry, changes the selection |
1626 | 412 | mouse_item = self.quicklist.selectable_items[-2] | 412 | mouse_item = self.quicklist.selectable_items[-2] |
1627 | 413 | 413 | ||
1628 | === modified file 'tests/autopilot/unity/tests/test_spread.py' | |||
1629 | --- tests/autopilot/unity/tests/test_spread.py 2015-03-24 22:35:27 +0000 | |||
1630 | +++ tests/autopilot/unity/tests/test_spread.py 2015-08-24 17:01:53 +0000 | |||
1631 | @@ -114,11 +114,7 @@ | |||
1632 | 114 | target_xid = not_focused.x_id | 114 | target_xid = not_focused.x_id |
1633 | 115 | [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid] | 115 | [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid] |
1634 | 116 | 116 | ||
1640 | 117 | (x, y, w, h) = target_win.geometry | 117 | self.mouse.click_object(target_win, button=1) |
1636 | 118 | self.mouse.move(x + w / 2, y + h / 2) | ||
1637 | 119 | sleep(.5) | ||
1638 | 120 | self.mouse.click() | ||
1639 | 121 | |||
1641 | 122 | self.assertThat(lambda: not_focused.is_focused, Eventually(Equals(True))) | 118 | self.assertThat(lambda: not_focused.is_focused, Eventually(Equals(True))) |
1642 | 123 | 119 | ||
1643 | 124 | def test_scaled_window_closes_on_middle_click(self): | 120 | def test_scaled_window_closes_on_middle_click(self): |
1644 | @@ -129,10 +125,8 @@ | |||
1645 | 129 | target_xid = win.x_id | 125 | target_xid = win.x_id |
1646 | 130 | [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid] | 126 | [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid] |
1647 | 131 | 127 | ||
1652 | 132 | (x, y, w, h) = target_win.geometry | 128 | sleep(1) |
1653 | 133 | self.mouse.move(x + w / 2, y + h / 2) | 129 | self.mouse.click_object(target_win, button=2) |
1650 | 134 | sleep(.5) | ||
1651 | 135 | self.mouse.click(button=2) | ||
1654 | 136 | 130 | ||
1655 | 137 | self.assertWindowIsScaledEquals(target_xid, False) | 131 | self.assertWindowIsScaledEquals(target_xid, False) |
1656 | 138 | self.assertWindowIsClosed(target_xid) | 132 | self.assertWindowIsClosed(target_xid) |
1657 | @@ -146,13 +140,8 @@ | |||
1658 | 146 | [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid] | 140 | [target_win] = [w for w in self.unity.screen.scaled_windows if w.xid == target_xid] |
1659 | 147 | 141 | ||
1660 | 148 | # Make sure mouse is over the test window | 142 | # Make sure mouse is over the test window |
1668 | 149 | (x1, y1, w1, h1) = target_win.geometry | 143 | self.mouse.move_to_object(target_win) |
1669 | 150 | self.mouse.move(x1 + w1 / 2, y1 + h1 / 2) | 144 | self.mouse.click_object(target_win.scale_close_geometry) |
1663 | 151 | |||
1664 | 152 | (x, y, w, h) = target_win.scale_close_geometry | ||
1665 | 153 | self.mouse.move(x + w / 2, y + h / 2) | ||
1666 | 154 | sleep(.5) | ||
1667 | 155 | self.mouse.click() | ||
1670 | 156 | 145 | ||
1671 | 157 | self.assertWindowIsScaledEquals(target_xid, False) | 146 | self.assertWindowIsScaledEquals(target_xid, False) |
1672 | 158 | self.assertWindowIsClosed(target_xid) | 147 | self.assertWindowIsClosed(target_xid) |
1673 | 159 | 148 | ||
1674 | === modified file 'tests/autopilot/unity/tests/test_switcher.py' | |||
1675 | --- tests/autopilot/unity/tests/test_switcher.py 2014-01-29 20:33:47 +0000 | |||
1676 | +++ tests/autopilot/unity/tests/test_switcher.py 2015-08-24 17:01:53 +0000 | |||
1677 | @@ -629,6 +629,7 @@ | |||
1678 | 629 | def setUp(self): | 629 | def setUp(self): |
1679 | 630 | super(SwitcherDetailsMouseTests, self).setUp() | 630 | super(SwitcherDetailsMouseTests, self).setUp() |
1680 | 631 | self.set_timeout_setting(False) | 631 | self.set_timeout_setting(False) |
1681 | 632 | self.mouse.move(0, 0, animate=False) | ||
1682 | 632 | 633 | ||
1683 | 633 | def test_mouse_highlights_switcher_icons(self): | 634 | def test_mouse_highlights_switcher_icons(self): |
1684 | 634 | """ Tests that the mouse can hightlight all the switcher icons. """ | 635 | """ Tests that the mouse can hightlight all the switcher icons. """ |
1685 | @@ -653,7 +654,7 @@ | |||
1686 | 653 | index = 0; | 654 | index = 0; |
1687 | 654 | for cords in icon_cords: | 655 | for cords in icon_cords: |
1688 | 655 | self.mouse.move(cords[0], cords[1]) | 656 | self.mouse.move(cords[0], cords[1]) |
1690 | 656 | self.assertThat(index, Equals(self.unity.switcher.selection_index)) | 657 | self.assertThat(self.unity.switcher.selection_index, Eventually(Equals(index))) |
1691 | 657 | index += 1 | 658 | index += 1 |
1692 | 658 | 659 | ||
1693 | 659 | def test_mouse_clicks_activate_icon(self): | 660 | def test_mouse_clicks_activate_icon(self): |
1694 | @@ -691,7 +692,7 @@ | |||
1695 | 691 | 692 | ||
1696 | 692 | mouse_index = self.unity.switcher.selection_index - 1 | 693 | mouse_index = self.unity.switcher.selection_index - 1 |
1697 | 693 | 694 | ||
1699 | 694 | self.unity.switcher.view.move_over_icon(mouse_index); | 695 | self.unity.switcher.view.move_over_icon(mouse_index) |
1700 | 695 | # Assert we are over the icon we want to hover over. | 696 | # Assert we are over the icon we want to hover over. |
1701 | 696 | self.assertThat(self.unity.switcher.view.last_icon_selected, Eventually(Equals(mouse_index))) | 697 | self.assertThat(self.unity.switcher.view.last_icon_selected, Eventually(Equals(mouse_index))) |
1702 | 697 | 698 | ||
1703 | @@ -724,11 +725,9 @@ | |||
1704 | 724 | self.unity.switcher.initiate(SwitcherMode.DETAIL) | 725 | self.unity.switcher.initiate(SwitcherMode.DETAIL) |
1705 | 725 | self.addCleanup(self.unity.switcher.terminate) | 726 | self.addCleanup(self.unity.switcher.terminate) |
1706 | 726 | 727 | ||
1709 | 727 | index = 0; | 728 | for index in range(len(self.unity.switcher.view.detail_icons)): |
1708 | 728 | for icon in self.unity.switcher.view.detail_icons: | ||
1710 | 729 | self.unity.switcher.view.move_over_detail_icon(index) | 729 | self.unity.switcher.view.move_over_detail_icon(index) |
1713 | 730 | self.assertThat(index, Equals(self.unity.switcher.detail_selection_index)) | 730 | self.assertThat(self.unity.switcher.detail_selection_index, Eventually(Equals(index))) |
1712 | 731 | index += 1 | ||
1714 | 732 | 731 | ||
1715 | 733 | def test_mouse_click_will_activate_detail_icon(self): | 732 | def test_mouse_click_will_activate_detail_icon(self): |
1716 | 734 | """ | 733 | """ |
1717 | 735 | 734 | ||
1718 | === modified file 'tests/bamf-mock-application.c' | |||
1719 | --- tests/bamf-mock-application.c 2012-11-06 18:19:09 +0000 | |||
1720 | +++ tests/bamf-mock-application.c 2015-08-24 17:01:53 +0000 | |||
1721 | @@ -99,10 +99,24 @@ | |||
1722 | 99 | void | 99 | void |
1723 | 100 | bamf_mock_application_set_children (BamfMockApplication * self, GList * children) | 100 | bamf_mock_application_set_children (BamfMockApplication * self, GList * children) |
1724 | 101 | { | 101 | { |
1725 | 102 | GList *l; | ||
1726 | 103 | |||
1727 | 102 | g_return_if_fail (BAMF_IS_MOCK_APPLICATION (self)); | 104 | g_return_if_fail (BAMF_IS_MOCK_APPLICATION (self)); |
1728 | 103 | 105 | ||
1731 | 104 | g_list_free (self->priv->children); | 106 | for (l = self->priv->children; l;) |
1732 | 105 | self->priv->children = g_list_copy (children); | 107 | { |
1733 | 108 | GList *next = l->next; | ||
1734 | 109 | BamfView *view = l->data; | ||
1735 | 110 | self->priv->children = g_list_delete_link (self->priv->children, l); | ||
1736 | 111 | g_signal_emit_by_name (G_OBJECT (self), "child-removed", view); | ||
1737 | 112 | l = next; | ||
1738 | 113 | } | ||
1739 | 114 | |||
1740 | 115 | for (l = g_list_last (children); l; l = l->prev) | ||
1741 | 116 | { | ||
1742 | 117 | self->priv->children = g_list_prepend (self->priv->children, l->data); | ||
1743 | 118 | g_signal_emit_by_name (G_OBJECT (self), "child-added", l->data); | ||
1744 | 119 | } | ||
1745 | 106 | } | 120 | } |
1746 | 107 | 121 | ||
1747 | 108 | static void | 122 | static void |
1748 | 109 | 123 | ||
1749 | === modified file 'tests/mock-application.h' | |||
1750 | --- tests/mock-application.h 2015-05-22 16:03:30 +0000 | |||
1751 | +++ tests/mock-application.h 2015-08-24 17:01:53 +0000 | |||
1752 | @@ -46,6 +46,7 @@ | |||
1753 | 46 | , active_(false) | 46 | , active_(false) |
1754 | 47 | , urgent_(false) | 47 | , urgent_(false) |
1755 | 48 | { | 48 | { |
1756 | 49 | monitor.SetGetterFunction([this] { return monitor_; }); | ||
1757 | 49 | visible.SetGetterFunction([this] { return visible_; }); | 50 | visible.SetGetterFunction([this] { return visible_; }); |
1758 | 50 | active.SetGetterFunction([this] { return active_; }); | 51 | active.SetGetterFunction([this] { return active_; }); |
1759 | 51 | urgent.SetGetterFunction([this] { return urgent_; }); | 52 | urgent.SetGetterFunction([this] { return urgent_; }); |
1760 | @@ -54,7 +55,6 @@ | |||
1761 | 54 | 55 | ||
1762 | 55 | ON_CALL(*this, type()).WillByDefault(Invoke([this] { return type_; })); | 56 | ON_CALL(*this, type()).WillByDefault(Invoke([this] { return type_; })); |
1763 | 56 | ON_CALL(*this, window_id()).WillByDefault(Invoke([this] { return xid_; })); | 57 | ON_CALL(*this, window_id()).WillByDefault(Invoke([this] { return xid_; })); |
1764 | 57 | ON_CALL(*this, monitor()).WillByDefault(Invoke([this] { return monitor_; })); | ||
1765 | 58 | ON_CALL(*this, Focus()).WillByDefault(Invoke([this] { return LocalFocus(); })); | 58 | ON_CALL(*this, Focus()).WillByDefault(Invoke([this] { return LocalFocus(); })); |
1766 | 59 | ON_CALL(*this, application()).WillByDefault(Return(unity::ApplicationPtr())); | 59 | ON_CALL(*this, application()).WillByDefault(Return(unity::ApplicationPtr())); |
1767 | 60 | } | 60 | } |
1768 | @@ -71,7 +71,6 @@ | |||
1769 | 71 | 71 | ||
1770 | 72 | MOCK_CONST_METHOD0(type, unity::WindowType()); | 72 | MOCK_CONST_METHOD0(type, unity::WindowType()); |
1771 | 73 | MOCK_CONST_METHOD0(window_id, Window()); | 73 | MOCK_CONST_METHOD0(window_id, Window()); |
1772 | 74 | MOCK_CONST_METHOD0(monitor, int()); | ||
1773 | 75 | MOCK_CONST_METHOD0(application, unity::ApplicationPtr()); | 74 | MOCK_CONST_METHOD0(application, unity::ApplicationPtr()); |
1774 | 76 | MOCK_CONST_METHOD0(Focus, bool()); | 75 | MOCK_CONST_METHOD0(Focus, bool()); |
1775 | 77 | MOCK_CONST_METHOD0(Quit, void()); | 76 | MOCK_CONST_METHOD0(Quit, void()); |
1776 | @@ -144,7 +143,7 @@ | |||
1777 | 144 | ON_CALL(*this, type()).WillByDefault(Invoke([this] { return type_; })); | 143 | ON_CALL(*this, type()).WillByDefault(Invoke([this] { return type_; })); |
1778 | 145 | ON_CALL(*this, desktop_id()).WillByDefault(Invoke([this] { return desktop_file_; })); | 144 | ON_CALL(*this, desktop_id()).WillByDefault(Invoke([this] { return desktop_file_; })); |
1779 | 146 | ON_CALL(*this, repr()).WillByDefault(Return("MockApplication")); | 145 | ON_CALL(*this, repr()).WillByDefault(Return("MockApplication")); |
1781 | 147 | ON_CALL(*this, GetWindows()).WillByDefault(Invoke([this] { return windows_; })); | 146 | ON_CALL(*this, GetWindows()).WillByDefault(Invoke([this] () -> unity::WindowList const& { return windows_; })); |
1782 | 148 | ON_CALL(*this, GetSupportedMimeTypes()).WillByDefault(Return(std::vector<std::string>())); | 147 | ON_CALL(*this, GetSupportedMimeTypes()).WillByDefault(Return(std::vector<std::string>())); |
1783 | 149 | ON_CALL(*this, GetFocusableWindow()).WillByDefault(Return(unity::ApplicationWindowPtr())); | 148 | ON_CALL(*this, GetFocusableWindow()).WillByDefault(Return(unity::ApplicationWindowPtr())); |
1784 | 150 | ON_CALL(*this, OwnsWindow(_)).WillByDefault(Invoke(this, &MockApplication::LocalOwnsWindow)); | 149 | ON_CALL(*this, OwnsWindow(_)).WillByDefault(Invoke(this, &MockApplication::LocalOwnsWindow)); |
1785 | @@ -167,7 +166,7 @@ | |||
1786 | 167 | MOCK_CONST_METHOD0(type, unity::AppType()); | 166 | MOCK_CONST_METHOD0(type, unity::AppType()); |
1787 | 168 | MOCK_CONST_METHOD0(repr, std::string()); | 167 | MOCK_CONST_METHOD0(repr, std::string()); |
1788 | 169 | MOCK_CONST_METHOD0(desktop_id, std::string()); | 168 | MOCK_CONST_METHOD0(desktop_id, std::string()); |
1790 | 170 | MOCK_CONST_METHOD0(GetWindows, unity::WindowList()); | 169 | MOCK_CONST_METHOD0(GetWindows, unity::WindowList const&()); |
1791 | 171 | MOCK_CONST_METHOD1(OwnsWindow, bool(Window)); | 170 | MOCK_CONST_METHOD1(OwnsWindow, bool(Window)); |
1792 | 172 | MOCK_CONST_METHOD0(GetSupportedMimeTypes, std::vector<std::string>()); | 171 | MOCK_CONST_METHOD0(GetSupportedMimeTypes, std::vector<std::string>()); |
1793 | 173 | MOCK_CONST_METHOD0(GetFocusableWindow, unity::ApplicationWindowPtr()); | 172 | MOCK_CONST_METHOD0(GetFocusableWindow, unity::ApplicationWindowPtr()); |
1794 | 174 | 173 | ||
1795 | === modified file 'tests/test_bamf_application.cpp' | |||
1796 | --- tests/test_bamf_application.cpp 2013-10-14 17:36:51 +0000 | |||
1797 | +++ tests/test_bamf_application.cpp 2015-08-24 17:01:53 +0000 | |||
1798 | @@ -56,6 +56,8 @@ | |||
1799 | 56 | 56 | ||
1800 | 57 | TEST_F(TestBamfApplication, GetWindows) | 57 | TEST_F(TestBamfApplication, GetWindows) |
1801 | 58 | { | 58 | { |
1802 | 59 | ASSERT_EQ(application_.GetWindows().size(), 0); | ||
1803 | 60 | |||
1804 | 59 | GList* children = nullptr; | 61 | GList* children = nullptr; |
1805 | 60 | for (int i = 0; i<5; ++i) | 62 | for (int i = 0; i<5; ++i) |
1806 | 61 | { | 63 | { |
1807 | @@ -71,8 +73,7 @@ | |||
1808 | 71 | AddFakeWindowToWM(3, true); | 73 | AddFakeWindowToWM(3, true); |
1809 | 72 | AddFakeWindowToWM(4, false); | 74 | AddFakeWindowToWM(4, false); |
1810 | 73 | 75 | ||
1813 | 74 | auto windows = application_.GetWindows(); | 76 | EXPECT_EQ(application_.GetWindows().size(), 5); |
1812 | 75 | ASSERT_EQ(windows.size(), 5); | ||
1814 | 76 | 77 | ||
1815 | 77 | g_list_free_full(children, g_object_unref); | 78 | g_list_free_full(children, g_object_unref); |
1816 | 78 | } | 79 | } |
1817 | 79 | 80 | ||
1818 | === modified file 'unity-shared/ApplicationManager.h' | |||
1819 | --- unity-shared/ApplicationManager.h 2015-02-09 16:47:24 +0000 | |||
1820 | +++ unity-shared/ApplicationManager.h 2015-08-24 17:01:53 +0000 | |||
1821 | @@ -80,7 +80,6 @@ | |||
1822 | 80 | 80 | ||
1823 | 81 | virtual WindowType type() const = 0; | 81 | virtual WindowType type() const = 0; |
1824 | 82 | virtual Window window_id() const = 0; | 82 | virtual Window window_id() const = 0; |
1825 | 83 | virtual int monitor() const = 0; | ||
1826 | 84 | 83 | ||
1827 | 85 | // It is possible for this to be null, especially in situations where | 84 | // It is possible for this to be null, especially in situations where |
1828 | 86 | // the application is starting up or shutting down. | 85 | // the application is starting up or shutting down. |
1829 | @@ -101,6 +100,8 @@ | |||
1830 | 101 | return !(operator==(other)); | 100 | return !(operator==(other)); |
1831 | 102 | } | 101 | } |
1832 | 103 | 102 | ||
1833 | 103 | nux::ROProperty<int> monitor; | ||
1834 | 104 | |||
1835 | 104 | nux::ROProperty<std::string> title; | 105 | nux::ROProperty<std::string> title; |
1836 | 105 | nux::ROProperty<std::string> icon; | 106 | nux::ROProperty<std::string> icon; |
1837 | 106 | 107 | ||
1838 | @@ -121,7 +122,7 @@ | |||
1839 | 121 | // A string representation of the object. | 122 | // A string representation of the object. |
1840 | 122 | virtual std::string repr() const = 0; | 123 | virtual std::string repr() const = 0; |
1841 | 123 | 124 | ||
1843 | 124 | virtual WindowList GetWindows() const = 0; | 125 | virtual WindowList const& GetWindows() const = 0; |
1844 | 125 | virtual bool OwnsWindow(Window window_id) const = 0; | 126 | virtual bool OwnsWindow(Window window_id) const = 0; |
1845 | 126 | 127 | ||
1846 | 127 | virtual std::vector<std::string> GetSupportedMimeTypes() const = 0; | 128 | virtual std::vector<std::string> GetSupportedMimeTypes() const = 0; |
1847 | 128 | 129 | ||
1848 | === modified file 'unity-shared/BamfApplicationManager.cpp' | |||
1849 | --- unity-shared/BamfApplicationManager.cpp 2015-04-21 19:57:00 +0000 | |||
1850 | +++ unity-shared/BamfApplicationManager.cpp 2015-08-24 17:01:53 +0000 | |||
1851 | @@ -145,6 +145,10 @@ | |||
1852 | 145 | [this] (BamfView*, gboolean urgent) { | 145 | [this] (BamfView*, gboolean urgent) { |
1853 | 146 | this->urgent.changed.emit(urgent); | 146 | this->urgent.changed.emit(urgent); |
1854 | 147 | }); | 147 | }); |
1855 | 148 | signals_.Add<void, BamfView*>(bamf_view_, "closed", | ||
1856 | 149 | [this] (BamfView* view) { | ||
1857 | 150 | pool::wins_.erase(view); | ||
1858 | 151 | }); | ||
1859 | 148 | } | 152 | } |
1860 | 149 | 153 | ||
1861 | 150 | bool WindowBase::Focus() const | 154 | bool WindowBase::Focus() const |
1862 | @@ -170,7 +174,13 @@ | |||
1863 | 170 | : WindowBase(manager, window) | 174 | : WindowBase(manager, window) |
1864 | 171 | , bamf_window_(glib::object_cast<BamfWindow>(window)) | 175 | , bamf_window_(glib::object_cast<BamfWindow>(window)) |
1865 | 172 | { | 176 | { |
1866 | 177 | monitor.SetGetterFunction(std::bind(&AppWindow::GetMonitor, this)); | ||
1867 | 173 | maximized.SetGetterFunction(std::bind(&AppWindow::GetMaximized, this)); | 178 | maximized.SetGetterFunction(std::bind(&AppWindow::GetMaximized, this)); |
1868 | 179 | |||
1869 | 180 | signals_.Add<void, BamfWindow*, gint, gint>(bamf_window_, "monitor-changed", | ||
1870 | 181 | [this] (BamfWindow*, gint, gint monitor) { | ||
1871 | 182 | this->monitor.changed.emit(monitor); | ||
1872 | 183 | }); | ||
1873 | 174 | signals_.Add<void, BamfWindow*, gint, gint>(bamf_window_, "maximized-changed", | 184 | signals_.Add<void, BamfWindow*, gint, gint>(bamf_window_, "maximized-changed", |
1874 | 175 | [this] (BamfWindow*, gint old_state, gint state) { | 185 | [this] (BamfWindow*, gint old_state, gint state) { |
1875 | 176 | if ((old_state == BAMF_WINDOW_MAXIMIZED) != (state == BAMF_WINDOW_MAXIMIZED)) | 186 | if ((old_state == BAMF_WINDOW_MAXIMIZED) != (state == BAMF_WINDOW_MAXIMIZED)) |
1876 | @@ -178,6 +188,11 @@ | |||
1877 | 178 | }); | 188 | }); |
1878 | 179 | } | 189 | } |
1879 | 180 | 190 | ||
1880 | 191 | int AppWindow::GetMonitor() const | ||
1881 | 192 | { | ||
1882 | 193 | return bamf_window_get_monitor(bamf_window_); | ||
1883 | 194 | } | ||
1884 | 195 | |||
1885 | 181 | bool AppWindow::GetMaximized() const | 196 | bool AppWindow::GetMaximized() const |
1886 | 182 | { | 197 | { |
1887 | 183 | return bamf_window_maximized(bamf_window_) == BAMF_WINDOW_MAXIMIZED; | 198 | return bamf_window_maximized(bamf_window_) == BAMF_WINDOW_MAXIMIZED; |
1888 | @@ -188,11 +203,6 @@ | |||
1889 | 188 | return bamf_window_get_xid(bamf_window_); | 203 | return bamf_window_get_xid(bamf_window_); |
1890 | 189 | } | 204 | } |
1891 | 190 | 205 | ||
1892 | 191 | int AppWindow::monitor() const | ||
1893 | 192 | { | ||
1894 | 193 | return bamf_window_get_monitor(bamf_window_); | ||
1895 | 194 | } | ||
1896 | 195 | |||
1897 | 196 | WindowType AppWindow::type() const | 206 | WindowType AppWindow::type() const |
1898 | 197 | { | 207 | { |
1899 | 198 | switch (bamf_window_get_window_type(bamf_window_)) | 208 | switch (bamf_window_get_window_type(bamf_window_)) |
1900 | @@ -231,14 +241,15 @@ | |||
1901 | 231 | WindowManager::Default().Close(window_id()); | 241 | WindowManager::Default().Close(window_id()); |
1902 | 232 | } | 242 | } |
1903 | 233 | 243 | ||
1904 | 234 | Tab::Tab(ApplicationManager const& manager, glib::Object<BamfView> const& tab) | ||
1905 | 235 | : WindowBase(manager, tab) | ||
1906 | 236 | , bamf_tab_(glib::object_cast<BamfTab>(tab)) | ||
1907 | 237 | {} | ||
1908 | 238 | |||
1909 | 239 | Tab::Tab(ApplicationManager const& manager, glib::Object<BamfTab> const& tab) | 244 | Tab::Tab(ApplicationManager const& manager, glib::Object<BamfTab> const& tab) |
1910 | 240 | : WindowBase(manager, glib::object_cast<BamfView>(tab)) | 245 | : WindowBase(manager, glib::object_cast<BamfView>(tab)) |
1911 | 241 | , bamf_tab_(tab) | 246 | , bamf_tab_(tab) |
1912 | 247 | { | ||
1913 | 248 | monitor.SetGetterFunction([] { return -1; }); | ||
1914 | 249 | } | ||
1915 | 250 | |||
1916 | 251 | Tab::Tab(ApplicationManager const& manager, glib::Object<BamfView> const& tab) | ||
1917 | 252 | : Tab(manager_, glib::object_cast<BamfTab>(tab)) | ||
1918 | 242 | {} | 253 | {} |
1919 | 243 | 254 | ||
1920 | 244 | Window Tab::window_id() const | 255 | Window Tab::window_id() const |
1921 | @@ -251,12 +262,6 @@ | |||
1922 | 251 | return WindowType::TAB; | 262 | return WindowType::TAB; |
1923 | 252 | } | 263 | } |
1924 | 253 | 264 | ||
1925 | 254 | int Tab::monitor() const | ||
1926 | 255 | { | ||
1927 | 256 | // TODO, we could find the real window for the window_id, and get the monitor for that. | ||
1928 | 257 | return -1; | ||
1929 | 258 | } | ||
1930 | 259 | |||
1931 | 260 | ApplicationPtr Tab::application() const | 265 | ApplicationPtr Tab::application() const |
1932 | 261 | { | 266 | { |
1933 | 262 | // TODO, we could find the real window for the window_id, and return the application for that. | 267 | // TODO, we could find the real window for the window_id, and return the application for that. |
1934 | @@ -323,6 +328,7 @@ | |||
1935 | 323 | signals_.Add<void, BamfView*, gboolean>(bamf_view_, "running-changed", | 328 | signals_.Add<void, BamfView*, gboolean>(bamf_view_, "running-changed", |
1936 | 324 | [this] (BamfView*, gboolean running) { | 329 | [this] (BamfView*, gboolean running) { |
1937 | 325 | LOG_TRACE(logger) << "running " << visible; | 330 | LOG_TRACE(logger) << "running " << visible; |
1938 | 331 | UpdateWindows(); | ||
1939 | 326 | this->running.changed.emit(running); | 332 | this->running.changed.emit(running); |
1940 | 327 | }); | 333 | }); |
1941 | 328 | signals_.Add<void, BamfView*, gboolean>(bamf_view_, "urgent-changed", | 334 | signals_.Add<void, BamfView*, gboolean>(bamf_view_, "urgent-changed", |
1942 | @@ -330,21 +336,34 @@ | |||
1943 | 330 | this->urgent.changed.emit(urgent); | 336 | this->urgent.changed.emit(urgent); |
1944 | 331 | }); | 337 | }); |
1945 | 332 | signals_.Add<void, BamfView*>(bamf_view_, "closed", | 338 | signals_.Add<void, BamfView*>(bamf_view_, "closed", |
1947 | 333 | [this] (BamfView*) { | 339 | [this] (BamfView* view) { |
1948 | 340 | UpdateWindows(); | ||
1949 | 334 | this->closed.emit(); | 341 | this->closed.emit(); |
1950 | 342 | |||
1951 | 343 | if (!sticky()) | ||
1952 | 344 | pool::apps_.erase(view); | ||
1953 | 335 | }); | 345 | }); |
1954 | 336 | 346 | ||
1955 | 337 | signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-added", | 347 | signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-added", |
1956 | 338 | [this] (BamfView*, BamfView* child) { | 348 | [this] (BamfView*, BamfView* child) { |
1957 | 339 | // Ownership is not passed on signals | 349 | // Ownership is not passed on signals |
1958 | 340 | if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child)) | 350 | if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child)) |
1960 | 341 | this->window_opened.emit(win); | 351 | { |
1961 | 352 | if (std::find(windows_.begin(), windows_.end(), win) == windows_.end()) | ||
1962 | 353 | { | ||
1963 | 354 | windows_.push_back(win); | ||
1964 | 355 | this->window_opened.emit(win); | ||
1965 | 356 | } | ||
1966 | 357 | } | ||
1967 | 342 | }); | 358 | }); |
1968 | 343 | 359 | ||
1969 | 344 | signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-removed", | 360 | signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-removed", |
1970 | 345 | [this] (BamfView*, BamfView* child) { | 361 | [this] (BamfView*, BamfView* child) { |
1971 | 346 | if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child)) | 362 | if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child)) |
1972 | 363 | { | ||
1973 | 364 | windows_.erase(std::remove(windows_.begin(), windows_.end(), win), windows_.end()); | ||
1974 | 347 | this->window_closed.emit(win); | 365 | this->window_closed.emit(win); |
1975 | 366 | } | ||
1976 | 348 | }); | 367 | }); |
1977 | 349 | 368 | ||
1978 | 350 | signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-moved", | 369 | signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-moved", |
1979 | @@ -353,6 +372,8 @@ | |||
1980 | 353 | if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child)) | 372 | if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child)) |
1981 | 354 | this->window_moved.emit(win); | 373 | this->window_moved.emit(win); |
1982 | 355 | }); | 374 | }); |
1983 | 375 | |||
1984 | 376 | UpdateWindows(); | ||
1985 | 356 | } | 377 | } |
1986 | 357 | 378 | ||
1987 | 358 | std::string Application::GetDesktopFile() const | 379 | std::string Application::GetDesktopFile() const |
1988 | @@ -384,20 +405,38 @@ | |||
1989 | 384 | return sout.str(); | 405 | return sout.str(); |
1990 | 385 | } | 406 | } |
1991 | 386 | 407 | ||
1998 | 387 | WindowList Application::GetWindows() const | 408 | WindowList const& Application::GetWindows() const |
1999 | 388 | { | 409 | { |
2000 | 389 | WindowList result; | 410 | return windows_; |
2001 | 390 | 411 | } | |
2002 | 391 | if (!bamf_app_) | 412 | |
2003 | 392 | return result; | 413 | void Application::UpdateWindows() |
2004 | 414 | { | ||
2005 | 415 | if (!bamf_app_ || !running() || bamf_view_is_closed(bamf_view_)) | ||
2006 | 416 | { | ||
2007 | 417 | for (auto it = windows_.begin(); it != windows_.end();) | ||
2008 | 418 | { | ||
2009 | 419 | window_closed.emit(*it); | ||
2010 | 420 | it = windows_.erase(it); | ||
2011 | 421 | } | ||
2012 | 422 | |||
2013 | 423 | return; | ||
2014 | 424 | } | ||
2015 | 425 | |||
2016 | 426 | bool was_empty = windows_.empty(); | ||
2017 | 393 | 427 | ||
2018 | 394 | std::shared_ptr<GList> children(bamf_view_get_children(bamf_view_), g_list_free); | 428 | std::shared_ptr<GList> children(bamf_view_get_children(bamf_view_), g_list_free); |
2019 | 395 | for (GList* l = children.get(); l; l = l->next) | 429 | for (GList* l = children.get(); l; l = l->next) |
2020 | 396 | { | 430 | { |
2021 | 397 | if (ApplicationWindowPtr const& window = pool::EnsureWindow(manager_, static_cast<BamfView*>(l->data))) | 431 | if (ApplicationWindowPtr const& window = pool::EnsureWindow(manager_, static_cast<BamfView*>(l->data))) |
2023 | 398 | result.push_back(window); | 432 | { |
2024 | 433 | if (was_empty || std::find(windows_.begin(), windows_.end(), window) == windows_.end()) | ||
2025 | 434 | { | ||
2026 | 435 | windows_.push_back(window); | ||
2027 | 436 | window_opened.emit(window); | ||
2028 | 437 | } | ||
2029 | 438 | } | ||
2030 | 399 | } | 439 | } |
2031 | 400 | return result; | ||
2032 | 401 | } | 440 | } |
2033 | 402 | 441 | ||
2034 | 403 | bool Application::OwnsWindow(Window window_id) const | 442 | bool Application::OwnsWindow(Window window_id) const |
2035 | @@ -405,15 +444,13 @@ | |||
2036 | 405 | if (!window_id) | 444 | if (!window_id) |
2037 | 406 | return false; | 445 | return false; |
2038 | 407 | 446 | ||
2042 | 408 | bool owns = false; | 447 | for (auto const& win : windows_) |
2040 | 409 | std::shared_ptr<GList> children(bamf_view_get_children(bamf_view_), g_list_free); | ||
2041 | 410 | for (GList* l = children.get(); l && !owns; l = l->next) | ||
2043 | 411 | { | 448 | { |
2046 | 412 | owns = BAMF_IS_WINDOW(l->data) && | 449 | if (win->window_id() == window_id) |
2047 | 413 | bamf_window_get_xid(static_cast<BamfWindow*>(l->data)) == window_id; | 450 | return true; |
2048 | 414 | } | 451 | } |
2049 | 415 | 452 | ||
2051 | 416 | return owns; | 453 | return false; |
2052 | 417 | } | 454 | } |
2053 | 418 | 455 | ||
2054 | 419 | std::vector<std::string> Application::GetSupportedMimeTypes() const | 456 | std::vector<std::string> Application::GetSupportedMimeTypes() const |
2055 | @@ -515,7 +552,7 @@ | |||
2056 | 515 | g_quark_from_string(UNSEEN_QUARK)); | 552 | g_quark_from_string(UNSEEN_QUARK)); |
2057 | 516 | } | 553 | } |
2058 | 517 | 554 | ||
2060 | 518 | bool Application::SetSeen(bool const& param) | 555 | bool Application::SetSeen(bool param) |
2061 | 519 | { | 556 | { |
2062 | 520 | bool is_seen = GetSeen(); | 557 | bool is_seen = GetSeen(); |
2063 | 521 | if (param == is_seen) | 558 | if (param == is_seen) |
2064 | @@ -533,12 +570,15 @@ | |||
2065 | 533 | return bamf_view_is_sticky(bamf_view_); | 570 | return bamf_view_is_sticky(bamf_view_); |
2066 | 534 | } | 571 | } |
2067 | 535 | 572 | ||
2069 | 536 | bool Application::SetSticky(bool const& param) | 573 | bool Application::SetSticky(bool param) |
2070 | 537 | { | 574 | { |
2071 | 538 | bool is_sticky = GetSticky(); | 575 | bool is_sticky = GetSticky(); |
2072 | 539 | if (param == is_sticky) | 576 | if (param == is_sticky) |
2073 | 540 | return false; // unchanged | 577 | return false; // unchanged |
2074 | 541 | 578 | ||
2075 | 579 | if (!param && bamf_view_is_closed(bamf_view_)) | ||
2076 | 580 | pool::apps_.erase(bamf_view_); | ||
2077 | 581 | |||
2078 | 542 | bamf_view_set_sticky(bamf_view_, param); | 582 | bamf_view_set_sticky(bamf_view_, param); |
2079 | 543 | return true; // value updated | 583 | return true; // value updated |
2080 | 544 | } | 584 | } |
2081 | @@ -640,6 +680,12 @@ | |||
2082 | 640 | if (xid == 0) | 680 | if (xid == 0) |
2083 | 641 | return nullptr; | 681 | return nullptr; |
2084 | 642 | 682 | ||
2085 | 683 | for (auto const& win_pair : pool::wins_) | ||
2086 | 684 | { | ||
2087 | 685 | if (win_pair.second->window_id() == xid) | ||
2088 | 686 | return win_pair.second; | ||
2089 | 687 | } | ||
2090 | 688 | |||
2091 | 643 | // TODO: use bamf_matcher_get_window_for_xid | 689 | // TODO: use bamf_matcher_get_window_for_xid |
2092 | 644 | auto* app = bamf_matcher_get_application_for_xid(matcher_, xid); | 690 | auto* app = bamf_matcher_get_application_for_xid(matcher_, xid); |
2093 | 645 | 691 | ||
2094 | @@ -724,16 +770,14 @@ | |||
2095 | 724 | { | 770 | { |
2096 | 725 | if (ApplicationPtr const& app = pool::EnsureApplication(*this, view)) | 771 | if (ApplicationPtr const& app = pool::EnsureApplication(*this, view)) |
2097 | 726 | application_stopped.emit(app); | 772 | application_stopped.emit(app); |
2098 | 727 | |||
2099 | 728 | pool::apps_.erase(view); | ||
2100 | 729 | } | 773 | } |
2101 | 730 | else if (BAMF_IS_WINDOW(view)) | 774 | else if (BAMF_IS_WINDOW(view)) |
2102 | 731 | { | 775 | { |
2103 | 732 | if (ApplicationWindowPtr const& win = pool::EnsureWindow(*this, view)) | 776 | if (ApplicationWindowPtr const& win = pool::EnsureWindow(*this, view)) |
2104 | 733 | window_closed.emit(win); | 777 | window_closed.emit(win); |
2105 | 734 | |||
2106 | 735 | pool::wins_.erase(view); | ||
2107 | 736 | } | 778 | } |
2108 | 779 | |||
2109 | 780 | /* No removal here, it's done inside views, as 'closed' signal arrives later */ | ||
2110 | 737 | } | 781 | } |
2111 | 738 | 782 | ||
2112 | 739 | } // namespace bamf | 783 | } // namespace bamf |
2113 | 740 | 784 | ||
2114 | === modified file 'unity-shared/BamfApplicationManager.h' | |||
2115 | --- unity-shared/BamfApplicationManager.h 2015-02-05 14:35:07 +0000 | |||
2116 | +++ unity-shared/BamfApplicationManager.h 2015-08-24 17:01:53 +0000 | |||
2117 | @@ -49,6 +49,7 @@ | |||
2118 | 49 | protected: | 49 | protected: |
2119 | 50 | ApplicationManager const& manager_; | 50 | ApplicationManager const& manager_; |
2120 | 51 | glib::Object<BamfView> bamf_view_; | 51 | glib::Object<BamfView> bamf_view_; |
2121 | 52 | glib::SignalManager signals_; | ||
2122 | 52 | }; | 53 | }; |
2123 | 53 | 54 | ||
2124 | 54 | 55 | ||
2125 | @@ -66,9 +67,6 @@ | |||
2126 | 66 | return static_cast<WindowBase const*>(this)->bamf_view_ == static_cast<WindowBase const&>(other).bamf_view_; | 67 | return static_cast<WindowBase const*>(this)->bamf_view_ == static_cast<WindowBase const&>(other).bamf_view_; |
2127 | 67 | } | 68 | } |
2128 | 68 | bool operator!=(unity::ApplicationWindow const& other) const override { return !(operator==(other)); } | 69 | bool operator!=(unity::ApplicationWindow const& other) const override { return !(operator==(other)); } |
2129 | 69 | |||
2130 | 70 | protected: | ||
2131 | 71 | glib::SignalManager signals_; | ||
2132 | 72 | }; | 70 | }; |
2133 | 73 | 71 | ||
2134 | 74 | // NOTE: Can't use Window as a type as there is a #define for Window to some integer value. | 72 | // NOTE: Can't use Window as a type as there is a #define for Window to some integer value. |
2135 | @@ -82,12 +80,13 @@ | |||
2136 | 82 | 80 | ||
2137 | 83 | WindowType type() const override; | 81 | WindowType type() const override; |
2138 | 84 | Window window_id() const override; | 82 | Window window_id() const override; |
2139 | 85 | int monitor() const override; | ||
2140 | 86 | ApplicationPtr application() const override; | 83 | ApplicationPtr application() const override; |
2141 | 87 | void Quit() const override; | 84 | void Quit() const override; |
2142 | 85 | |||
2143 | 86 | private: | ||
2144 | 87 | int GetMonitor() const; | ||
2145 | 88 | bool GetMaximized() const; | 88 | bool GetMaximized() const; |
2146 | 89 | 89 | ||
2147 | 90 | private: | ||
2148 | 91 | glib::Object<BamfWindow> bamf_window_; | 90 | glib::Object<BamfWindow> bamf_window_; |
2149 | 92 | }; | 91 | }; |
2150 | 93 | 92 | ||
2151 | @@ -101,7 +100,6 @@ | |||
2152 | 101 | 100 | ||
2153 | 102 | WindowType type() const override; | 101 | WindowType type() const override; |
2154 | 103 | Window window_id() const override; | 102 | Window window_id() const override; |
2155 | 104 | int monitor() const override; | ||
2156 | 105 | ApplicationPtr application() const override; | 103 | ApplicationPtr application() const override; |
2157 | 106 | bool Focus() const override; | 104 | bool Focus() const override; |
2158 | 107 | void Quit() const override; | 105 | void Quit() const override; |
2159 | @@ -121,7 +119,7 @@ | |||
2160 | 121 | 119 | ||
2161 | 122 | virtual AppType type() const; | 120 | virtual AppType type() const; |
2162 | 123 | 121 | ||
2164 | 124 | virtual WindowList GetWindows() const; | 122 | virtual WindowList const& GetWindows() const; |
2165 | 125 | virtual bool OwnsWindow(Window window_id) const; | 123 | virtual bool OwnsWindow(Window window_id) const; |
2166 | 126 | 124 | ||
2167 | 127 | virtual std::vector<std::string> GetSupportedMimeTypes() const; | 125 | virtual std::vector<std::string> GetSupportedMimeTypes() const; |
2168 | @@ -145,13 +143,16 @@ | |||
2169 | 145 | std::string GetDesktopFile() const; | 143 | std::string GetDesktopFile() const; |
2170 | 146 | 144 | ||
2171 | 147 | bool GetSeen() const; | 145 | bool GetSeen() const; |
2173 | 148 | bool SetSeen(bool const& param); | 146 | bool SetSeen(bool param); |
2174 | 149 | 147 | ||
2175 | 150 | bool GetSticky() const; | 148 | bool GetSticky() const; |
2177 | 151 | bool SetSticky(bool const& param); | 149 | bool SetSticky(bool param); |
2178 | 150 | |||
2179 | 151 | void UpdateWindows(); | ||
2180 | 152 | 152 | ||
2181 | 153 | private: | 153 | private: |
2182 | 154 | glib::Object<::BamfApplication> bamf_app_; | 154 | glib::Object<::BamfApplication> bamf_app_; |
2183 | 155 | WindowList windows_; | ||
2184 | 155 | glib::SignalManager signals_; | 156 | glib::SignalManager signals_; |
2185 | 156 | std::string type_; | 157 | std::string type_; |
2186 | 157 | }; | 158 | }; |
2187 | 158 | 159 | ||
2188 | === modified file 'unity-shared/IconTexture.cpp' | |||
2189 | --- unity-shared/IconTexture.cpp 2014-07-28 16:28:38 +0000 | |||
2190 | +++ unity-shared/IconTexture.cpp 2015-08-24 17:01:53 +0000 | |||
2191 | @@ -281,8 +281,10 @@ | |||
2192 | 281 | 281 | ||
2193 | 282 | void IconTexture::SetOpacity(float opacity) | 282 | void IconTexture::SetOpacity(float opacity) |
2194 | 283 | { | 283 | { |
2195 | 284 | if (_opacity == opacity) | ||
2196 | 285 | return; | ||
2197 | 286 | |||
2198 | 284 | _opacity = opacity; | 287 | _opacity = opacity; |
2199 | 285 | |||
2200 | 286 | QueueDraw(); | 288 | QueueDraw(); |
2201 | 287 | } | 289 | } |
2202 | 288 | 290 | ||
2203 | 289 | 291 | ||
2204 | === modified file 'unity-shared/PluginAdapter.cpp' | |||
2205 | --- unity-shared/PluginAdapter.cpp 2015-04-09 14:42:07 +0000 | |||
2206 | +++ unity-shared/PluginAdapter.cpp 2015-08-24 17:01:53 +0000 | |||
2207 | @@ -781,7 +781,10 @@ | |||
2208 | 781 | { | 781 | { |
2209 | 782 | CompWindow* window = m_Screen->findWindow(window_id); | 782 | CompWindow* window = m_Screen->findWindow(window_id); |
2210 | 783 | if (window && (window->actions() & CompWindowActionMinimizeMask)) | 783 | if (window && (window->actions() & CompWindowActionMinimizeMask)) |
2211 | 784 | { | ||
2212 | 784 | window->unminimize(); | 785 | window->unminimize(); |
2213 | 786 | window->show(); | ||
2214 | 787 | } | ||
2215 | 785 | } | 788 | } |
2216 | 786 | 789 | ||
2217 | 787 | void PluginAdapter::Shade(Window window_id) | 790 | void PluginAdapter::Shade(Window window_id) |
2218 | @@ -962,6 +965,7 @@ | |||
2219 | 962 | if (forced_unminimize) | 965 | if (forced_unminimize) |
2220 | 963 | { | 966 | { |
2221 | 964 | top_window->unminimize(); | 967 | top_window->unminimize(); |
2222 | 968 | top_window->show(); | ||
2223 | 965 | } | 969 | } |
2224 | 966 | 970 | ||
2225 | 967 | top_window->raise(); | 971 | top_window->raise(); |
2226 | 968 | 972 | ||
2227 | === modified file 'unity-shared/StandaloneAppManager.cpp' | |||
2228 | --- unity-shared/StandaloneAppManager.cpp 2015-02-09 19:39:39 +0000 | |||
2229 | +++ unity-shared/StandaloneAppManager.cpp 2015-08-24 17:01:53 +0000 | |||
2230 | @@ -81,6 +81,22 @@ | |||
2231 | 81 | return os; | 81 | return os; |
2232 | 82 | } | 82 | } |
2233 | 83 | 83 | ||
2234 | 84 | void connect_window_events(ApplicationWindowPtr const& win) | ||
2235 | 85 | { | ||
2236 | 86 | win->title.changed.connect([win] (std::string const& t) { | ||
2237 | 87 | std::cout << "Window "<< win->window_id()<< " title changed to "<< t << endl; | ||
2238 | 88 | }); | ||
2239 | 89 | win->maximized.changed.connect([win] (bool m) { | ||
2240 | 90 | std::cout << "Window "<< win->window_id()<< " maximized changed to "<< m << endl; | ||
2241 | 91 | }); | ||
2242 | 92 | win->monitor.changed.connect([win] (int m) { | ||
2243 | 93 | std::cout << "Window "<< win->window_id()<< " monitor changed to "<< m << endl; | ||
2244 | 94 | }); | ||
2245 | 95 | win->active.changed.connect([win] (bool a) { | ||
2246 | 96 | std::cout << "Window "<< win->window_id()<< " active changed to "<< a << endl; | ||
2247 | 97 | }); | ||
2248 | 98 | } | ||
2249 | 99 | |||
2250 | 84 | void dump_app(ApplicationPtr const& app, std::string const& prefix = "") | 100 | void dump_app(ApplicationPtr const& app, std::string const& prefix = "") |
2251 | 85 | { | 101 | { |
2252 | 86 | if (app) | 102 | if (app) |
2253 | @@ -153,6 +169,7 @@ | |||
2254 | 153 | }); | 169 | }); |
2255 | 154 | app->window_opened.connect([idx](ApplicationWindowPtr const& window) { | 170 | app->window_opened.connect([idx](ApplicationWindowPtr const& window) { |
2256 | 155 | cout << "** " << names[idx] << " window opened: " << window->title() << endl; | 171 | cout << "** " << names[idx] << " window opened: " << window->title() << endl; |
2257 | 172 | connect_window_events(window); | ||
2258 | 156 | }); | 173 | }); |
2259 | 157 | app->window_closed.connect([idx](ApplicationWindowPtr const& window) { | 174 | app->window_closed.connect([idx](ApplicationWindowPtr const& window) { |
2260 | 158 | cout << "** " << names[idx] << " window closed: " << window->title() << endl; | 175 | cout << "** " << names[idx] << " window closed: " << window->title() << endl; |
2261 | @@ -163,21 +180,10 @@ | |||
2262 | 163 | app->seen = true; | 180 | app->seen = true; |
2263 | 164 | 181 | ||
2264 | 165 | for (auto win : app->GetWindows()) | 182 | for (auto win : app->GetWindows()) |
2276 | 166 | { | 183 | connect_window_events(win); |
2266 | 167 | win->title.changed.connect([win] (std::string const& t) { | ||
2267 | 168 | std::cout << "Window "<< win->window_id()<< " title changed to "<< t << endl; | ||
2268 | 169 | }); | ||
2269 | 170 | win->maximized.changed.connect([win] (bool m) { | ||
2270 | 171 | std::cout << "Window "<< win->window_id()<< " maximized changed to "<< m << endl; | ||
2271 | 172 | }); | ||
2272 | 173 | win->active.changed.connect([win] (bool a) { | ||
2273 | 174 | std::cout << "Window "<< win->window_id()<< " active changed to "<< a << endl; | ||
2274 | 175 | }); | ||
2275 | 176 | } | ||
2277 | 177 | } | 184 | } |
2278 | 178 | 185 | ||
2279 | 179 | 186 | ||
2280 | 180 | |||
2281 | 181 | nux::logging::Level glog_level_to_nux(GLogLevelFlags log_level) | 187 | nux::logging::Level glog_level_to_nux(GLogLevelFlags log_level) |
2282 | 182 | { | 188 | { |
2283 | 183 | // For some weird reason, ERROR is more critical than CRITICAL in gnome. | 189 | // For some weird reason, ERROR is more critical than CRITICAL in gnome. |
2284 | 184 | 190 | ||
2285 | === modified file 'unity-shared/WindowButtons.cpp' | |||
2286 | --- unity-shared/WindowButtons.cpp 2015-06-03 12:10:00 +0000 | |||
2287 | +++ unity-shared/WindowButtons.cpp 2015-08-24 17:01:53 +0000 | |||
2288 | @@ -234,14 +234,14 @@ | |||
2289 | 234 | } | 234 | } |
2290 | 235 | 235 | ||
2291 | 236 | introspection.add(GetAbsoluteGeometry()) | 236 | introspection.add(GetAbsoluteGeometry()) |
2300 | 237 | .add("type", type_name) | 237 | .add("type", type_name) |
2301 | 238 | .add("visible", IsVisible() && Parent()->opacity() != 0.0f) | 238 | .add("visible", IsVisible() && Parent()->opacity() != 0.0f) |
2302 | 239 | .add("sensitive", Parent()->GetInputEventSensitivity()) | 239 | .add("sensitive", Parent()->GetInputEventSensitivity()) |
2303 | 240 | .add("enabled", enabled()) | 240 | .add("enabled", enabled()) |
2304 | 241 | .add("visual_state", state_name) | 241 | .add("visual_state", state_name) |
2305 | 242 | .add("opacity", Parent()->opacity()) | 242 | .add("opacity", Parent()->opacity()) |
2306 | 243 | .add("focused", Parent()->focused()) | 243 | .add("focused", Parent()->focused()) |
2307 | 244 | .add("overlay_mode", overlay_mode()); | 244 | .add("overlay_mode", overlay_mode()); |
2308 | 245 | } | 245 | } |
2309 | 246 | } // Internal Namespace | 246 | } // Internal Namespace |
2310 | 247 | 247 |
Thanks