Merge lp:~laney/unity/xpathselect-v5 into lp:unity

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
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+268939@code.launchpad.net

Commit message

Depend on v5-renamed xpathselect package

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dash/DashView.cpp'
--- dash/DashView.cpp 2015-05-22 13:21:01 +0000
+++ dash/DashView.cpp 2015-08-24 17:01:53 +0000
@@ -1547,6 +1547,32 @@
1547 ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);1547 ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);
1548}1548}
15491549
1550nux::Area* DashView::SkipUnexpandableHeaderKeyNav()
1551{
1552 PlacesGroup::Ptr prev_view;
1553 auto category_views = active_scope_view_->GetOrderedCategoryViews();
1554
1555 for (auto category : category_views)
1556 {
1557 if (category->GetLayout() != nullptr)
1558 {
1559 auto header = category->GetHeaderFocusableView();
1560 if (header && header->HasKeyFocus() && !category->IsExpandable())
1561 {
1562 if (prev_view)
1563 return prev_view->GetChildView();
1564 else
1565 return search_bar_->text_entry();
1566 }
1567
1568 if (category->IsVisible())
1569 prev_view = category;
1570 }
1571 }
1572
1573 return nullptr;
1574}
1575
1550nux::Area* DashView::FindKeyFocusArea(unsigned int key_symbol,1576nux::Area* DashView::FindKeyFocusArea(unsigned int key_symbol,
1551 unsigned long x11_key_code,1577 unsigned long x11_key_code,
1552 unsigned long special_keys_state)1578 unsigned long special_keys_state)
@@ -1698,6 +1724,14 @@
1698 }1724 }
1699 }1725 }
17001726
1727 if (direction == KEY_NAV_UP)
1728 {
1729 if (auto skip_view = SkipUnexpandableHeaderKeyNav())
1730 {
1731 return skip_view;
1732 }
1733 }
1734
1701 bool search_key = false;1735 bool search_key = false;
17021736
1703 if (direction == KEY_NAV_NONE)1737 if (direction == KEY_NAV_NONE)
17041738
=== modified file 'dash/DashView.h'
--- dash/DashView.h 2015-04-24 12:59:57 +0000
+++ dash/DashView.h 2015-08-24 17:01:53 +0000
@@ -137,6 +137,8 @@
137137
138 nux::Area* KeyNavIteration(nux::KeyNavDirection direction);138 nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
139139
140 nux::Area* SkipUnexpandableHeaderKeyNav();
141
140 UBusManager ubus_manager_;142 UBusManager ubus_manager_;
141 Scopes::Ptr scopes_;143 Scopes::Ptr scopes_;
142 ScopeViews scope_views_;144 ScopeViews scope_views_;
143145
=== modified file 'dash/PlacesGroup.cpp'
--- dash/PlacesGroup.cpp 2014-07-10 16:39:12 +0000
+++ dash/PlacesGroup.cpp 2015-08-24 17:01:53 +0000
@@ -212,7 +212,12 @@
212 if(direction == nux::KEY_NAV_UP)212 if(direction == nux::KEY_NAV_UP)
213 nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction);213 nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction);
214 else214 else
215 nux::GetWindowCompositor().SetKeyFocusArea(GetHeaderFocusableView(), direction);215 {
216 if (IsExpandable())
217 nux::GetWindowCompositor().SetKeyFocusArea(GetHeaderFocusableView(), direction);
218 else
219 nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction);
220 }
216 });221 });
217222
218 UpdatePlacesGroupSize();223 UpdatePlacesGroupSize();
@@ -343,15 +348,18 @@
343 UpdateResultViewPadding();348 UpdateResultViewPadding();
344 _group_layout->AddLayout(_child_layout, 1);349 _group_layout->AddLayout(_child_layout, 1);
345350
346 view->results_per_row.changed.connect([this] (int results_per_row)351 UpdateVisibleItems(view->results_per_row());
347 {352 view->results_per_row.changed.connect(sigc::mem_fun(this, &PlacesGroup::UpdateVisibleItems));
348 _n_visible_items_in_unexpand_mode = results_per_row;
349 RefreshLabel();
350 });
351353
352 QueueDraw();354 QueueDraw();
353}355}
354356
357void PlacesGroup::UpdateVisibleItems(int visible_items)
358{
359 _n_visible_items_in_unexpand_mode = visible_items;
360 RefreshLabel();
361}
362
355dash::ResultView*363dash::ResultView*
356PlacesGroup::GetChildView()364PlacesGroup::GetChildView()
357{365{
@@ -567,6 +575,12 @@
567}575}
568576
569bool577bool
578PlacesGroup::IsExpandable() const
579{
580 return (_n_visible_items_in_unexpand_mode < _n_total_items);
581}
582
583bool
570PlacesGroup::GetExpanded() const584PlacesGroup::GetExpanded() const
571{585{
572 return _is_expanded;586 return _is_expanded;
@@ -649,7 +663,7 @@
649663
650bool PlacesGroup::ShouldBeHighlighted() const664bool PlacesGroup::ShouldBeHighlighted() const
651{665{
652 return HeaderHasKeyFocus();666 return (HeaderHasKeyFocus() && IsExpandable());
653}667}
654668
655void PlacesGroup::SetResultsPreviewAnimationValue(float preview_animation)669void PlacesGroup::SetResultsPreviewAnimationValue(float preview_animation)
656670
=== modified file 'dash/PlacesGroup.h'
--- dash/PlacesGroup.h 2014-03-20 04:05:39 +0000
+++ dash/PlacesGroup.h 2015-08-24 17:01:53 +0000
@@ -77,6 +77,7 @@
7777
78 void SetCounts(unsigned n_total_items);78 void SetCounts(unsigned n_total_items);
7979
80 virtual bool IsExpandable() const;
80 virtual void SetExpanded(bool is_expanded);81 virtual void SetExpanded(bool is_expanded);
81 virtual bool GetExpanded() const;82 virtual bool GetExpanded() const;
8283
@@ -127,6 +128,7 @@
127 void UpdatePlacesGroupSize();128 void UpdatePlacesGroupSize();
128 void UpdateResultViewPadding();129 void UpdateResultViewPadding();
129 void UpdateScale(double scale);130 void UpdateScale(double scale);
131 void UpdateVisibleItems(int visible_items);
130132
131private:133private:
132 std::string _category_id;134 std::string _category_id;
133135
=== modified file 'dash/ResultViewGrid.cpp'
--- dash/ResultViewGrid.cpp 2015-05-22 13:20:52 +0000
+++ dash/ResultViewGrid.cpp 2015-08-24 17:01:53 +0000
@@ -85,11 +85,11 @@
85 EnableDoubleClick(true);85 EnableDoubleClick(true);
86 SetAcceptKeyNavFocusOnMouseDown(false);86 SetAcceptKeyNavFocusOnMouseDown(false);
8787
88 auto needredraw_lambda = [this](int value) { NeedRedraw(); };88 auto queue_draw_cb = sigc::hide(sigc::mem_fun(this, &ResultViewGrid::QueueDraw));
89 horizontal_spacing.changed.connect(needredraw_lambda);89 horizontal_spacing.changed.connect(queue_draw_cb);
90 vertical_spacing.changed.connect(needredraw_lambda);90 vertical_spacing.changed.connect(queue_draw_cb);
91 padding.changed.connect(needredraw_lambda);91 padding.changed.connect(queue_draw_cb);
92 selected_index_.changed.connect(needredraw_lambda);92 selected_index_.changed.connect(queue_draw_cb);
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; });
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; });
95 scale.changed.connect(sigc::mem_fun(this, &ResultViewGrid::UpdateScale));95 scale.changed.connect(sigc::mem_fun(this, &ResultViewGrid::UpdateScale));
@@ -119,7 +119,7 @@
119 NeedRedraw();119 NeedRedraw();
120 });120 });
121121
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);
123123
124 ubus_.RegisterInterest(UBUS_DASH_SIZE_CHANGED, [this] (GVariant* data) {124 ubus_.RegisterInterest(UBUS_DASH_SIZE_CHANGED, [this] (GVariant* data) {
125 // on dash size changed, we update our stored values, this sucks125 // on dash size changed, we update our stored values, this sucks
126126
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-03 12:35:24 +0000
+++ debian/changelog 2015-08-24 17:01:53 +0000
@@ -1,3 +1,32 @@
1unity (7.3.2+15.10.20150819-0ubuntu1) wily; urgency=medium
2
3 [ Andrea Azzarone andrea.azzarone@canonical.com ]
4 * Do not handle events coming from viewports not actually containing
5 the window. (LP: #1449654)
6
7 [ Chris Townsend ]
8 * Also use the Compiz show() method when forcing an unmapped window to
9 be visible when clicking on it's active Launcher icon. (LP: #989588)
10 * When using keyboard navigation in the Dash, skip category headers
11 that are not expandable. Also, do not highlight the category header
12 when the mouse cursor is over it. (LP: #1045933)
13
14 [ Marco Trevisan (Treviño) ]
15 * ApplicationManager: rely on windows monitor property changes for
16 updating Pips (LP: #1027191)
17 * Autopilot: modernize some tests, use stronger methods to ensure
18 false positive
19 * DecorationsForceQuitDialog: override the background of the window
20 with transparent color (LP: #1470292)
21 * Launcher: Always unfold an active icon (LP: #1472339)
22 * PanelMenuView: ensure that we connect to window signals as soon as
23 the AppManager knows it (LP: #1472326)
24 * PlacesGroup: connect to view changes using a function instead of a
25 lambda (LP: #1470298)
26 * SessionButton: set button opacity to 75% when pressed (LP: #1301655)
27
28 -- CI Train Bot <ci-train-bot@canonical.com> Wed, 19 Aug 2015 14:45:18 +0000
29
1unity (7.3.2+15.10.20150803.1-0ubuntu1) wily; urgency=medium30unity (7.3.2+15.10.20150803.1-0ubuntu1) wily; urgency=medium
231
3 [ Andrea Azzarone andrea.azzarone@canonical.com ]32 [ Andrea Azzarone andrea.azzarone@canonical.com ]
433
=== modified file 'debian/control'
--- debian/control 2015-04-05 22:07:47 +0000
+++ debian/control 2015-08-24 17:01:53 +0000
@@ -192,7 +192,7 @@
192 python-testtools,192 python-testtools,
193 python-xdg,193 python-xdg,
194 python-xlib,194 python-xlib,
195 libxpathselect1.4 (>= 1.4),195 libxpathselect1.4v5 (>= 1.4),
196 mesa-utils,196 mesa-utils,
197Description: Autopiloted tests for Unity197Description: Autopiloted tests for Unity
198 Unity is tested automatically through autopilot, a framework which enables198 Unity is tested automatically through autopilot, a framework which enables
199199
=== modified file 'decorations/DecoratedWindow.cpp'
--- decorations/DecoratedWindow.cpp 2015-02-03 10:28:30 +0000
+++ decorations/DecoratedWindow.cpp 2015-08-24 17:01:53 +0000
@@ -842,6 +842,11 @@
842 , impl_(new Impl(this, cwin))842 , impl_(new Impl(this, cwin))
843{}843{}
844844
845CompWindow* Window::GetCompWindow()
846{
847 return impl_->win_;
848}
849
845void Window::Update()850void Window::Update()
846{851{
847 impl_->Update();852 impl_->Update();
848853
=== modified file 'decorations/DecoratedWindow.h'
--- decorations/DecoratedWindow.h 2014-03-03 19:07:56 +0000
+++ decorations/DecoratedWindow.h 2015-08-24 17:01:53 +0000
@@ -45,6 +45,7 @@
45 nux::Property<bool> scaled;45 nux::Property<bool> scaled;
46 nux::ROProperty<double> dpi_scale;46 nux::ROProperty<double> dpi_scale;
4747
48 CompWindow* GetCompWindow();
48 void Update();49 void Update();
49 void Undecorate();50 void Undecorate();
50 void UpdateDecorationPosition();51 void UpdateDecorationPosition();
5152
=== modified file 'decorations/DecorationsForceQuitDialog.cpp'
--- decorations/DecorationsForceQuitDialog.cpp 2015-06-12 12:15:40 +0000
+++ decorations/DecorationsForceQuitDialog.cpp 2015-08-24 17:01:53 +0000
@@ -169,6 +169,14 @@
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));
170 gtk_widget_realize(GTK_WIDGET(self));170 gtk_widget_realize(GTK_WIDGET(self));
171171
172 glib::Object<GtkCssProvider> style(gtk_css_provider_new());
173 gtk_css_provider_load_from_data(style, R"(
174 * { background-color: transparent; }
175 )", -1, nullptr);
176
177 auto* style_ctx = gtk_widget_get_style_context(GTK_WIDGET(self));
178 gtk_style_context_add_provider(style_ctx, glib::object_cast<GtkStyleProvider>(style), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
179
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));
173181
174 gtk_window_set_modal(self, TRUE);182 gtk_window_set_modal(self, TRUE);
175183
=== modified file 'decorations/DecorationsManager.cpp'
--- decorations/DecorationsManager.cpp 2015-02-03 08:38:19 +0000
+++ decorations/DecorationsManager.cpp 2015-08-24 17:01:53 +0000
@@ -172,7 +172,7 @@
172{172{
173 auto const& win = GetWindowByXid(xid);173 auto const& win = GetWindowByXid(xid);
174174
175 if (win && !win->impl_->win_->hasUnmapReference())175 if (win && !win->GetCompWindow()->hasUnmapReference())
176 {176 {
177 win->Update();177 win->Update();
178 return true;178 return true;
@@ -306,6 +306,10 @@
306 return false;306 return false;
307307
308 auto const& win = GetWindowByFrame(event->xany.window);308 auto const& win = GetWindowByFrame(event->xany.window);
309 CompWindow* comp_window = win ? win->GetCompWindow() : nullptr;
310
311 if (comp_window && comp_window->defaultViewport() != screen->vp())
312 return false;
309313
310 // ButtonRelease events might happen also outside the frame window, in this314 // ButtonRelease events might happen also outside the frame window, in this
311 // case we must unset the mouse owner, wherever the event happens.315 // case we must unset the mouse owner, wherever the event happens.
312316
=== modified file 'launcher/ApplicationLauncherIcon.cpp'
--- launcher/ApplicationLauncherIcon.cpp 2015-04-22 23:43:16 +0000
+++ launcher/ApplicationLauncherIcon.cpp 2015-08-24 17:01:53 +0000
@@ -48,7 +48,6 @@
48namespace48namespace
49{49{
50// We use the "bamf-" prefix since the manager is protected, to avoid name clash50// We use the "bamf-" prefix since the manager is protected, to avoid name clash
51const std::string WINDOW_MOVE_TIMEOUT = "bamf-window-move";
52const std::string ICON_REMOVE_TIMEOUT = "bamf-icon-remove";51const std::string ICON_REMOVE_TIMEOUT = "bamf-icon-remove";
53const std::string ICON_DND_OVER_TIMEOUT = "bamf-icon-dnd-over";52const std::string ICON_DND_OVER_TIMEOUT = "bamf-icon-dnd-over";
54const std::string DEFAULT_ICON = "application-default-icon";53const std::string DEFAULT_ICON = "application-default-icon";
@@ -87,12 +86,11 @@
8786
88 WindowManager& wm = WindowManager::Default();87 WindowManager& wm = WindowManager::Default();
89 wm.window_minimized.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::OnWindowMinimized));88 wm.window_minimized.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::OnWindowMinimized));
90 wm.window_moved.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::OnWindowMoved));
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));
92 wm.terminate_expo.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowState));90 wm.terminate_expo.connect(sigc::mem_fun(this, &ApplicationLauncherIcon::EnsureWindowState));
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))));
9492
95 EnsureWindowState();93 EnsureWindowsLocation();
96}94}
9795
98ApplicationLauncherIcon::~ApplicationLauncherIcon()96ApplicationLauncherIcon::~ApplicationLauncherIcon()
@@ -156,14 +154,16 @@
156{154{
157 // Lambda functions should be fine here because when the application the icon155 // Lambda functions should be fine here because when the application the icon
158 // is only ever removed when the application is closed.156 // is only ever removed when the application is closed.
159 signals_conn_.Add(app_->window_opened.connect([this](ApplicationWindowPtr const&) {157 signals_conn_.Add(app_->window_opened.connect([this](ApplicationWindowPtr const& win) {
160 EnsureWindowState();158 signals_conn_.Add(win->monitor.changed.connect([this] (int) { EnsureWindowsLocation(); }));
161 UpdateIconGeometries(GetCenters());159 EnsureWindowsLocation();
162 }));160 }));
163161
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));
165 signals_conn_.Add(app_->window_closed.connect(ensure_windows_cb));163 signals_conn_.Add(app_->window_closed.connect(ensure_win_location_cb));
166 signals_conn_.Add(app_->window_moved.connect(ensure_windows_cb));164
165 for (auto& win : app_->GetWindows())
166 signals_conn_.Add(win->monitor.changed.connect(ensure_win_location_cb));
167167
168 signals_conn_.Add(app_->urgent.changed.connect([this](bool const& urgent) {168 signals_conn_.Add(app_->urgent.changed.connect([this](bool const& urgent) {
169 LOG_DEBUG(logger) << tooltip_text() << " urgent now " << (urgent ? "true" : "false");169 LOG_DEBUG(logger) << tooltip_text() << " urgent now " << (urgent ? "true" : "false");
@@ -535,19 +535,6 @@
535 }535 }
536}536}
537537
538void ApplicationLauncherIcon::OnWindowMoved(guint32 moved_win)
539{
540 if (!app_->OwnsWindow(moved_win))
541 return;
542
543 _source_manager.AddTimeout(250, [this] {
544 EnsureWindowState();
545 UpdateIconGeometries(GetCenters());
546
547 return false;
548 }, WINDOW_MOVE_TIMEOUT);
549}
550
551void ApplicationLauncherIcon::UpdateDesktopFile()538void ApplicationLauncherIcon::UpdateDesktopFile()
552{539{
553 std::string const& filename = app_->desktop_file();540 std::string const& filename = app_->desktop_file();
@@ -738,8 +725,8 @@
738 // If monitor is -1 (or negative), show on all monitors.725 // If monitor is -1 (or negative), show on all monitors.
739 if (monitor < 0)726 if (monitor < 0)
740 {727 {
741 for (unsigned j; j < monitors::MAX; j++)728 for (unsigned j; j < monitors::MAX; ++j)
742 ++number_of_windows_on_monitor[j];729 ++number_of_windows_on_monitor[j];
743 }730 }
744 else731 else
745 {732 {
@@ -748,12 +735,18 @@
748 }735 }
749 }736 }
750737
751 for (unsigned i = 0; i < monitors::MAX; i++)738 for (unsigned i = 0; i < monitors::MAX; ++i)
752 SetNumberOfWindowsVisibleOnMonitor(number_of_windows_on_monitor[i], i);739 SetNumberOfWindowsVisibleOnMonitor(number_of_windows_on_monitor[i], i);
753740
754 WindowsChanged.emit();741 WindowsChanged.emit();
755}742}
756743
744void ApplicationLauncherIcon::EnsureWindowsLocation()
745{
746 EnsureWindowState();
747 UpdateIconGeometries(GetCenters());
748}
749
757void ApplicationLauncherIcon::UpdateDesktopQuickList()750void ApplicationLauncherIcon::UpdateDesktopQuickList()
758{751{
759 std::string const& desktop_file = DesktopFile();752 std::string const& desktop_file = DesktopFile();
760753
=== modified file 'launcher/ApplicationLauncherIcon.h'
--- launcher/ApplicationLauncherIcon.h 2014-06-07 16:27:16 +0000
+++ launcher/ApplicationLauncherIcon.h 2015-08-24 17:01:53 +0000
@@ -116,6 +116,7 @@
116 void UnsetApplication();116 void UnsetApplication();
117 void SetupApplicationSignalsConnections();117 void SetupApplicationSignalsConnections();
118 void EnsureWindowState();118 void EnsureWindowState();
119 void EnsureWindowsLocation();
119 void EnsureMenuItemsWindowsReady();120 void EnsureMenuItemsWindowsReady();
120 void EnsureMenuItemsDefaultReady();121 void EnsureMenuItemsDefaultReady();
121 void EnsureMenuItemsStaticQuicklist();122 void EnsureMenuItemsStaticQuicklist();
@@ -127,7 +128,6 @@
127 bool Spread(bool current_desktop, int state, bool force);128 bool Spread(bool current_desktop, int state, bool force);
128129
129 void OnWindowMinimized(guint32 xid);130 void OnWindowMinimized(guint32 xid);
130 void OnWindowMoved(guint32 xid);
131131
132 WindowList GetWindows(WindowFilterMask filter = 0, int monitor = -1);132 WindowList GetWindows(WindowFilterMask filter = 0, int monitor = -1);
133 const std::set<std::string> GetSupportedTypes();133 const std::set<std::string> GetSupportedTypes();
134134
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2015-05-21 16:30:26 +0000
+++ launcher/Launcher.cpp 2015-08-24 17:01:53 +0000
@@ -677,7 +677,9 @@
677 // goes for 0.0f when fully unfolded, to 1.0f folded677 // goes for 0.0f when fully unfolded, to 1.0f folded
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);
679 float unfold_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor());679 float unfold_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor());
680 float active_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor());
680681
682 unfold_progress = CLAMP(unfold_progress + active_progress, 0.0f, 1.0f);
681 folding_progress *= 1.0f - unfold_progress;683 folding_progress *= 1.0f - unfold_progress;
682684
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);
@@ -779,9 +781,12 @@
779 sum += height;781 sum += height;
780782
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";
782 float magic_constant = 1.3f;784 const float magic_constant = 1.3f;
783785
784 float unfold_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor());786 float unfold_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor());
787 float active_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor());
788
789 unfold_progress = CLAMP(unfold_progress + active_progress, 0.0f, 1.0f);
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);
786 }791 }
787792
@@ -1597,6 +1602,7 @@
1597{1602{
1598 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::VISIBLE, ANIM_DURATION_SHORT, monitor());1603 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::VISIBLE, ANIM_DURATION_SHORT, monitor());
1599 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::RUNNING, ANIM_DURATION_SHORT, monitor());1604 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::RUNNING, ANIM_DURATION_SHORT, monitor());
1605 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::ACTIVE, ANIM_DURATION_SHORT, monitor());
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());
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());
1602 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PRESENTED, ANIM_DURATION, monitor());1608 icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PRESENTED, ANIM_DURATION, monitor());
16031609
=== modified file 'panel/PanelMenuView.cpp'
--- panel/PanelMenuView.cpp 2015-04-20 18:42:25 +0000
+++ panel/PanelMenuView.cpp 2015-08-24 17:01:53 +0000
@@ -146,6 +146,8 @@
146 am.active_application_changed.connect(sigc::mem_fun(this, &PanelMenuView::OnActiveAppChanged));146 am.active_application_changed.connect(sigc::mem_fun(this, &PanelMenuView::OnActiveAppChanged));
147 am.application_started.connect(sigc::mem_fun(this, &PanelMenuView::OnApplicationStarted));147 am.application_started.connect(sigc::mem_fun(this, &PanelMenuView::OnApplicationStarted));
148 am.application_stopped.connect(sigc::mem_fun(this, &PanelMenuView::OnApplicationClosed));148 am.application_stopped.connect(sigc::mem_fun(this, &PanelMenuView::OnApplicationClosed));
149 am.window_opened.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowOpened));
150 am.window_closed.connect(sigc::mem_fun(this, &PanelMenuView::OnWindowClosed));
149151
150 mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter));152 mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter));
151 mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave));153 mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave));
@@ -1028,6 +1030,19 @@
1028 }1030 }
1029}1031}
10301032
1033void PanelMenuView::OnWindowOpened(ApplicationWindowPtr const& win)
1034{
1035 if (win->window_id() == window_buttons_->controlled_window() &&
1036 win->title.changed.empty())
1037 {
1038 /* This is a not so nice workaround that we need to include here, since
1039 * BAMF might be late in informing us about a new window, and thus we
1040 * can't connect to it's signals (as not available in the App Manager). */
1041 window_buttons_->controlled_window = 0;
1042 UpdateTargetWindowItems();
1043 }
1044}
1045
1031void PanelMenuView::OnWindowClosed(ApplicationWindowPtr const& win)1046void PanelMenuView::OnWindowClosed(ApplicationWindowPtr const& win)
1032{1047{
1033 /* FIXME, this can be removed when window_unmapped WindowManager signal1048 /* FIXME, this can be removed when window_unmapped WindowManager signal
10341049
=== modified file 'panel/PanelMenuView.h'
--- panel/PanelMenuView.h 2015-04-20 17:58:31 +0000
+++ panel/PanelMenuView.h 2015-08-24 17:01:53 +0000
@@ -89,6 +89,7 @@
89 void OnEntryViewAdded(PanelIndicatorEntryView* view);89 void OnEntryViewAdded(PanelIndicatorEntryView* view);
90 void OnApplicationStarted(ApplicationPtr const&);90 void OnApplicationStarted(ApplicationPtr const&);
91 void OnApplicationClosed(ApplicationPtr const&);91 void OnApplicationClosed(ApplicationPtr const&);
92 void OnWindowOpened(ApplicationWindowPtr const&);
92 void OnWindowClosed(ApplicationWindowPtr const&);93 void OnWindowClosed(ApplicationWindowPtr const&);
93 void OnActiveWindowChanged(ApplicationWindowPtr const&);94 void OnActiveWindowChanged(ApplicationWindowPtr const&);
94 void OnActiveAppChanged(ApplicationPtr const&);95 void OnActiveAppChanged(ApplicationPtr const&);
9596
=== modified file 'shutdown/SessionButton.cpp'
--- shutdown/SessionButton.cpp 2014-05-08 04:04:18 +0000
+++ shutdown/SessionButton.cpp 2015-08-24 17:01:53 +0000
@@ -40,6 +40,7 @@
40 : nux::View(NUX_FILE_LINE_PARAM)40 : nux::View(NUX_FILE_LINE_PARAM)
41 , scale(1.0)41 , scale(1.0)
42 , highlighted(false)42 , highlighted(false)
43 , pressed(false)
43 , action([this] { return action_; })44 , action([this] { return action_; })
44 , label([this] { return label_view_->GetText(); })45 , label([this] { return label_view_->GetText(); })
45 , action_(action)46 , action_(action)
@@ -107,6 +108,8 @@
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; });
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; });
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(); });
111 mouse_down.connect([this] (int, int, unsigned long, unsigned long) { pressed = true; });
112 mouse_up.connect([this] (int, int, unsigned long, unsigned long) { pressed = false; });
110113
111 begin_key_focus.connect([this] { highlighted = true; });114 begin_key_focus.connect([this] { highlighted = true; });
112 end_key_focus.connect([this] { highlighted = false; });115 end_key_focus.connect([this] { highlighted = false; });
@@ -116,6 +119,10 @@
116 image_view_->SetTexture(value ? highlight_tex_ : normal_tex_);119 image_view_->SetTexture(value ? highlight_tex_ : normal_tex_);
117 label_view_->SetTextColor(value ? nux::color::White : nux::color::Transparent);120 label_view_->SetTextColor(value ? nux::color::White : nux::color::Transparent);
118 });121 });
122
123 pressed.changed.connect([this] (bool value) {
124 image_view_->SetOpacity(value ? 0.75 : 1.0);
125 });
119}126}
120127
121void Button::UpdateTextures(std::string const& texture_prefix)128void Button::UpdateTextures(std::string const& texture_prefix)
122129
=== modified file 'shutdown/SessionButton.h'
--- shutdown/SessionButton.h 2014-05-05 18:42:45 +0000
+++ shutdown/SessionButton.h 2015-08-24 17:01:53 +0000
@@ -52,6 +52,7 @@
5252
53 nux::Property<double> scale;53 nux::Property<double> scale;
54 nux::Property<bool> highlighted;54 nux::Property<bool> highlighted;
55 nux::Property<bool> pressed;
55 nux::ROProperty<Action> action;56 nux::ROProperty<Action> action;
56 nux::ROProperty<std::string> label;57 nux::ROProperty<std::string> label;
5758
5859
=== modified file 'shutdown/SessionView.cpp'
--- shutdown/SessionView.cpp 2014-06-18 15:08:33 +0000
+++ shutdown/SessionView.cpp 2015-08-24 17:01:53 +0000
@@ -236,7 +236,7 @@
236 {236 {
237 if (mode() == Mode::FULL)237 if (mode() == Mode::FULL)
238 {238 {
239 if (manager_->CanLock())239 if (manager_->CanLock() && !manager_->is_locked())
240 {240 {
241 auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION);241 auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION);
242 button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen));242 button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen));
243243
=== modified file 'tests/autopilot/unity/emulators/__init__.py'
--- tests/autopilot/unity/emulators/__init__.py 2013-10-03 02:47:42 +0000
+++ tests/autopilot/unity/emulators/__init__.py 2015-08-24 17:01:53 +0000
@@ -28,6 +28,30 @@
2828
29 _Backend = DBusAddress.SessionBus(DBUS_SERVICE, DBUS_OBJECT)29 _Backend = DBusAddress.SessionBus(DBUS_SERVICE, DBUS_OBJECT)
3030
31 def _repr_string(self, obj_details=""):
32 geostr = ""
33 if hasattr(self, 'globalRect'):
34 geostr = " geo=[{r.x}x{r.y} {r.width}x{r.height}]".format(r=self.globalRect)
35
36 obj_details.strip()
37 obj_details = " "+obj_details if len(obj_details) else ""
38
39 return "<{cls} {addr} id={id}{geo}{details}>".format(cls=self.__class__.__name__,
40 addr=hex(id(self)),
41 id=self.id,
42 geo=geostr,
43 details=obj_details)
44
45 def __repr__(self):
46 with self.no_automatic_refreshing():
47 return self._repr_string()
48
49 def __eq__(self, other):
50 return isinstance(other, self.__class__) and self.id == other.id
51
52 def __ne__(self, other):
53 return not self.__eq__(other)
54
3155
32def ensure_unity_is_running(timeout=300):56def ensure_unity_is_running(timeout=300):
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.
3458
=== modified file 'tests/autopilot/unity/emulators/dash.py'
--- tests/autopilot/unity/emulators/dash.py 2015-04-10 16:22:23 +0000
+++ tests/autopilot/unity/emulators/dash.py 2015-08-24 17:01:53 +0000
@@ -158,7 +158,7 @@
158158
159 @property159 @property
160 def geometry(self):160 def geometry(self):
161 return (self.view.x, self.view.y, self.view.width, self.view.height)161 return self.view.globalRect
162162
163163
164class DashView(UnityIntrospectionObject):164class DashView(UnityIntrospectionObject):
@@ -225,10 +225,12 @@
225class ScopeView(UnityIntrospectionObject):225class ScopeView(UnityIntrospectionObject):
226 """A Scope View."""226 """A Scope View."""
227227
228 def get_groups(self):228 def get_categories(self, only_visible=False):
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."""
230 groups = self.get_children_by_type(PlacesGroup)230 if only_visible:
231 return groups231 return self.get_children_by_type(PlacesGroup, is_visible=True)
232
233 return self.get_children_by_type(PlacesGroup)
232234
233 def get_focused_category(self):235 def get_focused_category(self):
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.
@@ -236,30 +238,22 @@
236 Returns None if no category headers have keyboard focus.238 Returns None if no category headers have keyboard focus.
237239
238 """240 """
239 categories = self.get_children_by_type(PlacesGroup)241 matches = self.get_children_by_type(PlacesGroup, header_has_keyfocus=True)
240 matches = [m for m in categories if m.header_has_keyfocus]242 return matches[0] if matches else None
241 if matches:
242 return matches[0]
243 return None
244243
245 def get_category_by_name(self, category_name):244 def get_category_by_name(self, category_name):
246 """Return a PlacesGroup instance with the given name, or None."""245 """Return a PlacesGroup instance with the given name, or None."""
247 categories = self.get_children_by_type(PlacesGroup)246 matches = self.get_children_by_type(PlacesGroup, name=category_name)
248 matches = [m for m in categories if m.name == category_name]247 return matches[0] if matches else None
249 if matches:
250 return matches[0]
251 return None
252248
253 def get_num_visible_categories(self):249 def get_num_visible_categories(self):
254 """Get the number of visible categories in this scope."""250 """Get the number of visible categories in this scope."""
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))
256252
257 def get_filterbar(self):253 def get_filterbar(self):
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."""
259 bars = self.get_children_by_type(FilterBar)255 bars = self.get_children_by_type(FilterBar)
260 if bars:256 return bars[0] if bars else None
261 return bars[0]
262 return None
263257
264258
265class PlacesGroup(UnityIntrospectionObject):259class PlacesGroup(UnityIntrospectionObject):
@@ -279,26 +273,16 @@
279 """A single result in the dash."""273 """A single result in the dash."""
280274
281 def activate(self, double_click=True):275 def activate(self, double_click=True):
282 tx = self.x + (self.width / 2)
283 ty = self.y + (self.height / 2)
284 m = Mouse.create()276 m = Mouse.create()
285 m.move(tx, ty)277 m.click_object(self, button=1)
286 m.click(1)
287 if double_click:278 if double_click:
288 m.click(1)279 m.click_object(self, button=1)
289280
290 def preview(self, button=1):281 def preview(self, button=1):
291 tx = self.x + (self.width / 2)282 Mouse.create().click_object(self, button)
292 ty = self.y + (self.height / 2)
293 m = Mouse.create()
294 m.move(tx, ty)
295 m.click(button)
296283
297 def preview_key(self):284 def preview_key(self):
298 tx = self.x + (self.width / 2)285 Mouse.create().move_to_object(self)
299 ty = self.y + (self.height / 2)
300 m = Mouse.create()
301 m.move(tx, ty)
302286
303 k = Keyboard.create()287 k = Keyboard.create()
304 k.press_and_release('Menu')288 k.press_and_release('Menu')
@@ -313,11 +297,8 @@
313297
314 def get_focused_filter(self):298 def get_focused_filter(self):
315 """Returns the id of the focused filter widget."""299 """Returns the id of the focused filter widget."""
316 filters = self.get_children_by_type(FilterExpanderLabel)300 filters = self.get_children_by_type(FilterExpanderLabel, expander_has_focus=True)
317 for filter_label in filters:301 return filters[0] if filters else None
318 if filter_label.expander_has_focus:
319 return filter_label
320 return None
321302
322 @property303 @property
323 def expanded(self):304 def expanded(self):
@@ -366,21 +347,13 @@
366 def ensure_expanded(self):347 def ensure_expanded(self):
367 """Expand the filter expander label, if it's not already"""348 """Expand the filter expander label, if it's not already"""
368 if not self.expanded:349 if not self.expanded:
369 tx = self.x + self.width / 2350 Mouse.create().click_object(self)
370 ty = self.y + self.height / 2
371 m = Mouse.create()
372 m.move(tx, ty)
373 m.click()
374 self.expanded.wait_for(True)351 self.expanded.wait_for(True)
375352
376 def ensure_collapsed(self):353 def ensure_collapsed(self):
377 """Collapse the filter expander label, if it's not already"""354 """Collapse the filter expander label, if it's not already"""
378 if self.expanded:355 if self.expanded:
379 tx = self.x + self.width / 2356 Mouse.create().click_object(self)
380 ty = self.y + self.height / 2
381 m = Mouse.create()
382 m.move(tx, ty)
383 m.click()
384 self.expanded.wait_for(False)357 self.expanded.wait_for(False)
385358
386359
@@ -402,21 +375,14 @@
402375
403 def get_action_by_id(self, action_id):376 def get_action_by_id(self, action_id):
404 """Returns the action given it's action hint."""377 """Returns the action given it's action hint."""
405 actions = self.get_children_by_type(ActionButton)378 actions = self.get_children_by_type(ActionButton, action=action_id)
406 for action in actions:379 return actions[0] if actions else None
407 if action.action == action_id:
408 return action
409 return None
410380
411 def execute_action_by_id(self, action_id):381 def execute_action_by_id(self, action_id):
412 """Executes an action given by the id."""382 """Executes an action given by the id."""
413 action = self.get_action_by_id(action_id)383 action = self.get_action_by_id(action_id)
414 if action:384 if action:
415 tx = action.x + (action.width / 2)385 Mouse.create().click_object(action)
416 ty = action.y + (action.height / 2)
417 m = Mouse.create()
418 m.move(tx, ty)
419 m.click()
420386
421 @property387 @property
422 def cover_art(self):388 def cover_art(self):
@@ -495,12 +461,8 @@
495461
496 def navigate_left(self, count=1):462 def navigate_left(self, count=1):
497 """Navigate preview left"""463 """Navigate preview left"""
498 navigator = self.get_left_navigator()
499
500 tx = navigator.button_x + (navigator.button_width / 2)
501 ty = navigator.button_y + (navigator.button_height / 2)
502 m = Mouse.create()464 m = Mouse.create()
503 m.move(tx, ty)465 m.move_to_object(self.get_left_navigator().button_geo)
504466
505 old_preview_initiate_count = self.preview_initiate_count467 old_preview_initiate_count = self.preview_initiate_count
506468
@@ -512,12 +474,8 @@
512474
513 def navigate_right(self, count=1):475 def navigate_right(self, count=1):
514 """Navigate preview right"""476 """Navigate preview right"""
515 navigator = self.get_right_navigator()
516
517 tx = navigator.button_x + (navigator.button_width / 2)
518 ty = navigator.button_y + (navigator.button_height / 2)
519 m = Mouse.create()477 m = Mouse.create()
520 m.move(tx, ty)478 m.move_to_object(self.get_right_navigator().button_geo)
521479
522 old_preview_initiate_count = self.preview_initiate_count480 old_preview_initiate_count = self.preview_initiate_count
523481
@@ -607,3 +565,4 @@
607565
608class StaticCairoText(UnityIntrospectionObject):566class StaticCairoText(UnityIntrospectionObject):
609 """Text boxes in the preview"""567 """Text boxes in the preview"""
568
610569
=== modified file 'tests/autopilot/unity/emulators/hud.py'
--- tests/autopilot/unity/emulators/hud.py 2013-10-03 01:33:53 +0000
+++ tests/autopilot/unity/emulators/hud.py 2015-08-24 17:01:53 +0000
@@ -105,7 +105,7 @@
105105
106 @property106 @property
107 def geometry(self):107 def geometry(self):
108 return (self.x, self.y, self.width, self.height)108 return self.globalRect
109109
110 @property110 @property
111 def selected_button(self):111 def selected_button(self):
@@ -156,7 +156,7 @@
156156
157 @property157 @property
158 def geometry(self):158 def geometry(self):
159 return (self.x, self.y, self.width, self.height)159 return self.globalRect
160160
161161
162class HudButton(UnityIntrospectionObject):162class HudButton(UnityIntrospectionObject):
163163
=== modified file 'tests/autopilot/unity/emulators/icons.py'
--- tests/autopilot/unity/emulators/icons.py 2013-11-14 01:56:41 +0000
+++ tests/autopilot/unity/emulators/icons.py 2015-08-24 17:01:53 +0000
@@ -58,10 +58,6 @@
5858
59 return self.xids.contains(xid)59 return self.xids.contains(xid)
6060
61 def __repr__(self):
62 with self.no_automatic_refreshing():
63 return "<%s id=%d>" % (self.__class__.__name__, self.id)
64
6561
66class BFBLauncherIcon(SimpleLauncherIcon):62class BFBLauncherIcon(SimpleLauncherIcon):
67 """Represents the BFB button in the launcher."""63 """Represents the BFB button in the launcher."""
@@ -80,10 +76,7 @@
8076
81 def __repr__(self):77 def __repr__(self):
82 with self.no_automatic_refreshing():78 with self.no_automatic_refreshing():
83 return "<%s %s id=%d>" % (79 return self._repr_string("{0.desktop_id}".format(self))
84 self.__class__.__name__,
85 self.desktop_id,
86 self.id)
8780
88class TrashLauncherIcon(SimpleLauncherIcon):81class TrashLauncherIcon(SimpleLauncherIcon):
89 """Represents the trash launcher icon."""82 """Represents the trash launcher icon."""
@@ -110,7 +103,7 @@
110103
111 @property104 @property
112 def geometry(self):105 def geometry(self):
113 return (self.x, self.y, self.width, self.height)106 return self.globalRect
114107
115108
116class LauncherEntry(UnityIntrospectionObject):109class LauncherEntry(UnityIntrospectionObject):
117110
=== modified file 'tests/autopilot/unity/emulators/launcher.py'
--- tests/autopilot/unity/emulators/launcher.py 2014-01-23 15:51:46 +0000
+++ tests/autopilot/unity/emulators/launcher.py 2015-08-24 17:01:53 +0000
@@ -118,12 +118,8 @@
118 def move_mouse_over_launcher(self):118 def move_mouse_over_launcher(self):
119 """Move the mouse over this launcher."""119 """Move the mouse over this launcher."""
120 move_mouse_to_screen(self.monitor)120 move_mouse_to_screen(self.monitor)
121 (x, y, w, h) = self.geometry
122 target_x = x + w / 2
123 target_y = y + h / 2
124
125 logger.debug("Moving mouse to center of launcher.")121 logger.debug("Moving mouse to center of launcher.")
126 self._mouse.move(target_x, target_y)122 self._mouse.move_to_object(self)
127123
128 def move_mouse_to_icon(self, icon, autoscroll_offset=0):124 def move_mouse_to_icon(self, icon, autoscroll_offset=0):
129 """Move the mouse to a specific icon."""125 """Move the mouse to a specific icon."""
@@ -438,8 +434,8 @@
438434
439 @property435 @property
440 def geometry(self):436 def geometry(self):
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."""
442 return (self.x, self.y, self.width, self.height)438 return self.globalRect
443439
444440
445class LauncherModel(UnityIntrospectionObject):441class LauncherModel(UnityIntrospectionObject):
446442
=== modified file 'tests/autopilot/unity/emulators/panel.py'
--- tests/autopilot/unity/emulators/panel.py 2015-02-18 00:49:47 +0000
+++ tests/autopilot/unity/emulators/panel.py 2015-08-24 17:01:53 +0000
@@ -14,6 +14,7 @@
1414
15from autopilot.input import Mouse15from autopilot.input import Mouse
16from autopilot.keybindings import KeybindingsHelper16from autopilot.keybindings import KeybindingsHelper
17from autopilot.introspection.types import Rectangle
1718
18from unity.emulators import UnityIntrospectionObject19from unity.emulators import UnityIntrospectionObject
19logger = logging.getLogger(__name__)20logger = logging.getLogger(__name__)
@@ -107,30 +108,18 @@
107108
108 def move_mouse_over_grab_area(self):109 def move_mouse_over_grab_area(self):
109 """Move the mouse over the grab area for this panel."""110 """Move the mouse over the grab area for this panel."""
110 (x, y, w, h) = self.grab_area.geometry
111 target_x = x + w / 2
112 target_y = y + h / 2
113
114 logger.debug("Moving mouse to center of grab area.")111 logger.debug("Moving mouse to center of grab area.")
115 self._mouse.move(target_x, target_y)112 self._mouse.move_to_object(self.grab_area)
116113
117 def move_mouse_over_window_buttons(self):114 def move_mouse_over_window_buttons(self):
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."""
119 (x, y, w, h) = self.window_buttons.geometry
120 target_x = x + w / 2
121 target_y = y + h / 2
122
123 logger.debug("Moving mouse to center of the window buttons.")116 logger.debug("Moving mouse to center of the window buttons.")
124 self._mouse.move(target_x, target_y)117 self._mouse.move_to_object(self.window_buttons)
125118
126 def move_mouse_over_indicators(self):119 def move_mouse_over_indicators(self):
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."""
128 (x, y, w, h) = self.indicators.geometry
129 target_x = x + w / 2
130 target_y = y + h / 2
131
132 logger.debug("Moving mouse to center of the indicators area.")121 logger.debug("Moving mouse to center of the indicators area.")
133 self._mouse.move(target_x, target_y)122 self._mouse.move_to_object(self.indicators)
134123
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):
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"""
@@ -192,8 +181,8 @@
192181
193 @property182 @property
194 def geometry(self):183 def geometry(self):
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."""
196 return (self.x, self.y, self.width, self.height)185 return self.globalRect
197186
198187
199class MenuView(UnityIntrospectionObject):188class MenuView(UnityIntrospectionObject):
@@ -215,8 +204,8 @@
215204
216 @property205 @property
217 def geometry(self):206 def geometry(self):
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."""
219 return (self.x, self.y, self.width, self.height)208 return self.globalRect
220209
221210
222class WindowButtons(UnityIntrospectionObject):211class WindowButtons(UnityIntrospectionObject):
@@ -256,8 +245,8 @@
256245
257 @property246 @property
258 def geometry(self):247 def geometry(self):
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."""
260 return (self.x, self.y, self.width, self.height)249 return self.globalRect
261250
262251
263class WindowButton(UnityIntrospectionObject):252class WindowButton(UnityIntrospectionObject):
@@ -268,20 +257,25 @@
268 self._mouse = Mouse.create()257 self._mouse = Mouse.create()
269258
270 def mouse_move_to(self):259 def mouse_move_to(self):
271 target_x = self.x + self.width / 2260 self._mouse.move_to_object(self)
272 target_y = self.y + self.height / 2
273 self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005)
274261
275 def mouse_click(self):262 def mouse_click(self):
276 self.mouse_move_to()263 # Ignore buttons that are placed at 0x0, as they're invisible yet
277 sleep(.2)264 if not self.x and not self.y and not self.visible:
278 self._mouse.click(press_duration=.1)265 return
266
267 self._mouse.click_object(self)
279 sleep(.01)268 sleep(.01)
280269
281 @property270 @property
282 def geometry(self):271 def geometry(self):
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."""
284 return (self.x, self.y, self.width, self.height)273 return self.globalRect
274
275 def __repr__(self):
276 with self.no_automatic_refreshing():
277 details = "type={0.type} state={0.visual_state} sensitive={0.sensitive}".format(self)
278 return self._repr_string(details)
285279
286280
287class GrabArea(UnityIntrospectionObject):281class GrabArea(UnityIntrospectionObject):
@@ -289,8 +283,8 @@
289283
290 @property284 @property
291 def geometry(self):285 def geometry(self):
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."""
293 return (self.x, self.y, self.width, self.height)287 return self.globalRect
294288
295289
296class Indicators(UnityIntrospectionObject):290class Indicators(UnityIntrospectionObject):
@@ -314,8 +308,8 @@
314308
315 @property309 @property
316 def geometry(self):310 def geometry(self):
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."""
318 return (self.x, self.y, self.width, self.height)312 return self.globalRect
319313
320314
321class IndicatorEntry(UnityIntrospectionObject):315class IndicatorEntry(UnityIntrospectionObject):
@@ -326,30 +320,26 @@
326 self._mouse = Mouse.create()320 self._mouse = Mouse.create()
327321
328 def mouse_move_to(self):322 def mouse_move_to(self):
329 target_x = self.x + self.width / 2323 self._mouse.move_to_object(self)
330 target_y = self.y + self.height / 2
331 self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005)
332324
333 def mouse_click(self, button=1):325 def mouse_click(self, button=1):
334 self.mouse_move_to()326 self._mouse.click_object(self, button=button)
335 sleep(.2)
336 assert(self.visible)
337 self._mouse.click(press_duration=.1)
338 sleep(.01)327 sleep(.01)
339328
340 @property329 @property
341 def geometry(self):330 def geometry(self):
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."""
343 return (self.x, self.y, self.width, self.height)332 return self.globalRect
344333
345 @property334 @property
346 def menu_geometry(self):335 def menu_geometry(self):
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."""
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)
349338
350 def __repr__(self):339 def __repr__(self):
351 with self.no_automatic_refreshing():340 with self.no_automatic_refreshing():
352 return "<IndicatorEntry 0x%x (%s)>" % (id(self), self.label)341 details = "label={0.label}".format(self)
342 return self._repr_string(details)
353343
354344
355class Tray(UnityIntrospectionObject):345class Tray(UnityIntrospectionObject):
356346
=== modified file 'tests/autopilot/unity/emulators/quicklist.py'
--- tests/autopilot/unity/emulators/quicklist.py 2013-05-10 05:16:07 +0000
+++ tests/autopilot/unity/emulators/quicklist.py 2015-08-24 17:01:53 +0000
@@ -66,8 +66,8 @@
6666
67 @property67 @property
68 def geometry(self):68 def geometry(self):
69 """Returns a tuple of (x,y,w,h) for the quicklist."""69 """Returns a Rectangle (x,y,w,h) for the quicklist."""
70 return (self.x, self.y, self.width, self.height)70 return self.globalRect
7171
7272
73class QuicklistMenuItem(UnityIntrospectionObject):73class QuicklistMenuItem(UnityIntrospectionObject):
@@ -79,20 +79,17 @@
7979
80 @property80 @property
81 def geometry(self):81 def geometry(self):
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."""
83 return (self.x, self.y, self.width, self.height)83 return self.globalRect
8484
85 def mouse_move_to(self):85 def mouse_move_to(self):
86 assert(self.visible)86 assert(self.visible)
87 logger.debug("Moving mouse over quicklist item %r", self)87 logger.debug("Moving mouse over quicklist item %r", self)
88 target_x = self.x + self.width / 288 self._mouse.move_to_object(self)
89 target_y = self.y + self.height / 2
90 self._mouse.move(target_x, target_y, rate=20, time_between_events=0.005)
9189
92 def mouse_click(self, button=1):90 def mouse_click(self, button=1):
93 logger.debug("Clicking on quicklist item %r", self)91 logger.debug("Clicking on quicklist item %r", self)
94 self.mouse_move_to()92 self._mouse.click_object(self)
95 self._mouse.click()
9693
9794
98class QuicklistMenuItemLabel(QuicklistMenuItem):95class QuicklistMenuItemLabel(QuicklistMenuItem):
9996
=== modified file 'tests/autopilot/unity/emulators/screen.py'
--- tests/autopilot/unity/emulators/screen.py 2014-02-20 21:37:37 +0000
+++ tests/autopilot/unity/emulators/screen.py 2015-08-24 17:01:53 +0000
@@ -13,6 +13,7 @@
13from unity.emulators import UnityIntrospectionObject13from unity.emulators import UnityIntrospectionObject
14from testtools.matchers import GreaterThan14from testtools.matchers import GreaterThan
1515
16from autopilot.introspection.types import Rectangle
16from unity.emulators.dash import SearchBar17from unity.emulators.dash import SearchBar
1718
18logger = logging.getLogger(__name__)19logger = logging.getLogger(__name__)
@@ -54,15 +55,15 @@
5455
55 @property56 @property
56 def geometry(self):57 def geometry(self):
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."""
58 return (self.x, self.y, self.width, self.height)59 return self.globalRect
5960
60 @property61 @property
61 def scale_close_geometry(self):62 def scale_close_geometry(self):
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."""
63 self.scaled_close_width.wait_for(GreaterThan(0))64 self.scaled_close_width.wait_for(GreaterThan(0))
64 self.scaled_close_height.wait_for(GreaterThan(0))65 self.scaled_close_height.wait_for(GreaterThan(0))
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)
6667
6768
68class SpreadFilter(UnityIntrospectionObject):69class SpreadFilter(UnityIntrospectionObject):
6970
=== modified file 'tests/autopilot/unity/emulators/window_manager.py'
--- tests/autopilot/unity/emulators/window_manager.py 2013-10-02 23:33:55 +0000
+++ tests/autopilot/unity/emulators/window_manager.py 2015-08-24 17:01:53 +0000
@@ -10,6 +10,7 @@
10from __future__ import absolute_import10from __future__ import absolute_import
1111
12import logging12import logging
13from autopilot.introspection.types import Rectangle
13from autopilot.keybindings import KeybindingsHelper14from autopilot.keybindings import KeybindingsHelper
1415
15from unity.emulators import UnityIntrospectionObject16from unity.emulators import UnityIntrospectionObject
@@ -22,8 +23,8 @@
2223
23 @property24 @property
24 def screen_geometry(self):25 def screen_geometry(self):
25 """Returns a tuple of (x,y,w,h) for the screen."""26 """Returns a Rectangle (x,y,w,h) for the screen."""
26 return (self.x, self.y, self.width, self.height)27 return self.globalRect
2728
28 def initiate_spread(self):29 def initiate_spread(self):
29 self.keybinding("spread/start")30 self.keybinding("spread/start")
3031
=== modified file 'tests/autopilot/unity/tests/launcher/test_icon_behavior.py'
--- tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2015-03-25 14:59:04 +0000
+++ tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2015-08-24 17:01:53 +0000
@@ -384,7 +384,7 @@
384 self.drag_type)384 self.drag_type)
385 moved_icon = self.unity.launcher.model.\385 moved_icon = self.unity.launcher.model.\
386 get_launcher_icons_for_monitor(self.launcher_monitor)[1]386 get_launcher_icons_for_monitor(self.launcher_monitor)[1]
387 self.assertThat(moved_icon.id, Equals(calc_icon.id))387 self.assertThat(moved_icon, Equals(calc_icon))
388388
389 def test_can_drag_icon_below_window_switcher(self):389 def test_can_drag_icon_below_window_switcher(self):
390 """Application icons must be dragable to below the workspace switcher icon."""390 """Application icons must be dragable to below the workspace switcher icon."""
391391
=== modified file 'tests/autopilot/unity/tests/launcher/test_visual.py'
--- tests/autopilot/unity/tests/launcher/test_visual.py 2013-12-11 19:12:58 +0000
+++ tests/autopilot/unity/tests/launcher/test_visual.py 2015-08-24 17:01:53 +0000
@@ -71,14 +71,12 @@
7171
72 def test_mouse_over_with_dash_open_desaturates_icons(self):72 def test_mouse_over_with_dash_open_desaturates_icons(self):
73 """Moving mouse over launcher with dash open must saturate icons."""73 """Moving mouse over launcher with dash open must saturate icons."""
74 launcher_instance = self.get_launcher()
75 self.unity.dash.ensure_visible()74 self.unity.dash.ensure_visible()
76 current_monitor = self.unity.dash.monitor75 current_monitor = self.unity.dash.monitor
7776
78 self.addCleanup(self.unity.dash.ensure_hidden)77 self.addCleanup(self.unity.dash.ensure_hidden)
79 sleep(.5)78 sleep(.5)
80 x,y,w,h = launcher_instance.geometry79 self.mouse.move_to_object(self.get_launcher())
81 self.mouse.move(x + w/2, y + h/2)
82 sleep(.5)80 sleep(.5)
83 for icon in self.unity.launcher.model.get_launcher_icons():81 for icon in self.unity.launcher.model.get_launcher_icons():
84 self.assertFalse(icon.monitors_desaturated[current_monitor])82 self.assertFalse(icon.monitors_desaturated[current_monitor])
8583
=== modified file 'tests/autopilot/unity/tests/test_dash.py'
--- tests/autopilot/unity/tests/test_dash.py 2015-02-19 19:23:39 +0000
+++ tests/autopilot/unity/tests/test_dash.py 2015-08-24 17:01:53 +0000
@@ -400,10 +400,11 @@
400400
401 # Test that tab cycles through the categories.401 # Test that tab cycles through the categories.
402 # + 1 is the filter bar402 # + 1 is the filter bar
403 for i in range(scope.get_num_visible_categories()):403 for category in scope.get_categories(only_visible=True):
404 self.keyboard.press_and_release('Tab')404 self.keyboard.press_and_release('Tab')
405 category = scope.get_focused_category()405 selected = scope.get_focused_category()
406 self.assertIsNot(category, None)406 expected = category if category.expand_label_is_visible else None
407 self.assertEqual(selected, expected)
407408
408 def test_tab_with_filter_bar(self):409 def test_tab_with_filter_bar(self):
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."""
@@ -544,10 +545,7 @@
544545
545 self.unity.dash.ensure_visible()546 self.unity.dash.ensure_visible()
546547
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)
548 self.unity.dash.searchbar.y + self.unity.dash.searchbar.height / 2)
549
550 self.mouse.click(button=2)
551549
552 self.assertThat(self.unity.dash.search_string, Eventually(Equals('ThirdButtonPaste')))550 self.assertThat(self.unity.dash.search_string, Eventually(Equals('ThirdButtonPaste')))
553551
@@ -691,7 +689,7 @@
691689
692 self.unity.dash.ensure_visible()690 self.unity.dash.ensure_visible()
693691
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)))
695693
696694
697 def test_see_more_result_alignment(self):695 def test_see_more_result_alignment(self):
@@ -701,11 +699,9 @@
701 self.unity.dash.reveal_application_scope()699 self.unity.dash.reveal_application_scope()
702700
703 scope = self.unity.dash.get_current_scope()701 scope = self.unity.dash.get_current_scope()
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))
705703
706 groups = scope.get_groups()704 for group in scope.get_categories():
707
708 for group in groups:
709 if (group.is_visible and group.expand_label_is_visible):705 if (group.is_visible and group.expand_label_is_visible):
710 expand_label_y = group.expand_label_y + group.expand_label_baseline706 expand_label_y = group.expand_label_y + group.expand_label_baseline
711 name_label_y = group.name_label_y + group.name_label_baseline707 name_label_y = group.name_label_y + group.name_label_baseline
@@ -725,10 +721,7 @@
725 the rectangle outside of the icon.721 the rectangle outside of the icon.
726 """722 """
727 app_icon = self.scopebar.get_icon_by_name(u'applications.scope')723 app_icon = self.scopebar.get_icon_by_name(u'applications.scope')
728724 self.mouse.click_object(app_icon)
729 self.mouse.move(app_icon.x + (app_icon.width / 2),
730 app_icon.y + (app_icon.height / 2))
731 self.mouse.click()
732725
733 self.assertThat(self.scopebar.active_scope, Eventually(Equals('applications.scope')))726 self.assertThat(self.scopebar.active_scope, Eventually(Equals('applications.scope')))
734727
@@ -1119,10 +1112,7 @@
1119 cover_art = self.get_current_preview().cover_art[0]1112 cover_art = self.get_current_preview().cover_art[0]
11201113
1121 # click the cover-art (this will set focus)1114 # click the cover-art (this will set focus)
1122 tx = cover_art.x + (cover_art.width / 2)1115 self.mouse.click_object(cover_art)
1123 ty = cover_art.y + (cover_art.height / 2)
1124 self.mouse.move(tx, ty)
1125 self.mouse.click()
11261116
1127 self.keyboard.press_and_release("Escape")1117 self.keyboard.press_and_release("Escape")
11281118
@@ -1138,13 +1128,21 @@
1138class PreviewClickCancelTests(DashTestCase):1128class PreviewClickCancelTests(DashTestCase):
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"""
11401130
1131 scenarios = [('Left button', {'clicked_button': 1}),
1132 ('Middle button', {'clicked_button': 2}),
1133 ('Right button', {'clicked_button': 3})]
1134
1141 def setUp(self):1135 def setUp(self):
1142 super(PreviewClickCancelTests, self).setUp()1136 super(PreviewClickCancelTests, self).setUp()
1143 gettext.install("unity-scope-applications")1137 gettext.install("unity-scope-applications")
1144 scope = self.unity.dash.reveal_application_scope()1138 scope = self.unity.dash.reveal_application_scope(clear_search=False)
1145 self.addCleanup(self.unity.dash.ensure_hidden)1139 self.addCleanup(self.unity.dash.ensure_hidden)
1146 # Only testing an application preview for this test.1140 # Only testing an application preview for this test.
1147 self.keyboard.type("Software Updater")1141
1142 search_string = "Software Updater"
1143 if self.unity.dash.search_string != search_string:
1144 self.unity.dash.clear_search()
1145 self.keyboard.type(search_string)
11481146
1149 # wait for "Installed" category1147 # wait for "Installed" category
1150 category = self.wait_for_category(scope, _("Installed"))1148 category = self.wait_for_category(scope, _("Installed"))
@@ -1159,183 +1157,43 @@
11591157
1160 self.preview_container = self.unity.dash.view.get_preview_container()1158 self.preview_container = self.unity.dash.view.get_preview_container()
11611159
1162 def test_left_click_on_preview_icon_cancel_preview(self):1160 def test_click_on_preview_icon_cancel_preview(self):
1163 """Left click on preview icon must close preview."""1161 """Clicking with any button on preview icon must close preview."""
1164 icon = self.get_current_preview().icon[0]1162 icon = self.get_current_preview().icon[0]
1165 self.assertThat(icon, NotEquals(None))1163 self.assertThat(icon, NotEquals(None))
11661164
1167 tx = icon.x + icon.width1165 self.mouse.click_object(icon, button=self.clicked_button)
1168 ty = icon.y + (icon.height / 2)1166 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1169 self.mouse.move(tx, ty)1167
1170 self.mouse.click(button=1)1168 def test_click_on_preview_image_cancel_preview(self):
11711169 """Clicking with any button on preview image must cancel the preview."""
1172 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))1170 cover_art = self.get_current_preview().cover_art[0]
11731171 self.assertThat(cover_art, NotEquals(None))
1174 def test_middle_click_on_preview_icon_cancel_preview(self):1172
1175 """Middle click on preview icon must close preview."""1173 self.mouse.click_object(cover_art, button=self.clicked_button)
1176 icon = self.get_current_preview().icon[0]1174 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1177 self.assertThat(icon, NotEquals(None))1175
11781176 def test_click_on_preview_text_cancel_preview(self):
1179 tx = icon.x + icon.width1177 """Clicking with any button on some preview text must cancel the preview."""
1180 ty = icon.y + (icon.height / 2)1178 text = self.get_current_preview().text_boxes[0]
1181 self.mouse.move(tx, ty)1179 self.assertThat(text, NotEquals(None))
1182 self.mouse.click(button=2)1180 self.mouse.click_object(text, button=self.clicked_button)
11831181
1184 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))1182 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
11851183
1186 def test_right_click_on_preview_icon_cancel_preview(self):1184 def test_click_on_preview_ratings_widget_cancel_preview(self):
1187 """Right click on preview icon must close preview."""1185 """Clicking with any button on the ratings widget must cancel the preview."""
1188 icon = self.get_current_preview().icon[0]1186 ratings_widget = self.get_current_preview().ratings_widget[0]
1189 self.assertThat(icon, NotEquals(None))1187 self.assertThat(ratings_widget, NotEquals(None))
11901188 self.mouse.click_object(ratings_widget, button=self.clicked_button)
1191 tx = icon.x + icon.width1189
1192 ty = icon.y + (icon.height / 2)1190 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1193 self.mouse.move(tx, ty)1191
1194 self.mouse.click(button=3)1192 def test_click_on_preview_info_hint_cancel_preview(self):
11951193 """Clicking with any button on the info hint must cancel the preview."""
1196 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))1194 info_hint = self.get_current_preview().info_hint_widget[0]
11971195 self.assertThat(info_hint, NotEquals(None))
1198 def test_left_click_on_preview_image_cancel_preview(self):1196 self.mouse.click_object(info_hint, button=self.clicked_button)
1199 """Left click on preview image must cancel the preview."""
1200 cover_art = self.get_current_preview().cover_art[0]
1201 self.assertThat(cover_art, NotEquals(None))
1202
1203 tx = cover_art.x + (cover_art.width / 2)
1204 ty = cover_art.y + (cover_art.height / 2)
1205 self.mouse.move(tx, ty)
1206 self.mouse.click(button=1)
1207
1208 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1209
1210 def test_middle_click_on_preview_image_cancel_preview(self):
1211 """Middle click on preview image must cancel the preview."""
1212 cover_art = self.get_current_preview().cover_art[0]
1213 self.assertThat(cover_art, NotEquals(None))
1214
1215 tx = cover_art.x + (cover_art.width / 2)
1216 ty = cover_art.y + (cover_art.height / 2)
1217 self.mouse.move(tx, ty)
1218 self.mouse.click(button=2)
1219
1220 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1221
1222 def test_right_click_on_preview_image_cancel_preview(self):
1223 """Right click on preview image must cancel the preview."""
1224 cover_art = self.get_current_preview().cover_art[0]
1225 self.assertThat(cover_art, NotEquals(None))
1226
1227 tx = cover_art.x + (cover_art.width / 2)
1228 ty = cover_art.y + (cover_art.height / 2)
1229 self.mouse.move(tx, ty)
1230 self.mouse.click(button=3)
1231
1232 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1233
1234 def test_left_click_on_preview_text_cancel_preview(self):
1235 """Left click on some preview text must cancel the preview."""
1236 text = self.get_current_preview().text_boxes[0]
1237 self.assertThat(text, NotEquals(None))
1238
1239 tx = text.x + (text.width / 2)
1240 ty = text.y + (text.height / 2)
1241 self.mouse.move(tx, ty)
1242 self.mouse.click(button=1)
1243
1244 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1245
1246 def test_middle_click_on_preview_text_cancel_preview(self):
1247 """Middle click on some preview text must cancel the preview."""
1248 text = self.get_current_preview().text_boxes[0]
1249 self.assertThat(text, NotEquals(None))
1250
1251 tx = text.x + (text.width / 2)
1252 ty = text.y + (text.height / 2)
1253 self.mouse.move(tx, ty)
1254 self.mouse.click(button=2)
1255
1256 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1257
1258 def test_right_click_on_preview_text_cancel_preview(self):
1259 """Right click on some preview text must cancel the preview."""
1260 text = self.get_current_preview().text_boxes[0]
1261 self.assertThat(text, NotEquals(None))
1262
1263 tx = text.x + (text.width / 2)
1264 ty = text.y + (text.height / 2)
1265 self.mouse.move(tx, ty)
1266 self.mouse.click(button=3)
1267
1268 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1269
1270 def test_left_click_on_preview_ratings_widget_cancel_preview(self):
1271 """Left click on the ratings widget must cancel the preview."""
1272 ratings_widget = self.get_current_preview().ratings_widget[0]
1273 self.assertThat(ratings_widget, NotEquals(None))
1274
1275 tx = ratings_widget.x + (ratings_widget.width / 2)
1276 ty = ratings_widget.y + (ratings_widget.height / 2)
1277 self.mouse.move(tx, ty)
1278 self.mouse.click(button=1)
1279
1280 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1281
1282 def test_middle_click_on_preview_ratings_widget_cancel_preview(self):
1283 """Middle click on the ratings widget must cancel the preview."""
1284 ratings_widget = self.get_current_preview().ratings_widget[0]
1285 self.assertThat(ratings_widget, NotEquals(None))
1286
1287 tx = ratings_widget.x + (ratings_widget.width / 2)
1288 ty = ratings_widget.y + (ratings_widget.height / 2)
1289 self.mouse.move(tx, ty)
1290 self.mouse.click(button=2)
1291
1292 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1293
1294 def test_right_click_on_preview_ratings_widget_cancel_preview(self):
1295 """Right click on the ratings widget must cancel the preview."""
1296 ratings_widget = self.get_current_preview().ratings_widget[0]
1297 self.assertThat(ratings_widget, NotEquals(None))
1298
1299 tx = ratings_widget.x + (ratings_widget.width / 2)
1300 ty = ratings_widget.y + (ratings_widget.height / 2)
1301 self.mouse.move(tx, ty)
1302 self.mouse.click(button=3)
1303
1304 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1305
1306 def test_left_click_on_preview_info_hint_cancel_preview(self):
1307 """Left click on the info hint must cancel the preview."""
1308 info_hint = self.get_current_preview().info_hint_widget[0]
1309 self.assertThat(info_hint, NotEquals(None))
1310
1311 tx = info_hint.x + (info_hint.width / 2)
1312 ty = info_hint.y + (info_hint.height / 8)
1313 self.mouse.move(tx, ty)
1314 self.mouse.click(button=1)
1315
1316 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1317
1318 def test_middle_click_on_preview_info_hint_cancel_preview(self):
1319 """Middle click on the info hint must cancel the preview."""
1320 info_hint = self.get_current_preview().info_hint_widget[0]
1321 self.assertThat(info_hint, NotEquals(None))
1322
1323 tx = info_hint.x + (info_hint.width / 2)
1324 ty = info_hint.y + (info_hint.height / 8)
1325 self.mouse.move(tx, ty)
1326 self.mouse.click(button=2)
1327
1328 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
1329
1330 def test_right_click_on_preview_info_hint_cancel_preview(self):
1331 """Right click on the info hint must cancel the preview."""
1332 info_hint = self.get_current_preview().info_hint_widget[0]
1333 self.assertThat(info_hint, NotEquals(None))
1334
1335 tx = info_hint.x + (info_hint.width / 2)
1336 ty = info_hint.y + (info_hint.height / 8)
1337 self.mouse.move(tx, ty)
1338 self.mouse.click(button=3)
13391197
1340 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))1198 self.assertThat(self.unity.dash.preview_displaying, Eventually(Equals(False)))
13411199
@@ -1401,3 +1259,4 @@
1401 self.addCleanup(self.unity.dash.ensure_hidden)1259 self.addCleanup(self.unity.dash.ensure_hidden)
14021260
1403 self.assertThat(self.unity.dash.visible, Eventually(Equals(True)))1261 self.assertThat(self.unity.dash.visible, Eventually(Equals(True)))
1262
14041263
=== modified file 'tests/autopilot/unity/tests/test_panel.py'
--- tests/autopilot/unity/tests/test_panel.py 2015-02-19 14:41:09 +0000
+++ tests/autopilot/unity/tests/test_panel.py 2015-08-24 17:01:53 +0000
@@ -78,8 +78,7 @@
78 self.keybinding("window/restore")78 self.keybinding("window/restore")
79 self.addCleanup(self.keybinding, "window/maximize")79 self.addCleanup(self.keybinding, "window/maximize")
8080
81 sleep(.25)81 self.assertThat(lambda: win.is_maximized, Eventually(Equals(maximized)))
82 self.assertProperty(win, is_maximized=maximized)
8382
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):
85 """Opens a new instance of the requested application, ensuring that only84 """Opens a new instance of the requested application, ensuring that only
@@ -93,8 +92,8 @@
93 app = app_win.application92 app = app_win.application
9493
95 app_win.set_focus()94 app_win.set_focus()
96 self.assertTrue(app.is_active)95 self.assertThat(lambda: app.is_active, Eventually(Equals(True)))
97 self.assertTrue(app_win.is_focused)96 self.assertThat(lambda: app_win.is_focused, Eventually(Equals(True)))
98 self.assertThat(app.desktop_file, Equals(app_win.application.desktop_file))97 self.assertThat(app.desktop_file, Equals(app_win.application.desktop_file))
9998
100 if move_to_monitor:99 if move_to_monitor:
@@ -431,7 +430,6 @@
431 self.addCleanup(self.unity.hud.ensure_hidden)430 self.addCleanup(self.unity.hud.ensure_hidden)
432431
433 self.panel.window_buttons.maximize.mouse_click()432 self.panel.window_buttons.maximize.mouse_click()
434
435 self.assertThat(self.unity.hud.visible, Eventually(Equals(True)))433 self.assertThat(self.unity.hud.visible, Eventually(Equals(True)))
436434
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):
@@ -986,7 +984,7 @@
986984
987 def open_app_and_get_menu_entry(self):985 def open_app_and_get_menu_entry(self):
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."""
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",
990 maximized=self.lim)988 maximized=self.lim)
991989
992 refresh_fn = lambda: len(self.panel.menus.get_entries())990 refresh_fn = lambda: len(self.panel.menus.get_entries())
@@ -1043,7 +1041,8 @@
1043 self.assertThat(menu_entry.active, Eventually(Equals(True)))1041 self.assertThat(menu_entry.active, Eventually(Equals(True)))
10441042
1045 self.open_new_application_window("Text Editor")1043 self.open_new_application_window("Text Editor")
1046 self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None)))1044 get_active_indicator_fn = lambda: self.unity.panels.get_active_indicator()
1045 self.assertThat(get_active_indicator_fn, Eventually(Equals(None)))
10471046
1048 def test_indicator_opens_when_dash_is_open(self):1047 def test_indicator_opens_when_dash_is_open(self):
1049 """When the dash is open and a click is on an indicator the dash1048 """When the dash is open and a click is on an indicator the dash
@@ -1068,8 +1067,9 @@
1068 This method will wait until the active indicator has been set.1067 This method will wait until the active indicator has been set.
10691068
1070 """1069 """
1071 self.assertThat(self.panel.get_active_indicator, Eventually(NotEquals(None)))1070 get_active_indicator_fn = lambda: self.panel.get_active_indicator()
1072 return self.panel.get_active_indicator()1071 self.assertThat(get_active_indicator_fn, Eventually(NotEquals(None)))
1072 return get_active_indicator_fn()
10731073
1074 def test_panel_first_menu_show_works(self):1074 def test_panel_first_menu_show_works(self):
1075 """Pressing the open-menus keybinding must open the first indicator."""1075 """Pressing the open-menus keybinding must open the first indicator."""
@@ -1185,9 +1185,7 @@
1185 self.assertProperty(text_win, is_focused=False)1185 self.assertProperty(text_win, is_focused=False)
1186 self.assertProperty(calc_win, is_focused=True)1186 self.assertProperty(calc_win, is_focused=True)
11871187
1188 self.move_mouse_over_grab_area()1188 self.mouse.click_object(self.panel.grab_area, button=1)
1189 self.mouse.click()
1190
1191 self.assertProperty(text_win, is_focused=True)1189 self.assertProperty(text_win, is_focused=True)
11921190
1193 def test_lower_the_maximized_window_works(self):1191 def test_lower_the_maximized_window_works(self):
@@ -1198,8 +1196,7 @@
1198 self.assertProperty(text_win, is_focused=True)1196 self.assertProperty(text_win, is_focused=True)
1199 self.assertProperty(calc_win, is_focused=False)1197 self.assertProperty(calc_win, is_focused=False)
12001198
1201 self.move_mouse_over_grab_area()1199 self.mouse.click_object(self.panel.grab_area, button=2)
1202 self.mouse.click(2)
12031200
1204 self.assertProperty(calc_win, is_focused=True)1201 self.assertProperty(calc_win, is_focused=True)
12051202
@@ -1209,8 +1206,7 @@
1209 self.addCleanup(self.unity.hud.ensure_hidden)1206 self.addCleanup(self.unity.hud.ensure_hidden)
12101207
1211 self.keyboard.type("Hello")1208 self.keyboard.type("Hello")
1212 self.move_mouse_over_grab_area()1209 self.mouse.click_object(self.panel.grab_area)
1213 self.mouse.click()
1214 self.keyboard.type("World")1210 self.keyboard.type("World")
12151211
1216 self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld")))1212 self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld")))
12171213
=== modified file 'tests/autopilot/unity/tests/test_quicklist.py'
--- tests/autopilot/unity/tests/test_quicklist.py 2015-03-25 14:59:04 +0000
+++ tests/autopilot/unity/tests/test_quicklist.py 2015-08-24 17:01:53 +0000
@@ -269,7 +269,7 @@
269 def assertCorrectItemSelected(self, item):269 def assertCorrectItemSelected(self, item):
270 """Ensure the item considers itself selected and that quicklist agrees."""270 """Ensure the item considers itself selected and that quicklist agrees."""
271 self.assertThat(item.selected, Eventually(Equals(True)))271 self.assertThat(item.selected, Eventually(Equals(True)))
272 self.assertThat(self.quicklist.selected_item.id, Equals(item.id))272 self.assertThat(self.quicklist.selected_item, Equals(item))
273273
274 def test_keynav_selects_first_item_when_unselected(self):274 def test_keynav_selects_first_item_when_unselected(self):
275 """Home key MUST select the first selectable item in a quicklist."""275 """Home key MUST select the first selectable item in a quicklist."""
@@ -402,11 +402,11 @@
402402
403 # Moving the mouse horizontally doesn't change the selection403 # Moving the mouse horizontally doesn't change the selection
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)
405 self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))405 self.assertThat(self.quicklist.selected_item, Equals(key_item))
406406
407 # Moving the mouse outside doesn't change the selection407 # Moving the mouse outside doesn't change the selection
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)
409 self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))409 self.assertThat(self.quicklist.selected_item, Equals(key_item))
410410
411 # Moving the mouse to another entry, changes the selection411 # Moving the mouse to another entry, changes the selection
412 mouse_item = self.quicklist.selectable_items[-2]412 mouse_item = self.quicklist.selectable_items[-2]
413413
=== modified file 'tests/autopilot/unity/tests/test_spread.py'
--- tests/autopilot/unity/tests/test_spread.py 2015-03-24 22:35:27 +0000
+++ tests/autopilot/unity/tests/test_spread.py 2015-08-24 17:01:53 +0000
@@ -114,11 +114,7 @@
114 target_xid = not_focused.x_id114 target_xid = not_focused.x_id
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]
116116
117 (x, y, w, h) = target_win.geometry117 self.mouse.click_object(target_win, button=1)
118 self.mouse.move(x + w / 2, y + h / 2)
119 sleep(.5)
120 self.mouse.click()
121
122 self.assertThat(lambda: not_focused.is_focused, Eventually(Equals(True)))118 self.assertThat(lambda: not_focused.is_focused, Eventually(Equals(True)))
123119
124 def test_scaled_window_closes_on_middle_click(self):120 def test_scaled_window_closes_on_middle_click(self):
@@ -129,10 +125,8 @@
129 target_xid = win.x_id125 target_xid = win.x_id
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]
131127
132 (x, y, w, h) = target_win.geometry128 sleep(1)
133 self.mouse.move(x + w / 2, y + h / 2)129 self.mouse.click_object(target_win, button=2)
134 sleep(.5)
135 self.mouse.click(button=2)
136130
137 self.assertWindowIsScaledEquals(target_xid, False)131 self.assertWindowIsScaledEquals(target_xid, False)
138 self.assertWindowIsClosed(target_xid)132 self.assertWindowIsClosed(target_xid)
@@ -146,13 +140,8 @@
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]
147141
148 # Make sure mouse is over the test window142 # Make sure mouse is over the test window
149 (x1, y1, w1, h1) = target_win.geometry143 self.mouse.move_to_object(target_win)
150 self.mouse.move(x1 + w1 / 2, y1 + h1 / 2)144 self.mouse.click_object(target_win.scale_close_geometry)
151
152 (x, y, w, h) = target_win.scale_close_geometry
153 self.mouse.move(x + w / 2, y + h / 2)
154 sleep(.5)
155 self.mouse.click()
156145
157 self.assertWindowIsScaledEquals(target_xid, False)146 self.assertWindowIsScaledEquals(target_xid, False)
158 self.assertWindowIsClosed(target_xid)147 self.assertWindowIsClosed(target_xid)
159148
=== modified file 'tests/autopilot/unity/tests/test_switcher.py'
--- tests/autopilot/unity/tests/test_switcher.py 2014-01-29 20:33:47 +0000
+++ tests/autopilot/unity/tests/test_switcher.py 2015-08-24 17:01:53 +0000
@@ -629,6 +629,7 @@
629 def setUp(self):629 def setUp(self):
630 super(SwitcherDetailsMouseTests, self).setUp()630 super(SwitcherDetailsMouseTests, self).setUp()
631 self.set_timeout_setting(False)631 self.set_timeout_setting(False)
632 self.mouse.move(0, 0, animate=False)
632633
633 def test_mouse_highlights_switcher_icons(self):634 def test_mouse_highlights_switcher_icons(self):
634 """ Tests that the mouse can hightlight all the switcher icons. """635 """ Tests that the mouse can hightlight all the switcher icons. """
@@ -653,7 +654,7 @@
653 index = 0;654 index = 0;
654 for cords in icon_cords:655 for cords in icon_cords:
655 self.mouse.move(cords[0], cords[1])656 self.mouse.move(cords[0], cords[1])
656 self.assertThat(index, Equals(self.unity.switcher.selection_index))657 self.assertThat(self.unity.switcher.selection_index, Eventually(Equals(index)))
657 index += 1658 index += 1
658659
659 def test_mouse_clicks_activate_icon(self):660 def test_mouse_clicks_activate_icon(self):
@@ -691,7 +692,7 @@
691692
692 mouse_index = self.unity.switcher.selection_index - 1693 mouse_index = self.unity.switcher.selection_index - 1
693694
694 self.unity.switcher.view.move_over_icon(mouse_index);695 self.unity.switcher.view.move_over_icon(mouse_index)
695 # Assert we are over the icon we want to hover over.696 # Assert we are over the icon we want to hover over.
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)))
697698
@@ -724,11 +725,9 @@
724 self.unity.switcher.initiate(SwitcherMode.DETAIL)725 self.unity.switcher.initiate(SwitcherMode.DETAIL)
725 self.addCleanup(self.unity.switcher.terminate)726 self.addCleanup(self.unity.switcher.terminate)
726727
727 index = 0;728 for index in range(len(self.unity.switcher.view.detail_icons)):
728 for icon in self.unity.switcher.view.detail_icons:
729 self.unity.switcher.view.move_over_detail_icon(index)729 self.unity.switcher.view.move_over_detail_icon(index)
730 self.assertThat(index, Equals(self.unity.switcher.detail_selection_index))730 self.assertThat(self.unity.switcher.detail_selection_index, Eventually(Equals(index)))
731 index += 1
732731
733 def test_mouse_click_will_activate_detail_icon(self):732 def test_mouse_click_will_activate_detail_icon(self):
734 """733 """
735734
=== modified file 'tests/bamf-mock-application.c'
--- tests/bamf-mock-application.c 2012-11-06 18:19:09 +0000
+++ tests/bamf-mock-application.c 2015-08-24 17:01:53 +0000
@@ -99,10 +99,24 @@
99void99void
100bamf_mock_application_set_children (BamfMockApplication * self, GList * children)100bamf_mock_application_set_children (BamfMockApplication * self, GList * children)
101{101{
102 GList *l;
103
102 g_return_if_fail (BAMF_IS_MOCK_APPLICATION (self));104 g_return_if_fail (BAMF_IS_MOCK_APPLICATION (self));
103105
104 g_list_free (self->priv->children);106 for (l = self->priv->children; l;)
105 self->priv->children = g_list_copy (children);107 {
108 GList *next = l->next;
109 BamfView *view = l->data;
110 self->priv->children = g_list_delete_link (self->priv->children, l);
111 g_signal_emit_by_name (G_OBJECT (self), "child-removed", view);
112 l = next;
113 }
114
115 for (l = g_list_last (children); l; l = l->prev)
116 {
117 self->priv->children = g_list_prepend (self->priv->children, l->data);
118 g_signal_emit_by_name (G_OBJECT (self), "child-added", l->data);
119 }
106}120}
107121
108static void122static void
109123
=== modified file 'tests/mock-application.h'
--- tests/mock-application.h 2015-05-22 16:03:30 +0000
+++ tests/mock-application.h 2015-08-24 17:01:53 +0000
@@ -46,6 +46,7 @@
46 , active_(false)46 , active_(false)
47 , urgent_(false)47 , urgent_(false)
48 {48 {
49 monitor.SetGetterFunction([this] { return monitor_; });
49 visible.SetGetterFunction([this] { return visible_; });50 visible.SetGetterFunction([this] { return visible_; });
50 active.SetGetterFunction([this] { return active_; });51 active.SetGetterFunction([this] { return active_; });
51 urgent.SetGetterFunction([this] { return urgent_; });52 urgent.SetGetterFunction([this] { return urgent_; });
@@ -54,7 +55,6 @@
5455
55 ON_CALL(*this, type()).WillByDefault(Invoke([this] { return type_; }));56 ON_CALL(*this, type()).WillByDefault(Invoke([this] { return type_; }));
56 ON_CALL(*this, window_id()).WillByDefault(Invoke([this] { return xid_; }));57 ON_CALL(*this, window_id()).WillByDefault(Invoke([this] { return xid_; }));
57 ON_CALL(*this, monitor()).WillByDefault(Invoke([this] { return monitor_; }));
58 ON_CALL(*this, Focus()).WillByDefault(Invoke([this] { return LocalFocus(); }));58 ON_CALL(*this, Focus()).WillByDefault(Invoke([this] { return LocalFocus(); }));
59 ON_CALL(*this, application()).WillByDefault(Return(unity::ApplicationPtr()));59 ON_CALL(*this, application()).WillByDefault(Return(unity::ApplicationPtr()));
60 }60 }
@@ -71,7 +71,6 @@
7171
72 MOCK_CONST_METHOD0(type, unity::WindowType());72 MOCK_CONST_METHOD0(type, unity::WindowType());
73 MOCK_CONST_METHOD0(window_id, Window());73 MOCK_CONST_METHOD0(window_id, Window());
74 MOCK_CONST_METHOD0(monitor, int());
75 MOCK_CONST_METHOD0(application, unity::ApplicationPtr());74 MOCK_CONST_METHOD0(application, unity::ApplicationPtr());
76 MOCK_CONST_METHOD0(Focus, bool());75 MOCK_CONST_METHOD0(Focus, bool());
77 MOCK_CONST_METHOD0(Quit, void());76 MOCK_CONST_METHOD0(Quit, void());
@@ -144,7 +143,7 @@
144 ON_CALL(*this, type()).WillByDefault(Invoke([this] { return type_; }));143 ON_CALL(*this, type()).WillByDefault(Invoke([this] { return type_; }));
145 ON_CALL(*this, desktop_id()).WillByDefault(Invoke([this] { return desktop_file_; }));144 ON_CALL(*this, desktop_id()).WillByDefault(Invoke([this] { return desktop_file_; }));
146 ON_CALL(*this, repr()).WillByDefault(Return("MockApplication"));145 ON_CALL(*this, repr()).WillByDefault(Return("MockApplication"));
147 ON_CALL(*this, GetWindows()).WillByDefault(Invoke([this] { return windows_; }));146 ON_CALL(*this, GetWindows()).WillByDefault(Invoke([this] () -> unity::WindowList const& { return windows_; }));
148 ON_CALL(*this, GetSupportedMimeTypes()).WillByDefault(Return(std::vector<std::string>()));147 ON_CALL(*this, GetSupportedMimeTypes()).WillByDefault(Return(std::vector<std::string>()));
149 ON_CALL(*this, GetFocusableWindow()).WillByDefault(Return(unity::ApplicationWindowPtr()));148 ON_CALL(*this, GetFocusableWindow()).WillByDefault(Return(unity::ApplicationWindowPtr()));
150 ON_CALL(*this, OwnsWindow(_)).WillByDefault(Invoke(this, &MockApplication::LocalOwnsWindow));149 ON_CALL(*this, OwnsWindow(_)).WillByDefault(Invoke(this, &MockApplication::LocalOwnsWindow));
@@ -167,7 +166,7 @@
167 MOCK_CONST_METHOD0(type, unity::AppType());166 MOCK_CONST_METHOD0(type, unity::AppType());
168 MOCK_CONST_METHOD0(repr, std::string());167 MOCK_CONST_METHOD0(repr, std::string());
169 MOCK_CONST_METHOD0(desktop_id, std::string());168 MOCK_CONST_METHOD0(desktop_id, std::string());
170 MOCK_CONST_METHOD0(GetWindows, unity::WindowList());169 MOCK_CONST_METHOD0(GetWindows, unity::WindowList const&());
171 MOCK_CONST_METHOD1(OwnsWindow, bool(Window));170 MOCK_CONST_METHOD1(OwnsWindow, bool(Window));
172 MOCK_CONST_METHOD0(GetSupportedMimeTypes, std::vector<std::string>());171 MOCK_CONST_METHOD0(GetSupportedMimeTypes, std::vector<std::string>());
173 MOCK_CONST_METHOD0(GetFocusableWindow, unity::ApplicationWindowPtr());172 MOCK_CONST_METHOD0(GetFocusableWindow, unity::ApplicationWindowPtr());
174173
=== modified file 'tests/test_bamf_application.cpp'
--- tests/test_bamf_application.cpp 2013-10-14 17:36:51 +0000
+++ tests/test_bamf_application.cpp 2015-08-24 17:01:53 +0000
@@ -56,6 +56,8 @@
5656
57TEST_F(TestBamfApplication, GetWindows)57TEST_F(TestBamfApplication, GetWindows)
58{58{
59 ASSERT_EQ(application_.GetWindows().size(), 0);
60
59 GList* children = nullptr;61 GList* children = nullptr;
60 for (int i = 0; i<5; ++i)62 for (int i = 0; i<5; ++i)
61 {63 {
@@ -71,8 +73,7 @@
71 AddFakeWindowToWM(3, true);73 AddFakeWindowToWM(3, true);
72 AddFakeWindowToWM(4, false);74 AddFakeWindowToWM(4, false);
7375
74 auto windows = application_.GetWindows();76 EXPECT_EQ(application_.GetWindows().size(), 5);
75 ASSERT_EQ(windows.size(), 5);
7677
77 g_list_free_full(children, g_object_unref);78 g_list_free_full(children, g_object_unref);
78}79}
7980
=== modified file 'unity-shared/ApplicationManager.h'
--- unity-shared/ApplicationManager.h 2015-02-09 16:47:24 +0000
+++ unity-shared/ApplicationManager.h 2015-08-24 17:01:53 +0000
@@ -80,7 +80,6 @@
8080
81 virtual WindowType type() const = 0;81 virtual WindowType type() const = 0;
82 virtual Window window_id() const = 0;82 virtual Window window_id() const = 0;
83 virtual int monitor() const = 0;
8483
85 // It is possible for this to be null, especially in situations where84 // It is possible for this to be null, especially in situations where
86 // the application is starting up or shutting down.85 // the application is starting up or shutting down.
@@ -101,6 +100,8 @@
101 return !(operator==(other));100 return !(operator==(other));
102 }101 }
103102
103 nux::ROProperty<int> monitor;
104
104 nux::ROProperty<std::string> title;105 nux::ROProperty<std::string> title;
105 nux::ROProperty<std::string> icon;106 nux::ROProperty<std::string> icon;
106107
@@ -121,7 +122,7 @@
121 // A string representation of the object.122 // A string representation of the object.
122 virtual std::string repr() const = 0;123 virtual std::string repr() const = 0;
123124
124 virtual WindowList GetWindows() const = 0;125 virtual WindowList const& GetWindows() const = 0;
125 virtual bool OwnsWindow(Window window_id) const = 0;126 virtual bool OwnsWindow(Window window_id) const = 0;
126127
127 virtual std::vector<std::string> GetSupportedMimeTypes() const = 0;128 virtual std::vector<std::string> GetSupportedMimeTypes() const = 0;
128129
=== modified file 'unity-shared/BamfApplicationManager.cpp'
--- unity-shared/BamfApplicationManager.cpp 2015-04-21 19:57:00 +0000
+++ unity-shared/BamfApplicationManager.cpp 2015-08-24 17:01:53 +0000
@@ -145,6 +145,10 @@
145 [this] (BamfView*, gboolean urgent) {145 [this] (BamfView*, gboolean urgent) {
146 this->urgent.changed.emit(urgent);146 this->urgent.changed.emit(urgent);
147 });147 });
148 signals_.Add<void, BamfView*>(bamf_view_, "closed",
149 [this] (BamfView* view) {
150 pool::wins_.erase(view);
151 });
148}152}
149153
150bool WindowBase::Focus() const154bool WindowBase::Focus() const
@@ -170,7 +174,13 @@
170 : WindowBase(manager, window)174 : WindowBase(manager, window)
171 , bamf_window_(glib::object_cast<BamfWindow>(window))175 , bamf_window_(glib::object_cast<BamfWindow>(window))
172{176{
177 monitor.SetGetterFunction(std::bind(&AppWindow::GetMonitor, this));
173 maximized.SetGetterFunction(std::bind(&AppWindow::GetMaximized, this));178 maximized.SetGetterFunction(std::bind(&AppWindow::GetMaximized, this));
179
180 signals_.Add<void, BamfWindow*, gint, gint>(bamf_window_, "monitor-changed",
181 [this] (BamfWindow*, gint, gint monitor) {
182 this->monitor.changed.emit(monitor);
183 });
174 signals_.Add<void, BamfWindow*, gint, gint>(bamf_window_, "maximized-changed",184 signals_.Add<void, BamfWindow*, gint, gint>(bamf_window_, "maximized-changed",
175 [this] (BamfWindow*, gint old_state, gint state) {185 [this] (BamfWindow*, gint old_state, gint state) {
176 if ((old_state == BAMF_WINDOW_MAXIMIZED) != (state == BAMF_WINDOW_MAXIMIZED))186 if ((old_state == BAMF_WINDOW_MAXIMIZED) != (state == BAMF_WINDOW_MAXIMIZED))
@@ -178,6 +188,11 @@
178 });188 });
179}189}
180190
191int AppWindow::GetMonitor() const
192{
193 return bamf_window_get_monitor(bamf_window_);
194}
195
181bool AppWindow::GetMaximized() const196bool AppWindow::GetMaximized() const
182{197{
183 return bamf_window_maximized(bamf_window_) == BAMF_WINDOW_MAXIMIZED;198 return bamf_window_maximized(bamf_window_) == BAMF_WINDOW_MAXIMIZED;
@@ -188,11 +203,6 @@
188 return bamf_window_get_xid(bamf_window_);203 return bamf_window_get_xid(bamf_window_);
189}204}
190205
191int AppWindow::monitor() const
192{
193 return bamf_window_get_monitor(bamf_window_);
194}
195
196WindowType AppWindow::type() const206WindowType AppWindow::type() const
197{207{
198 switch (bamf_window_get_window_type(bamf_window_))208 switch (bamf_window_get_window_type(bamf_window_))
@@ -231,14 +241,15 @@
231 WindowManager::Default().Close(window_id());241 WindowManager::Default().Close(window_id());
232}242}
233243
234Tab::Tab(ApplicationManager const& manager, glib::Object<BamfView> const& tab)
235 : WindowBase(manager, tab)
236 , bamf_tab_(glib::object_cast<BamfTab>(tab))
237{}
238
239Tab::Tab(ApplicationManager const& manager, glib::Object<BamfTab> const& tab)244Tab::Tab(ApplicationManager const& manager, glib::Object<BamfTab> const& tab)
240 : WindowBase(manager, glib::object_cast<BamfView>(tab))245 : WindowBase(manager, glib::object_cast<BamfView>(tab))
241 , bamf_tab_(tab)246 , bamf_tab_(tab)
247{
248 monitor.SetGetterFunction([] { return -1; });
249}
250
251Tab::Tab(ApplicationManager const& manager, glib::Object<BamfView> const& tab)
252 : Tab(manager_, glib::object_cast<BamfTab>(tab))
242{}253{}
243254
244Window Tab::window_id() const255Window Tab::window_id() const
@@ -251,12 +262,6 @@
251 return WindowType::TAB;262 return WindowType::TAB;
252}263}
253264
254int Tab::monitor() const
255{
256 // TODO, we could find the real window for the window_id, and get the monitor for that.
257 return -1;
258}
259
260ApplicationPtr Tab::application() const265ApplicationPtr Tab::application() const
261{266{
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.
@@ -323,6 +328,7 @@
323 signals_.Add<void, BamfView*, gboolean>(bamf_view_, "running-changed",328 signals_.Add<void, BamfView*, gboolean>(bamf_view_, "running-changed",
324 [this] (BamfView*, gboolean running) {329 [this] (BamfView*, gboolean running) {
325 LOG_TRACE(logger) << "running " << visible;330 LOG_TRACE(logger) << "running " << visible;
331 UpdateWindows();
326 this->running.changed.emit(running);332 this->running.changed.emit(running);
327 });333 });
328 signals_.Add<void, BamfView*, gboolean>(bamf_view_, "urgent-changed",334 signals_.Add<void, BamfView*, gboolean>(bamf_view_, "urgent-changed",
@@ -330,21 +336,34 @@
330 this->urgent.changed.emit(urgent);336 this->urgent.changed.emit(urgent);
331 });337 });
332 signals_.Add<void, BamfView*>(bamf_view_, "closed",338 signals_.Add<void, BamfView*>(bamf_view_, "closed",
333 [this] (BamfView*) {339 [this] (BamfView* view) {
340 UpdateWindows();
334 this->closed.emit();341 this->closed.emit();
342
343 if (!sticky())
344 pool::apps_.erase(view);
335 });345 });
336346
337 signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-added",347 signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-added",
338 [this] (BamfView*, BamfView* child) {348 [this] (BamfView*, BamfView* child) {
339 // Ownership is not passed on signals349 // Ownership is not passed on signals
340 if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child))350 if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child))
341 this->window_opened.emit(win);351 {
352 if (std::find(windows_.begin(), windows_.end(), win) == windows_.end())
353 {
354 windows_.push_back(win);
355 this->window_opened.emit(win);
356 }
357 }
342 });358 });
343359
344 signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-removed",360 signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-removed",
345 [this] (BamfView*, BamfView* child) {361 [this] (BamfView*, BamfView* child) {
346 if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child))362 if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child))
363 {
364 windows_.erase(std::remove(windows_.begin(), windows_.end(), win), windows_.end());
347 this->window_closed.emit(win);365 this->window_closed.emit(win);
366 }
348 });367 });
349368
350 signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-moved",369 signals_.Add<void, BamfView*, BamfView*>(bamf_view_, "child-moved",
@@ -353,6 +372,8 @@
353 if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child))372 if (ApplicationWindowPtr const& win = pool::EnsureWindow(manager_, child))
354 this->window_moved.emit(win);373 this->window_moved.emit(win);
355 });374 });
375
376 UpdateWindows();
356}377}
357378
358std::string Application::GetDesktopFile() const379std::string Application::GetDesktopFile() const
@@ -384,20 +405,38 @@
384 return sout.str();405 return sout.str();
385}406}
386407
387WindowList Application::GetWindows() const408WindowList const& Application::GetWindows() const
388{409{
389 WindowList result;410 return windows_;
390411}
391 if (!bamf_app_)412
392 return result;413void Application::UpdateWindows()
414{
415 if (!bamf_app_ || !running() || bamf_view_is_closed(bamf_view_))
416 {
417 for (auto it = windows_.begin(); it != windows_.end();)
418 {
419 window_closed.emit(*it);
420 it = windows_.erase(it);
421 }
422
423 return;
424 }
425
426 bool was_empty = windows_.empty();
393427
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);
395 for (GList* l = children.get(); l; l = l->next)429 for (GList* l = children.get(); l; l = l->next)
396 {430 {
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)))
398 result.push_back(window);432 {
433 if (was_empty || std::find(windows_.begin(), windows_.end(), window) == windows_.end())
434 {
435 windows_.push_back(window);
436 window_opened.emit(window);
437 }
438 }
399 }439 }
400 return result;
401}440}
402441
403bool Application::OwnsWindow(Window window_id) const442bool Application::OwnsWindow(Window window_id) const
@@ -405,15 +444,13 @@
405 if (!window_id)444 if (!window_id)
406 return false;445 return false;
407446
408 bool owns = false;447 for (auto const& win : windows_)
409 std::shared_ptr<GList> children(bamf_view_get_children(bamf_view_), g_list_free);
410 for (GList* l = children.get(); l && !owns; l = l->next)
411 {448 {
412 owns = BAMF_IS_WINDOW(l->data) &&449 if (win->window_id() == window_id)
413 bamf_window_get_xid(static_cast<BamfWindow*>(l->data)) == window_id;450 return true;
414 }451 }
415452
416 return owns;453 return false;
417}454}
418455
419std::vector<std::string> Application::GetSupportedMimeTypes() const456std::vector<std::string> Application::GetSupportedMimeTypes() const
@@ -515,7 +552,7 @@
515 g_quark_from_string(UNSEEN_QUARK));552 g_quark_from_string(UNSEEN_QUARK));
516}553}
517554
518bool Application::SetSeen(bool const& param)555bool Application::SetSeen(bool param)
519{556{
520 bool is_seen = GetSeen();557 bool is_seen = GetSeen();
521 if (param == is_seen)558 if (param == is_seen)
@@ -533,12 +570,15 @@
533 return bamf_view_is_sticky(bamf_view_);570 return bamf_view_is_sticky(bamf_view_);
534}571}
535572
536bool Application::SetSticky(bool const& param)573bool Application::SetSticky(bool param)
537{574{
538 bool is_sticky = GetSticky();575 bool is_sticky = GetSticky();
539 if (param == is_sticky)576 if (param == is_sticky)
540 return false; // unchanged577 return false; // unchanged
541578
579 if (!param && bamf_view_is_closed(bamf_view_))
580 pool::apps_.erase(bamf_view_);
581
542 bamf_view_set_sticky(bamf_view_, param);582 bamf_view_set_sticky(bamf_view_, param);
543 return true; // value updated583 return true; // value updated
544}584}
@@ -640,6 +680,12 @@
640 if (xid == 0)680 if (xid == 0)
641 return nullptr;681 return nullptr;
642682
683 for (auto const& win_pair : pool::wins_)
684 {
685 if (win_pair.second->window_id() == xid)
686 return win_pair.second;
687 }
688
643 // TODO: use bamf_matcher_get_window_for_xid689 // TODO: use bamf_matcher_get_window_for_xid
644 auto* app = bamf_matcher_get_application_for_xid(matcher_, xid);690 auto* app = bamf_matcher_get_application_for_xid(matcher_, xid);
645691
@@ -724,16 +770,14 @@
724 {770 {
725 if (ApplicationPtr const& app = pool::EnsureApplication(*this, view))771 if (ApplicationPtr const& app = pool::EnsureApplication(*this, view))
726 application_stopped.emit(app);772 application_stopped.emit(app);
727
728 pool::apps_.erase(view);
729 }773 }
730 else if (BAMF_IS_WINDOW(view))774 else if (BAMF_IS_WINDOW(view))
731 {775 {
732 if (ApplicationWindowPtr const& win = pool::EnsureWindow(*this, view))776 if (ApplicationWindowPtr const& win = pool::EnsureWindow(*this, view))
733 window_closed.emit(win);777 window_closed.emit(win);
734
735 pool::wins_.erase(view);
736 }778 }
779
780 /* No removal here, it's done inside views, as 'closed' signal arrives later */
737}781}
738782
739} // namespace bamf783} // namespace bamf
740784
=== modified file 'unity-shared/BamfApplicationManager.h'
--- unity-shared/BamfApplicationManager.h 2015-02-05 14:35:07 +0000
+++ unity-shared/BamfApplicationManager.h 2015-08-24 17:01:53 +0000
@@ -49,6 +49,7 @@
49protected:49protected:
50 ApplicationManager const& manager_;50 ApplicationManager const& manager_;
51 glib::Object<BamfView> bamf_view_;51 glib::Object<BamfView> bamf_view_;
52 glib::SignalManager signals_;
52};53};
5354
5455
@@ -66,9 +67,6 @@
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_;
67 }68 }
68 bool operator!=(unity::ApplicationWindow const& other) const override { return !(operator==(other)); }69 bool operator!=(unity::ApplicationWindow const& other) const override { return !(operator==(other)); }
69
70protected:
71 glib::SignalManager signals_;
72};70};
7371
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.
@@ -82,12 +80,13 @@
8280
83 WindowType type() const override;81 WindowType type() const override;
84 Window window_id() const override;82 Window window_id() const override;
85 int monitor() const override;
86 ApplicationPtr application() const override;83 ApplicationPtr application() const override;
87 void Quit() const override;84 void Quit() const override;
85
86private:
87 int GetMonitor() const;
88 bool GetMaximized() const;88 bool GetMaximized() const;
8989
90private:
91 glib::Object<BamfWindow> bamf_window_;90 glib::Object<BamfWindow> bamf_window_;
92};91};
9392
@@ -101,7 +100,6 @@
101100
102 WindowType type() const override;101 WindowType type() const override;
103 Window window_id() const override;102 Window window_id() const override;
104 int monitor() const override;
105 ApplicationPtr application() const override;103 ApplicationPtr application() const override;
106 bool Focus() const override;104 bool Focus() const override;
107 void Quit() const override;105 void Quit() const override;
@@ -121,7 +119,7 @@
121119
122 virtual AppType type() const;120 virtual AppType type() const;
123121
124 virtual WindowList GetWindows() const;122 virtual WindowList const& GetWindows() const;
125 virtual bool OwnsWindow(Window window_id) const;123 virtual bool OwnsWindow(Window window_id) const;
126124
127 virtual std::vector<std::string> GetSupportedMimeTypes() const;125 virtual std::vector<std::string> GetSupportedMimeTypes() const;
@@ -145,13 +143,16 @@
145 std::string GetDesktopFile() const;143 std::string GetDesktopFile() const;
146144
147 bool GetSeen() const;145 bool GetSeen() const;
148 bool SetSeen(bool const& param);146 bool SetSeen(bool param);
149147
150 bool GetSticky() const;148 bool GetSticky() const;
151 bool SetSticky(bool const& param);149 bool SetSticky(bool param);
150
151 void UpdateWindows();
152152
153private:153private:
154 glib::Object<::BamfApplication> bamf_app_;154 glib::Object<::BamfApplication> bamf_app_;
155 WindowList windows_;
155 glib::SignalManager signals_;156 glib::SignalManager signals_;
156 std::string type_;157 std::string type_;
157};158};
158159
=== modified file 'unity-shared/IconTexture.cpp'
--- unity-shared/IconTexture.cpp 2014-07-28 16:28:38 +0000
+++ unity-shared/IconTexture.cpp 2015-08-24 17:01:53 +0000
@@ -281,8 +281,10 @@
281281
282void IconTexture::SetOpacity(float opacity)282void IconTexture::SetOpacity(float opacity)
283{283{
284 if (_opacity == opacity)
285 return;
286
284 _opacity = opacity;287 _opacity = opacity;
285
286 QueueDraw();288 QueueDraw();
287}289}
288290
289291
=== modified file 'unity-shared/PluginAdapter.cpp'
--- unity-shared/PluginAdapter.cpp 2015-04-09 14:42:07 +0000
+++ unity-shared/PluginAdapter.cpp 2015-08-24 17:01:53 +0000
@@ -781,7 +781,10 @@
781{781{
782 CompWindow* window = m_Screen->findWindow(window_id);782 CompWindow* window = m_Screen->findWindow(window_id);
783 if (window && (window->actions() & CompWindowActionMinimizeMask))783 if (window && (window->actions() & CompWindowActionMinimizeMask))
784 {
784 window->unminimize();785 window->unminimize();
786 window->show();
787 }
785}788}
786789
787void PluginAdapter::Shade(Window window_id)790void PluginAdapter::Shade(Window window_id)
@@ -962,6 +965,7 @@
962 if (forced_unminimize)965 if (forced_unminimize)
963 {966 {
964 top_window->unminimize();967 top_window->unminimize();
968 top_window->show();
965 }969 }
966970
967 top_window->raise();971 top_window->raise();
968972
=== modified file 'unity-shared/StandaloneAppManager.cpp'
--- unity-shared/StandaloneAppManager.cpp 2015-02-09 19:39:39 +0000
+++ unity-shared/StandaloneAppManager.cpp 2015-08-24 17:01:53 +0000
@@ -81,6 +81,22 @@
81 return os;81 return os;
82}82}
8383
84void connect_window_events(ApplicationWindowPtr const& win)
85{
86 win->title.changed.connect([win] (std::string const& t) {
87 std::cout << "Window "<< win->window_id()<< " title changed to "<< t << endl;
88 });
89 win->maximized.changed.connect([win] (bool m) {
90 std::cout << "Window "<< win->window_id()<< " maximized changed to "<< m << endl;
91 });
92 win->monitor.changed.connect([win] (int m) {
93 std::cout << "Window "<< win->window_id()<< " monitor changed to "<< m << endl;
94 });
95 win->active.changed.connect([win] (bool a) {
96 std::cout << "Window "<< win->window_id()<< " active changed to "<< a << endl;
97 });
98}
99
84void dump_app(ApplicationPtr const& app, std::string const& prefix = "")100void dump_app(ApplicationPtr const& app, std::string const& prefix = "")
85{101{
86 if (app)102 if (app)
@@ -153,6 +169,7 @@
153 });169 });
154 app->window_opened.connect([idx](ApplicationWindowPtr const& window) {170 app->window_opened.connect([idx](ApplicationWindowPtr const& window) {
155 cout << "** " << names[idx] << " window opened: " << window->title() << endl;171 cout << "** " << names[idx] << " window opened: " << window->title() << endl;
172 connect_window_events(window);
156 });173 });
157 app->window_closed.connect([idx](ApplicationWindowPtr const& window) {174 app->window_closed.connect([idx](ApplicationWindowPtr const& window) {
158 cout << "** " << names[idx] << " window closed: " << window->title() << endl;175 cout << "** " << names[idx] << " window closed: " << window->title() << endl;
@@ -163,21 +180,10 @@
163 app->seen = true;180 app->seen = true;
164181
165 for (auto win : app->GetWindows())182 for (auto win : app->GetWindows())
166 {183 connect_window_events(win);
167 win->title.changed.connect([win] (std::string const& t) {
168 std::cout << "Window "<< win->window_id()<< " title changed to "<< t << endl;
169 });
170 win->maximized.changed.connect([win] (bool m) {
171 std::cout << "Window "<< win->window_id()<< " maximized changed to "<< m << endl;
172 });
173 win->active.changed.connect([win] (bool a) {
174 std::cout << "Window "<< win->window_id()<< " active changed to "<< a << endl;
175 });
176 }
177}184}
178185
179186
180
181nux::logging::Level glog_level_to_nux(GLogLevelFlags log_level)187nux::logging::Level glog_level_to_nux(GLogLevelFlags log_level)
182{188{
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.
184190
=== modified file 'unity-shared/WindowButtons.cpp'
--- unity-shared/WindowButtons.cpp 2015-06-03 12:10:00 +0000
+++ unity-shared/WindowButtons.cpp 2015-08-24 17:01:53 +0000
@@ -234,14 +234,14 @@
234 }234 }
235235
236 introspection.add(GetAbsoluteGeometry())236 introspection.add(GetAbsoluteGeometry())
237 .add("type", type_name)237 .add("type", type_name)
238 .add("visible", IsVisible() && Parent()->opacity() != 0.0f)238 .add("visible", IsVisible() && Parent()->opacity() != 0.0f)
239 .add("sensitive", Parent()->GetInputEventSensitivity())239 .add("sensitive", Parent()->GetInputEventSensitivity())
240 .add("enabled", enabled())240 .add("enabled", enabled())
241 .add("visual_state", state_name)241 .add("visual_state", state_name)
242 .add("opacity", Parent()->opacity())242 .add("opacity", Parent()->opacity())
243 .add("focused", Parent()->focused())243 .add("focused", Parent()->focused())
244 .add("overlay_mode", overlay_mode());244 .add("overlay_mode", overlay_mode());
245}245}
246} // Internal Namespace246} // Internal Namespace
247247