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

Proposed by Brandon Schaefer
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2443
Proposed branch: lp:~brandontschaefer/unity/opening-dash-in-scale-mode-fix
Merge into: lp:unity
Diff against target: 135 lines (+55/-2)
4 files modified
dash/DashController.cpp (+4/-1)
plugins/unityshell/src/unityshell.cpp (+24/-0)
plugins/unityshell/src/unityshell.h (+2/-0)
tests/autopilot/unity/tests/test_dash.py (+25/-1)
To merge this branch: bzr merge lp:~brandontschaefer/unity/opening-dash-in-scale-mode-fix
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+112181@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
Marco Trevisan (Treviño) (3v1n0) wrote :

Works well, tests pass... So, approved! ;)

review: Approve
Revision history for this message
Sebastien Bacher (seb128) wrote :

The steps described there work, it doesn't work perfectly with the launcher spread though:
- left click on the nautilus launcher icon
- middle click on the same icon to open a second instance
- left click to trigger the spread view of nautilus instances
- hit the super key

-> nothing happens

- hit super again

-> the spread closes and the dash open

Ideally you would need to only press super once in those cases (it's not a regression and probably not worth blocking the SRU but would be nice to fix for the next round)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dash/DashController.cpp'
--- dash/DashController.cpp 2012-06-15 15:51:40 +0000
+++ dash/DashController.cpp 2012-06-26 18:36:22 +0000
@@ -80,7 +80,7 @@
80 window_->ShowWindow(false);80 window_->ShowWindow(false);
81 window_->SetOpacity(0.0f);81 window_->SetOpacity(0.0f);
82 window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Controller::OnMouseDownOutsideWindow));82 window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Controller::OnMouseDownOutsideWindow));
83 83
84 /* 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. */84 /* 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. */
85 auto plugin_adapter = PluginAdapter::Default();85 auto plugin_adapter = PluginAdapter::Default();
86 plugin_adapter->saveInputFocus ();86 plugin_adapter->saveInputFocus ();
@@ -337,6 +337,9 @@
337 std::string lens_id = view_->GetIdForShortcutActivation(std::string(key_string));337 std::string lens_id = view_->GetIdForShortcutActivation(std::string(key_string));
338 if (lens_id != "")338 if (lens_id != "")
339 {339 {
340 if (PluginAdapter::Default()->IsScaleActive())
341 PluginAdapter::Default()->TerminateScale();
342
340 GVariant* args = g_variant_new("(sus)", lens_id.c_str(), dash::GOTO_DASH_URI, "");343 GVariant* args = g_variant_new("(sus)", lens_id.c_str(), dash::GOTO_DASH_URI, "");
341 OnActivateRequest(args);344 OnActivateRequest(args);
342 g_variant_unref(args);345 g_variant_unref(args);
343346
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-06-25 21:37:57 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-06-26 18:36:22 +0000
@@ -131,6 +131,7 @@
131 , hud_keypress_time_(0)131 , hud_keypress_time_(0)
132 , panel_texture_has_changed_(true)132 , panel_texture_has_changed_(true)
133 , paint_panel_(false)133 , paint_panel_(false)
134 , scale_just_activated_(false)
134{135{
135 Timer timer;136 Timer timer;
136 gfloat version;137 gfloat version;
@@ -1532,6 +1533,11 @@
1532 ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);1533 ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
1533 }1534 }
15341535
1536 if (PluginAdapter::Default()->IsScaleActive() && g_strcmp0(plugin, "scale") == 0)
1537 {
1538 scale_just_activated_ = true;
1539 }
1540
1535 screen->handleCompizEvent(plugin, event, option);1541 screen->handleCompizEvent(plugin, event, option);
1536}1542}
15371543
@@ -1579,6 +1585,18 @@
1579 LOG_DEBUG(logger) << "Super released: " << (was_tap ? "tapped" : "released");1585 LOG_DEBUG(logger) << "Super released: " << (was_tap ? "tapped" : "released");
1580 int when = options[7].value().i(); // XEvent time in millisec1586 int when = options[7].value().i(); // XEvent time in millisec
15811587
1588 // hack...if the scale just wasn't activated AND the 'when' time is within time to start the
1589 // dash then assume was_tap is also true, since the ScalePlugin doesn't accept that state...
1590 if (PluginAdapter::Default()->IsScaleActive() && !scale_just_activated_ && launcher_controller_->AboutToShowDash(true, when))
1591 {
1592 PluginAdapter::Default()->TerminateScale();
1593 was_tap = true;
1594 }
1595 else if (scale_just_activated_)
1596 {
1597 scale_just_activated_ = false;
1598 }
1599
1582 if (hud_controller_->IsVisible() && launcher_controller_->AboutToShowDash(was_tap, when))1600 if (hud_controller_->IsVisible() && launcher_controller_->AboutToShowDash(was_tap, when))
1583 hud_controller_->HideHud();1601 hud_controller_->HideHud();
15841602
@@ -1635,6 +1653,12 @@
1635 {1653 {
1636 hud_controller_->HideHud();1654 hud_controller_->HideHud();
1637 }1655 }
1656
1657 if (PluginAdapter::Default()->IsScaleActive())
1658 {
1659 PluginAdapter::Default()->TerminateScale();
1660 }
1661
1638 ubus_manager_.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,1662 ubus_manager_.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
1639 g_variant_new("(sus)", "commands.lens", 0, ""));1663 g_variant_new("(sus)", "commands.lens", 0, ""));
1640}1664}
16411665
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2012-06-23 01:54:48 +0000
+++ plugins/unityshell/src/unityshell.h 2012-06-26 18:36:22 +0000
@@ -311,6 +311,8 @@
311 bool paint_panel_;311 bool paint_panel_;
312 nux::ObjectPtr<nux::IOpenGLBaseTexture> panel_texture_;312 nux::ObjectPtr<nux::IOpenGLBaseTexture> panel_texture_;
313313
314 bool scale_just_activated_;
315
314#ifndef USE_MODERN_COMPIZ_GL316#ifndef USE_MODERN_COMPIZ_GL
315 ScreenEffectFramebufferObject::GLXGetProcAddressProc glXGetProcAddressP;317 ScreenEffectFramebufferObject::GLXGetProcAddressProc glXGetProcAddressP;
316#endif318#endif
317319
=== modified file 'tests/autopilot/unity/tests/test_dash.py'
--- tests/autopilot/unity/tests/test_dash.py 2012-06-19 12:53:17 +0000
+++ tests/autopilot/unity/tests/test_dash.py 2012-06-26 18:36:22 +0000
@@ -70,6 +70,30 @@
70 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))70 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
71 self.assertThat(self.dash.visible, Eventually(Equals(False)))71 self.assertThat(self.dash.visible, Eventually(Equals(False)))
7272
73 def test_dash_opens_when_in_spread(self):
74 """This test shows the dash opens when in spread mode."""
75 self.keybinding("spread/start")
76 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
77
78 self.dash.ensure_visible()
79 self.assertThat(self.dash.visible, Eventually(Equals(True)))
80
81 def test_command_lens_opens_when_in_spread(self):
82 """This test shows the command lens opens when in spread mode."""
83 self.keybinding("spread/start")
84 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
85
86 self.dash.reveal_command_lens()
87 self.assertThat(self.dash.active_lens, Eventually(Equals('commands.lens')))
88
89 def test_lens_opens_when_in_spread(self):
90 """This test shows that any lens opens when in spread mode."""
91 self.keybinding("spread/start")
92 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
93
94 self.dash.reveal_application_lens()
95 self.assertThat(self.dash.active_lens, Eventually(Equals('applications.lens')))
96
7397
74class DashSearchInputTests(DashTestCase):98class DashSearchInputTests(DashTestCase):
75 """Test features involving input to the dash search"""99 """Test features involving input to the dash search"""
@@ -514,7 +538,7 @@
514 self.mouse.move(self.dash.view.x + self.dash.view.width / 2,538 self.mouse.move(self.dash.view.x + self.dash.view.width / 2,
515 category.header_y + category.header_height / 2)539 category.header_y + category.header_height / 2)
516540
517 self.mouse.click() 541 self.mouse.click()
518 self.assertThat(category.is_expanded, Eventually(Equals(not is_expanded)))542 self.assertThat(category.is_expanded, Eventually(Equals(not is_expanded)))
519543
520 self.mouse.click()544 self.mouse.click()