Merge lp:~townsend/unity/fix-workspace-alt-tab into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3470
Proposed branch: lp:~townsend/unity/fix-workspace-alt-tab
Merge into: lp:unity
Diff against target: 43 lines (+22/-0)
2 files modified
launcher/SwitcherController.cpp (+4/-0)
tests/autopilot/unity/tests/test_switcher.py (+18/-0)
To merge this branch: bzr merge lp:~townsend/unity/fix-workspace-alt-tab
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Unity Team Pending
Review via email: mp+179998@code.launchpad.net

Commit message

Fix issue where the same app on different workspaces would not allow alt-tab to work properly when trying to switch to the last used app on the same workspace.

Description of the change

= Issue =
The same application opened on different workspaces will cause a problem when trying to alt-tab to the last used application on a particular workspace. See bug #1211261 on how to reproduce.

= Fix =
The SelectFirstItem() function the Switcher Controller code did not take into account that windows may not be in the same workspace. The fix adds logic to check if the ShowMode is Viewport only and if the window is not on the current desktop.

= Test =
Added an AP test to simulate the reproduction steps.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Hmm, strange that the armhf failure occurred. I thought Marco fixed that test issue. Let's try to re-approve and see if it works this time.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/SwitcherController.cpp'
--- launcher/SwitcherController.cpp 2013-08-09 17:51:06 +0000
+++ launcher/SwitcherController.cpp 2013-08-13 20:34:09 +0000
@@ -764,6 +764,10 @@
764 for (auto& window : first->Windows())764 for (auto& window : first->Windows())
765 {765 {
766 Window xid = window->window_id();766 Window xid = window->window_id();
767
768 if (model_->only_detail_on_viewport && !wm.IsWindowOnCurrentDesktop(xid))
769 continue;
770
767 uint64_t num = wm.GetWindowActiveNumber(xid);771 uint64_t num = wm.GetWindowActiveNumber(xid);
768772
769 if (num > first_highest)773 if (num > first_highest)
770774
=== modified file 'tests/autopilot/unity/tests/test_switcher.py'
--- tests/autopilot/unity/tests/test_switcher.py 2013-07-18 17:34:01 +0000
+++ tests/autopilot/unity/tests/test_switcher.py 2013-08-13 20:34:09 +0000
@@ -453,6 +453,24 @@
453 self.assertThat(get_icon_names, Eventually(Contains(char_map.name)))453 self.assertThat(get_icon_names, Eventually(Contains(char_map.name)))
454 self.assertThat(get_icon_names, Eventually(Not(Contains(calc.name))))454 self.assertThat(get_icon_names, Eventually(Not(Contains(calc.name))))
455455
456 def test_switcher_switch_current_workspace_same_apps_diff_workspace(self):
457 initial_workspace = self.workspace.current_workspace
458 self.addCleanup(self.workspace.switch_to, initial_workspace)
459
460 char_map = self.process_manager.start_app_window("Character Map")
461 calc1 = self.process_manager.start_app_window("Calculator")
462
463 self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)
464
465 calc2 = self.process_manager.start_app_window("Calculator")
466
467 self.workspace.switch_to(initial_workspace);
468
469 self.unity.switcher.initiate()
470 self.unity.switcher.select()
471
472 self.assertProperty(char_map, is_focused=True)
473
456 def test_switcher_all_mode_shows_all_apps(self):474 def test_switcher_all_mode_shows_all_apps(self):
457 """Test switcher 'show_all' mode shows apps from all workspaces."""475 """Test switcher 'show_all' mode shows apps from all workspaces."""
458 initial_workspace = self.workspace.current_workspace476 initial_workspace = self.workspace.current_workspace