Merge lp:~sil2100/unity/fix_987156_5.0 into lp:unity/5.0

Proposed by Łukasz Zemczak
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2359
Proposed branch: lp:~sil2100/unity/fix_987156_5.0
Merge into: lp:unity/5.0
Diff against target: 90 lines (+53/-2)
3 files modified
manual-tests/Switcher.txt (+39/-0)
plugins/unityshell/src/SwitcherController.cpp (+3/-2)
tests/test_switcher_controller.cpp (+11/-0)
To merge this branch: bzr merge lp:~sil2100/unity/fix_987156_5.0
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+108760@code.launchpad.net

Commit message

Back-porting fix from unity trunk.
Don't show the switcher window during constructing the view. Wait for the ShowView timeout.

Description of the change

Description copied from the 6.0 (trunk) MRQ.

Problem description:

Both alt+tab and alt+keyabovetab, during a quick-tap, should not show the switcher but just switch to the nearest application window (as defined). The alt+keyabovetab though suffers from a problem of showing a partial creation of the switcher on most quick taps of the combination.
This is a result of the idle timer preparing the whole view before the switcher timeout. The view and switcher window is created earlier and the SwitcherView renders the model detail-mode window previews right after the idle timer constructs it.

The fix:

Since the idle timer is a way of making the switcher loading faster, we cannot remove it. But we can move the ShowWindow() call of the switcher window to the switcher timeout (from ConstructView() to ShowView()). The ShowWindow() call from Nux is a fast function that does not do much computation, so calling it during the idle timer does not have much optimization value. By making the window appear only when the view should be shown, we are not loosing anything, while we are making sure that the switcher will not appear by accident before ShowView() is called.

Test coverage:

The fix is accompanied with a GMock test (for testing if ShowView() is called) and two manual-test testing the behavior of alt+keyabovetab. So the modifications should be well tested.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Looks fine to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Switcher.txt'
2--- manual-tests/Switcher.txt 2012-04-18 07:40:40 +0000
3+++ manual-tests/Switcher.txt 2012-06-05 14:29:53 +0000
4@@ -56,3 +56,42 @@
5
6 Outcome
7 The title of the newly created window should be "显示桌面" and *not* "显示桌...".
8+
9+
10+Alt+keyabovetab switching
11+------------------------------
12+This test ensures that alt+keyabovetab switching windows of the application
13+works as it should.
14+
15+Setup:
16+#. Have a few windows of one application open (e.g. 3 terminal windows).
17+
18+Action:
19+#. Focus one of the opened application windows.
20+#. Press Alt+keyabovetab (the ~ key on the US and PL keyboard).
21+#. Keep the Alt key pressed.
22+
23+Outcome
24+ The switcher should appear with the detail view for the given application
25+ (e.g. the terminal), with all terminal applications for the workspace
26+ visible. The switcher should look normally.
27+
28+
29+Fast alt+keyabovetab switching
30+------------------------------
31+This test ensures that doing a fast tap does not result in any 'flickering' of
32+the switcher window. The switcher should not appear during a quick tap, just
33+during longer alt+keyabovetab presses.
34+
35+Setup:
36+#. Have a few windows of one application open (e.g. 3 terminal windows)
37+
38+Action:
39+#. Focus one of the opened application windows.
40+#. Quickly tap Alt+keyabovetab (meaning only tap once, do not hold)
41+#. Repeat at least a few times
42+
43+Outcome
44+ On every quick tap, the focus should switch to the next same-application
45+ type window. During that switch the switcher should not appear, not even
46+ for a brief moment (if done fast enough). No 'flickering' of the switcher.
47
48=== modified file 'plugins/unityshell/src/SwitcherController.cpp'
49--- plugins/unityshell/src/SwitcherController.cpp 2012-04-21 21:32:26 +0000
50+++ plugins/unityshell/src/SwitcherController.cpp 2012-06-05 14:29:53 +0000
51@@ -190,8 +190,10 @@
52
53 ConstructView();
54
55- if (view_window_)
56+ if (view_window_) {
57+ view_window_->ShowWindow(true);
58 view_window_->SetOpacity(1.0f);
59+ }
60 }
61
62 void Controller::ConstructWindow()
63@@ -238,7 +240,6 @@
64 main_layout_->AddView(view_.GetPointer(), 1);
65 view_window_->SetGeometry(workarea_);
66 view_window_->SetOpacity(0.0f);
67- view_window_->ShowWindow(true);
68 }
69
70 void Controller::SetWorkspace(nux::Geometry geo, int monitor)
71
72=== modified file 'tests/test_switcher_controller.cpp'
73--- tests/test_switcher_controller.cpp 2012-03-27 18:53:21 +0000
74+++ tests/test_switcher_controller.cpp 2012-06-05 14:29:53 +0000
75@@ -156,4 +156,15 @@
76 EXPECT_TRUE(unity::TimeUtil::TimeDelta(&controller.detail_timespec_, &current) >= 1000);
77 }
78
79+TEST(TestSwitcherController, ShowSwitcher)
80+{
81+ MockSwitcherController controller;
82+ std::vector<unity::launcher::AbstractLauncherIcon::Ptr> results;
83+
84+ controller.Show(ShowMode::ALL, SortMode::LAUNCHER_ORDER, false, results);
85+
86+ Utils::WaitUntil(controller.view_shown_, 2);
87+ ASSERT_TRUE(controller.view_shown_);
88+}
89+
90 }

Subscribers

People subscribed via source and target branches

to all changes: