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

Proposed by Brandon Schaefer
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
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 Approve
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.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) :
review: Approve (quality)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/DashController.cpp'
--- plugins/unityshell/src/DashController.cpp 2012-06-19 16:58:02 +0000
+++ plugins/unityshell/src/DashController.cpp 2012-06-27 01:22:22 +0000
@@ -55,7 +55,7 @@
55 ensure_id_ = g_timeout_add_seconds(60, [] (gpointer data) -> gboolean { static_cast<Controller*>(data)->EnsureDash(); return FALSE; }, this);55 ensure_id_ = g_timeout_add_seconds(60, [] (gpointer data) -> gboolean { static_cast<Controller*>(data)->EnsureDash(); return FALSE; }, this);
5656
57 SetupWindow();57 SetupWindow();
58 58
59 Settings::Instance().changed.connect([&]()59 Settings::Instance().changed.connect([&]()
60 {60 {
61 if (window_ && view_)61 if (window_ && view_)
@@ -92,7 +92,7 @@
92 window_->ShowWindow(false);92 window_->ShowWindow(false);
93 window_->SetOpacity(0.0f);93 window_->SetOpacity(0.0f);
94 window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Controller::OnMouseDownOutsideWindow));94 window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Controller::OnMouseDownOutsideWindow));
95 95
96 /* 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. */96 /* 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. */
97 PluginAdapter::Default()->saveInputFocus ();97 PluginAdapter::Default()->saveInputFocus ();
98 window_->EnableInputWindow(true, "Dash", true, false);98 window_->EnableInputWindow(true, "Dash", true, false);
@@ -376,6 +376,9 @@
376 std::string lens_id = view_->GetIdForShortcutActivation(std::string(key_string));376 std::string lens_id = view_->GetIdForShortcutActivation(std::string(key_string));
377 if (lens_id != "")377 if (lens_id != "")
378 {378 {
379 if (PluginAdapter::Default()->IsScaleActive())
380 PluginAdapter::Default()->TerminateScale();
381
379 GVariant* args = g_variant_new("(sus)", lens_id.c_str(), dash::GOTO_DASH_URI, "");382 GVariant* args = g_variant_new("(sus)", lens_id.c_str(), dash::GOTO_DASH_URI, "");
380 OnActivateRequest(args);383 OnActivateRequest(args);
381 g_variant_unref(args);384 g_variant_unref(args);
382385
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-06-25 23:18:15 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-06-27 01:22:22 +0000
@@ -128,6 +128,7 @@
128 , hud_keypress_time_(0)128 , hud_keypress_time_(0)
129 , panel_texture_has_changed_(true)129 , panel_texture_has_changed_(true)
130 , paint_panel_(false)130 , paint_panel_(false)
131 , scale_just_activated_(false)
131{132{
132 Timer timer;133 Timer timer;
133 gfloat version;134 gfloat version;
@@ -1554,6 +1555,11 @@
1554 ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);1555 ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
1555 }1556 }
15561557
1558 if (PluginAdapter::Default()->IsScaleActive() && g_strcmp0(plugin, "scale") == 0)
1559 {
1560 scale_just_activated_ = true;
1561 }
1562
1557 screen->handleCompizEvent(plugin, event, option);1563 screen->handleCompizEvent(plugin, event, option);
1558}1564}
15591565
@@ -1601,6 +1607,18 @@
1601 LOG_DEBUG(logger) << "Super released: " << (was_tap ? "tapped" : "released");1607 LOG_DEBUG(logger) << "Super released: " << (was_tap ? "tapped" : "released");
1602 int when = options[7].value().i(); // XEvent time in millisec1608 int when = options[7].value().i(); // XEvent time in millisec
16031609
1610 // hack...if the scale just wasn't activated AND the 'when' time is within time to start the
1611 // dash then assume was_tap is also true, since the ScalePlugin doesn't accept that state...
1612 if (PluginAdapter::Default()->IsScaleActive() && !scale_just_activated_ && launcher_controller_->AboutToShowDash(true, when))
1613 {
1614 PluginAdapter::Default()->TerminateScale();
1615 was_tap = true;
1616 }
1617 else if (scale_just_activated_)
1618 {
1619 scale_just_activated_ = false;
1620 }
1621
1604 if (hud_controller_->IsVisible() && launcher_controller_->AboutToShowDash(was_tap, when))1622 if (hud_controller_->IsVisible() && launcher_controller_->AboutToShowDash(was_tap, when))
1605 hud_controller_->HideHud();1623 hud_controller_->HideHud();
16061624
@@ -1657,6 +1675,12 @@
1657 {1675 {
1658 hud_controller_->HideHud();1676 hud_controller_->HideHud();
1659 }1677 }
1678
1679 if (PluginAdapter::Default()->IsScaleActive())
1680 {
1681 PluginAdapter::Default()->TerminateScale();
1682 }
1683
1660 ubus_manager_.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,1684 ubus_manager_.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
1661 g_variant_new("(sus)", "commands.lens", 0, ""));1685 g_variant_new("(sus)", "commands.lens", 0, ""));
1662}1686}
16631687
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2012-06-25 23:18:15 +0000
+++ plugins/unityshell/src/unityshell.h 2012-06-27 01:22:22 +0000
@@ -315,6 +315,8 @@
315 bool paint_panel_;315 bool paint_panel_;
316 nux::ObjectPtr<nux::IOpenGLBaseTexture> panel_texture_;316 nux::ObjectPtr<nux::IOpenGLBaseTexture> panel_texture_;
317317
318 bool scale_just_activated_;
319
318#ifndef USE_GLES320#ifndef USE_GLES
319 ScreenEffectFramebufferObject::GLXGetProcAddressProc glXGetProcAddressP;321 ScreenEffectFramebufferObject::GLXGetProcAddressProc glXGetProcAddressP;
320#endif322#endif
321323
=== modified file 'tests/autopilot/autopilot/tests/test_dash.py'
--- tests/autopilot/autopilot/tests/test_dash.py 2012-06-19 16:59:06 +0000
+++ tests/autopilot/autopilot/tests/test_dash.py 2012-06-27 01:22:22 +0000
@@ -68,6 +68,30 @@
68 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))68 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
69 self.assertThat(self.dash.visible, Eventually(Equals(False)))69 self.assertThat(self.dash.visible, Eventually(Equals(False)))
7070
71 def test_dash_opens_when_in_spread(self):
72 """This test shows the dash opens when in spread mode."""
73 self.keybinding("spread/start")
74 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
75
76 self.dash.ensure_visible()
77 self.assertThat(self.dash.visible, Eventually(Equals(True)))
78
79 def test_command_lens_opens_when_in_spread(self):
80 """This test shows the command lens opens when in spread mode."""
81 self.keybinding("spread/start")
82 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
83
84 self.dash.reveal_command_lens()
85 self.assertThat(self.dash.active_lens, Eventually(Equals('commands.lens')))
86
87 def test_lens_opens_when_in_spread(self):
88 """This test shows that any lens opens when in spread mode."""
89 self.keybinding("spread/start")
90 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
91
92 self.dash.reveal_application_lens()
93 self.assertThat(self.dash.active_lens, Eventually(Equals('applications.lens')))
94
7195
72class DashSearchInputTests(DashTestCase):96class DashSearchInputTests(DashTestCase):
73 """Test features involving input to the dash search"""97 """Test features involving input to the dash search"""

Subscribers

People subscribed via source and target branches

to all changes: