Merge lp:~thomir-deactivatedaccount/unity/fix-hud-closing into lp:unity

Proposed by Thomi Richards
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2481
Proposed branch: lp:~thomir-deactivatedaccount/unity/fix-hud-closing
Merge into: lp:unity
Diff against target: 86 lines (+28/-2)
4 files modified
dash/DashView.cpp (+6/-2)
hud/HudView.cpp (+4/-0)
tests/autopilot/unity/tests/test_dash.py (+9/-0)
tests/autopilot/unity/tests/test_hud.py (+9/-0)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/unity/fix-hud-closing
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+114089@code.launchpad.net

Commit message

Dash and hud now close on Alt+F4 even when the caps lock or num lock keys are active.

Description of the change

Problem:

The dash and the hud are supposed to close on Alt+F4, but this doesn't work if the caps lock or num lock keys are active.

Solution:

This branch fixes that.

Tests:

There are two more autopilot tests that cover this code.

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

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dash/DashView.cpp'
--- dash/DashView.cpp 2012-07-04 02:37:23 +0000
+++ dash/DashView.cpp 2012-07-10 03:30:31 +0000
@@ -227,7 +227,7 @@
227 nux::Geometry const& geo = GetGeometry();227 nux::Geometry const& geo = GetGeometry();
228 content_geo_ = GetBestFitGeometry(geo);228 content_geo_ = GetBestFitGeometry(geo);
229 dash::Style& style = dash::Style::Instance();229 dash::Style& style = dash::Style::Instance();
230 230
231 if (style.always_maximised)231 if (style.always_maximised)
232 {232 {
233 if (geo.width >= content_geo_.width && geo.height > content_geo_.height)233 if (geo.width >= content_geo_.width && geo.height > content_geo_.height)
@@ -460,7 +460,7 @@
460 });460 });
461461
462 // global search done is handled by the home lens, no need to connect to it462 // global search done is handled by the home lens, no need to connect to it
463 // BUT, we will special case global search finished coming from 463 // BUT, we will special case global search finished coming from
464 // the applications lens, because we want to be able to launch applications464 // the applications lens, because we want to be able to launch applications
465 // immediately without waiting for the search finished signal which will465 // immediately without waiting for the search finished signal which will
466 // be delayed by all the lenses we're searching466 // be delayed by all the lenses we're searching
@@ -766,6 +766,10 @@
766 unsigned long x11_key_code,766 unsigned long x11_key_code,
767 unsigned long special_keys_state)767 unsigned long special_keys_state)
768{768{
769 // Only care about states of Alt, Ctrl, Super, Shift, not the lock keys
770 special_keys_state &= (nux::NUX_STATE_ALT | nux::NUX_STATE_CTRL |
771 nux::NUX_STATE_SUPER | nux::NUX_STATE_SHIFT);
772
769 // Do what nux::View does, but if the event isn't a key navigation,773 // Do what nux::View does, but if the event isn't a key navigation,
770 // designate the text entry to process it.774 // designate the text entry to process it.
771775
772776
=== modified file 'hud/HudView.cpp'
--- hud/HudView.cpp 2012-07-04 02:37:23 +0000
+++ hud/HudView.cpp 2012-07-10 03:30:31 +0000
@@ -565,6 +565,10 @@
565 unsigned long x11_key_code,565 unsigned long x11_key_code,
566 unsigned long special_keys_state)566 unsigned long special_keys_state)
567{567{
568 // Only care about states of Alt, Ctrl, Super, Shift, not the lock keys
569 special_keys_state &= (nux::NUX_STATE_ALT | nux::NUX_STATE_CTRL |
570 nux::NUX_STATE_SUPER | nux::NUX_STATE_SHIFT);
571
568 nux::KeyNavDirection direction = nux::KEY_NAV_NONE;572 nux::KeyNavDirection direction = nux::KEY_NAV_NONE;
569 switch (x11_key_code)573 switch (x11_key_code)
570 {574 {
571575
=== modified file 'tests/autopilot/unity/tests/test_dash.py'
--- tests/autopilot/unity/tests/test_dash.py 2012-07-04 02:37:23 +0000
+++ tests/autopilot/unity/tests/test_dash.py 2012-07-10 03:30:31 +0000
@@ -62,6 +62,15 @@
62 self.keyboard.press_and_release("Alt+F4")62 self.keyboard.press_and_release("Alt+F4")
63 self.assertThat(self.dash.visible, Eventually(Equals(False)))63 self.assertThat(self.dash.visible, Eventually(Equals(False)))
6464
65 def test_alt_f4_close_dash_with_capslock_on(self):
66 """Dash must close on Alt+F4 even when the capslock is turned on."""
67 self.keyboard.press_and_release("Caps_Lock")
68 self.addCleanup(self.keyboard.press_and_release, "Caps_Lock")
69
70 self.dash.ensure_visible()
71 self.keyboard.press_and_release("Alt+F4")
72 self.assertThat(self.dash.visible, Eventually(Equals(False)))
73
65 def test_dash_closes_on_spread(self):74 def test_dash_closes_on_spread(self):
66 """This test shows that when the spread is initiated, the dash closes."""75 """This test shows that when the spread is initiated, the dash closes."""
67 self.dash.ensure_visible()76 self.dash.ensure_visible()
6877
=== modified file 'tests/autopilot/unity/tests/test_hud.py'
--- tests/autopilot/unity/tests/test_hud.py 2012-07-06 00:12:18 +0000
+++ tests/autopilot/unity/tests/test_hud.py 2012-07-10 03:30:31 +0000
@@ -254,6 +254,15 @@
254 self.keyboard.press_and_release("Alt+F4")254 self.keyboard.press_and_release("Alt+F4")
255 self.assertThat(self.hud.visible, Eventually(Equals(False)))255 self.assertThat(self.hud.visible, Eventually(Equals(False)))
256256
257 def test_alt_f4_close_hud_with_capslock_on(self):
258 """Hud must close on Alt+F4 even when the capslock is turned on."""
259 self.keyboard.press_and_release("Caps_Lock")
260 self.addCleanup(self.keyboard.press_and_release, "Caps_Lock")
261
262 self.hud.ensure_visible()
263 self.keyboard.press_and_release("Alt+F4")
264 self.assertThat(self.hud.visible, Eventually(Equals(False)))
265
257266
258class HudLauncherInteractionsTests(HudTestsBase):267class HudLauncherInteractionsTests(HudTestsBase):
259268