Merge lp:~brandontschaefer/unity/opening-dash-in-scale-mode-SRU into lp:unity/5.0

Proposed by Brandon Schaefer on 2012-06-27
Status: Merged
Approved by: Brandon Schaefer on 2012-06-27
Approved revision: 2375
Merged at revision: 2375
Proposed branch: lp:~brandontschaefer/unity/opening-dash-in-scale-mode-SRU
Merge into: lp:unity/5.0
Diff against target: 135 lines (+55/-2)
4 files modified
plugins/unityshell/src/DashController.cpp (+5/-2)
plugins/unityshell/src/unityshell.cpp (+24/-0)
plugins/unityshell/src/unityshell.h (+2/-0)
tests/autopilot/autopilot/tests/test_dash.py (+24/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/opening-dash-in-scale-mode-SRU
Reviewer Review Type Date Requested Status
Thomi Richards (community) quality 2012-06-27 Approve on 2012-06-27
Review via email: mp+112252@code.launchpad.net

Commit message

The dash will now open when invoked while in spread/scale mode.

Description of the change

=== Problem ===
When is spread/scale mode you could not activate the dash.

=== Fix ===
Well this was a bit of a hack, as the scale plugin consumes all input, expect for the hacks already in place in unity. So to open the home dash I had to assume while in scale mode that the state CompTermTapped was true to tests for a super key tapping...if that was true then assume was_tap is true so the dash will open. (Otherwise it wont)

=== Tests ===
There are ap test for opening the Home lens/ Command lens/ Other lenses (app,file,music all open the same way)

To post a comment you must log in.
review: Approve (quality)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/DashController.cpp'
2--- plugins/unityshell/src/DashController.cpp 2012-06-19 16:58:02 +0000
3+++ plugins/unityshell/src/DashController.cpp 2012-06-27 01:22:22 +0000
4@@ -55,7 +55,7 @@
5 ensure_id_ = g_timeout_add_seconds(60, [] (gpointer data) -> gboolean { static_cast<Controller*>(data)->EnsureDash(); return FALSE; }, this);
6
7 SetupWindow();
8-
9+
10 Settings::Instance().changed.connect([&]()
11 {
12 if (window_ && view_)
13@@ -92,7 +92,7 @@
14 window_->ShowWindow(false);
15 window_->SetOpacity(0.0f);
16 window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Controller::OnMouseDownOutsideWindow));
17-
18+
19 /* FIXME - first time we load our windows there is a race that causes the input window not to actually get input, this side steps that by causing an input window show and hide before we really need it. */
20 PluginAdapter::Default()->saveInputFocus ();
21 window_->EnableInputWindow(true, "Dash", true, false);
22@@ -376,6 +376,9 @@
23 std::string lens_id = view_->GetIdForShortcutActivation(std::string(key_string));
24 if (lens_id != "")
25 {
26+ if (PluginAdapter::Default()->IsScaleActive())
27+ PluginAdapter::Default()->TerminateScale();
28+
29 GVariant* args = g_variant_new("(sus)", lens_id.c_str(), dash::GOTO_DASH_URI, "");
30 OnActivateRequest(args);
31 g_variant_unref(args);
32
33=== modified file 'plugins/unityshell/src/unityshell.cpp'
34--- plugins/unityshell/src/unityshell.cpp 2012-06-25 23:18:15 +0000
35+++ plugins/unityshell/src/unityshell.cpp 2012-06-27 01:22:22 +0000
36@@ -128,6 +128,7 @@
37 , hud_keypress_time_(0)
38 , panel_texture_has_changed_(true)
39 , paint_panel_(false)
40+ , scale_just_activated_(false)
41 {
42 Timer timer;
43 gfloat version;
44@@ -1554,6 +1555,11 @@
45 ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
46 }
47
48+ if (PluginAdapter::Default()->IsScaleActive() && g_strcmp0(plugin, "scale") == 0)
49+ {
50+ scale_just_activated_ = true;
51+ }
52+
53 screen->handleCompizEvent(plugin, event, option);
54 }
55
56@@ -1601,6 +1607,18 @@
57 LOG_DEBUG(logger) << "Super released: " << (was_tap ? "tapped" : "released");
58 int when = options[7].value().i(); // XEvent time in millisec
59
60+ // hack...if the scale just wasn't activated AND the 'when' time is within time to start the
61+ // dash then assume was_tap is also true, since the ScalePlugin doesn't accept that state...
62+ if (PluginAdapter::Default()->IsScaleActive() && !scale_just_activated_ && launcher_controller_->AboutToShowDash(true, when))
63+ {
64+ PluginAdapter::Default()->TerminateScale();
65+ was_tap = true;
66+ }
67+ else if (scale_just_activated_)
68+ {
69+ scale_just_activated_ = false;
70+ }
71+
72 if (hud_controller_->IsVisible() && launcher_controller_->AboutToShowDash(was_tap, when))
73 hud_controller_->HideHud();
74
75@@ -1657,6 +1675,12 @@
76 {
77 hud_controller_->HideHud();
78 }
79+
80+ if (PluginAdapter::Default()->IsScaleActive())
81+ {
82+ PluginAdapter::Default()->TerminateScale();
83+ }
84+
85 ubus_manager_.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
86 g_variant_new("(sus)", "commands.lens", 0, ""));
87 }
88
89=== modified file 'plugins/unityshell/src/unityshell.h'
90--- plugins/unityshell/src/unityshell.h 2012-06-25 23:18:15 +0000
91+++ plugins/unityshell/src/unityshell.h 2012-06-27 01:22:22 +0000
92@@ -315,6 +315,8 @@
93 bool paint_panel_;
94 nux::ObjectPtr<nux::IOpenGLBaseTexture> panel_texture_;
95
96+ bool scale_just_activated_;
97+
98 #ifndef USE_GLES
99 ScreenEffectFramebufferObject::GLXGetProcAddressProc glXGetProcAddressP;
100 #endif
101
102=== modified file 'tests/autopilot/autopilot/tests/test_dash.py'
103--- tests/autopilot/autopilot/tests/test_dash.py 2012-06-19 16:59:06 +0000
104+++ tests/autopilot/autopilot/tests/test_dash.py 2012-06-27 01:22:22 +0000
105@@ -68,6 +68,30 @@
106 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
107 self.assertThat(self.dash.visible, Eventually(Equals(False)))
108
109+ def test_dash_opens_when_in_spread(self):
110+ """This test shows the dash opens when in spread mode."""
111+ self.keybinding("spread/start")
112+ self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
113+
114+ self.dash.ensure_visible()
115+ self.assertThat(self.dash.visible, Eventually(Equals(True)))
116+
117+ def test_command_lens_opens_when_in_spread(self):
118+ """This test shows the command lens opens when in spread mode."""
119+ self.keybinding("spread/start")
120+ self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
121+
122+ self.dash.reveal_command_lens()
123+ self.assertThat(self.dash.active_lens, Eventually(Equals('commands.lens')))
124+
125+ def test_lens_opens_when_in_spread(self):
126+ """This test shows that any lens opens when in spread mode."""
127+ self.keybinding("spread/start")
128+ self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
129+
130+ self.dash.reveal_application_lens()
131+ self.assertThat(self.dash.active_lens, Eventually(Equals('applications.lens')))
132+
133
134 class DashSearchInputTests(DashTestCase):
135 """Test features involving input to the dash search"""

Subscribers

People subscribed via source and target branches

to all changes: