Merge lp:~brandontschaefer/unity/detail-mode-last-active-window-fix-SRU into lp:unity/5.0

Proposed by Brandon Schaefer on 2012-08-15
Status: Merged
Approved by: Martin Mrazik on 2012-08-21
Approved revision: 2403
Merged at revision: 2399
Proposed branch: lp:~brandontschaefer/unity/detail-mode-last-active-window-fix-SRU
Merge into: lp:unity/5.0
Diff against target: 71 lines (+23/-2)
3 files modified
plugins/unityshell/src/SwitcherModel.cpp (+4/-2)
plugins/unityshell/src/SwitcherModel.h (+2/-0)
tests/autopilot/autopilot/tests/test_switcher.py (+17/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/detail-mode-last-active-window-fix-SRU
Reviewer Review Type Date Requested Status
Tim Penhey (community) 2012-08-15 Approve on 2012-08-17
Review via email: mp+119763@code.launchpad.net

Commit Message

The switcher in detail mode will now focus the last active window, instead of the current one. If the current focus window activated the switcher.

Description of the Change

=== Problem ===
When going into detail mode the switcher would focus its own window. This means Detail mode would no longer know if the window was currently active. So it would not swap the current window with the last active window.

This also cause detail mode to all of a sudden swap the first and second icon (very annoying)

=== Fix ===
Save the currently active icon type, so when we check if we need to swap icons we know which one it was.

=== Test ===
There is an AP test.

To post a comment you must log in.
Tim Penhey (thumper) :
review: Approve
Unity Merger (unity-merger) wrote :
Unity Merger (unity-merger) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/SwitcherModel.cpp'
2--- plugins/unityshell/src/SwitcherModel.cpp 2012-03-14 06:24:18 +0000
3+++ plugins/unityshell/src/SwitcherModel.cpp 2012-08-15 21:32:21 +0000
4@@ -42,6 +42,8 @@
5 for (auto icon : _inner)
6 {
7 AddChild(icon.GetPointer());
8+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE))
9+ _last_active_icon = icon;
10 }
11 }
12
13@@ -156,7 +158,7 @@
14 std::sort (results.begin (), results.end (), &CompareWindowsByActive);
15
16 // swap so we focus the last focused window first
17- if (Selection()->GetQuirk (AbstractLauncherIcon::QUIRK_ACTIVE) && results.size () > 1)
18+ if (Selection() == _last_active_icon && results.size() > 1)
19 std::swap (results[0], results[1]);
20
21 return results;
22@@ -170,7 +172,7 @@
23
24 if (detail_selection_index > DetailXids().size() - 1)
25 return 0;
26-
27+
28 return DetailXids()[detail_selection_index];
29 }
30
31
32=== modified file 'plugins/unityshell/src/SwitcherModel.h'
33--- plugins/unityshell/src/SwitcherModel.h 2012-03-14 06:24:18 +0000
34+++ plugins/unityshell/src/SwitcherModel.h 2012-08-15 21:32:21 +0000
35@@ -97,6 +97,8 @@
36 Base _inner;
37 unsigned int _index;
38 unsigned int _last_index;
39+
40+ launcher::AbstractLauncherIcon::Ptr _last_active_icon;
41 };
42
43 }
44
45=== modified file 'tests/autopilot/autopilot/tests/test_switcher.py'
46--- tests/autopilot/autopilot/tests/test_switcher.py 2012-06-25 23:18:15 +0000
47+++ tests/autopilot/autopilot/tests/test_switcher.py 2012-08-15 21:32:21 +0000
48@@ -364,6 +364,23 @@
49 self.switcher.next_icon()
50 self.assertThat(self.switcher.get_selection_index(), Equals(0))
51
52+ def test_detail_mode_selects_last_active_window(self):
53+ """Entering details mode must focus the last focused
54+ window of the same application type.
55+ """
56+
57+ app_char1 = self.start_app("Character Map")
58+ [char_win1] = app_char1.get_windows()
59+
60+ self.start_app("Character Map")
61+
62+ self.switcher.initiate()
63+ self.keyboard.press_and_release(self.initiate_keycode)
64+ sleep(0.5)
65+ self.switcher.stop()
66+
67+ self.assertTrue(char_win1.is_focused)
68+
69
70 class SwitcherWorkspaceTests(AutopilotTestCase):
71 """Test Switcher behavior with respect to multiple workspaces."""

Subscribers

People subscribed via source and target branches

to all changes: