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
1=== modified file 'launcher/SwitcherController.cpp'
2--- launcher/SwitcherController.cpp 2013-08-09 17:51:06 +0000
3+++ launcher/SwitcherController.cpp 2013-08-13 20:34:09 +0000
4@@ -764,6 +764,10 @@
5 for (auto& window : first->Windows())
6 {
7 Window xid = window->window_id();
8+
9+ if (model_->only_detail_on_viewport && !wm.IsWindowOnCurrentDesktop(xid))
10+ continue;
11+
12 uint64_t num = wm.GetWindowActiveNumber(xid);
13
14 if (num > first_highest)
15
16=== modified file 'tests/autopilot/unity/tests/test_switcher.py'
17--- tests/autopilot/unity/tests/test_switcher.py 2013-07-18 17:34:01 +0000
18+++ tests/autopilot/unity/tests/test_switcher.py 2013-08-13 20:34:09 +0000
19@@ -453,6 +453,24 @@
20 self.assertThat(get_icon_names, Eventually(Contains(char_map.name)))
21 self.assertThat(get_icon_names, Eventually(Not(Contains(calc.name))))
22
23+ def test_switcher_switch_current_workspace_same_apps_diff_workspace(self):
24+ initial_workspace = self.workspace.current_workspace
25+ self.addCleanup(self.workspace.switch_to, initial_workspace)
26+
27+ char_map = self.process_manager.start_app_window("Character Map")
28+ calc1 = self.process_manager.start_app_window("Calculator")
29+
30+ self.workspace.switch_to((initial_workspace + 1) % self.workspace.num_workspaces)
31+
32+ calc2 = self.process_manager.start_app_window("Calculator")
33+
34+ self.workspace.switch_to(initial_workspace);
35+
36+ self.unity.switcher.initiate()
37+ self.unity.switcher.select()
38+
39+ self.assertProperty(char_map, is_focused=True)
40+
41 def test_switcher_all_mode_shows_all_apps(self):
42 """Test switcher 'show_all' mode shows apps from all workspaces."""
43 initial_workspace = self.workspace.current_workspace