Merge lp:~aacid/unity-2d/unity-2d-shell_eat_shortcut_key_events into lp:~unity-2d-team/unity-2d/unity-2d-shell

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michał Sawicz
Approved revision: 931
Merged at revision: 932
Proposed branch: lp:~aacid/unity-2d/unity-2d-shell_eat_shortcut_key_events
Merge into: lp:~unity-2d-team/unity-2d/unity-2d-shell
Diff against target: 48 lines (+9/-5)
2 files modified
libunity-2d-private/src/hotkeymonitor.cpp (+8/-4)
libunity-2d-private/src/hotkeymonitor.h (+1/-1)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d-shell_eat_shortcut_key_events
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
Review via email: mp+90071@code.launchpad.net

Description of the change

Eat hotkey events if they match

Fixes "When dash is active, pressing 'Super+S' to invoke spread is getting 's' character being entered in Dash search box"

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :
931. By Albert Astals Cid

merge

Revision history for this message
Michał Sawicz (saviq) wrote :

The test doesn't fail on top of current unity-2d-shell, here's an adapdted diff:

=== zmodyfikowano plik tests/places/places-tests.rb
--- tests/places/places-tests.rb 2012-01-25 12:03:31 +0000
+++ tests/places/places-tests.rb 2012-01-25 12:45:28 +0000
@@ -111,4 +111,40 @@
         @app.Dash()['active']
     }
   end
+
+ # Test case objectives:
+ # * Check that Super+s does not type s
+ # Pre-conditions
+ # * Desktop with no running applications
+ # Test steps
+ # * Verify dash is not showing
+ # * Press Alt+F2
+ # * Verify dash is showing
+ # * Verify there is no text in the search entry
+ # * Press Super+s
+ # * Verify there is no text in the search entry
+ # Post-conditions
+ # * None
+ # References
+ # * None
+ test "Super+s does not type s" do
+ verify_equal("false", 0, 'There should not be a Dash declarative view on startup') {
+ @app.Dash()['active']
+ }
+ XDo::Keyboard.alt_F2 #Must use uppercase F to indicate function keys
+ verify_equal("true", TIMEOUT, 'There should be a Dash declarative view after pressing Alt+F2') {
+ @app.Dash()['active']
+ }
+ verify_equal("", TIMEOUT, 'There should be no text in the Search Entry') {
+ @app.Dash().SearchEntry().QDeclarativeTextInput()['text']
+ }
+ XDo::Keyboard.super_s
+ verify_not(0, "Text of the Search Entry should not be an 's'") {
+ verify_equal( "s", 1 ) {
+ @app.Dash().SearchEntry().QDeclarativeTextInput()['text']
+ }
+ }
+ sleep 1
+ XDo::Keyboard.escape
+ end
 end

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) wrote :

Actually this works fine, it's the test that needs fixing...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/hotkeymonitor.cpp'
2--- libunity-2d-private/src/hotkeymonitor.cpp 2011-10-14 07:07:09 +0000
3+++ libunity-2d-private/src/hotkeymonitor.cpp 2012-01-25 12:28:04 +0000
4@@ -95,13 +95,15 @@
5 if (event->type == KeyRelease || event->type == KeyPress)
6 {
7 XKeyEvent* key = (XKeyEvent*) event;
8- HotkeyMonitor::instance().processKeyEvent(key->keycode, key->state,
9- event->type == KeyPress);
10+ if (HotkeyMonitor::instance().processKeyEvent(key->keycode, key->state,
11+ event->type == KeyPress)) {
12+ return true;
13+ }
14 }
15 return false;
16 }
17
18-void
19+bool
20 HotkeyMonitor::processKeyEvent(uint x11Keycode, uint x11Modifiers,
21 bool isPressEvent)
22 {
23@@ -113,9 +115,11 @@
24 }
25
26 if (hotkey->processNativeEvent(x11Keycode, x11Modifiers, isPressEvent)) {
27- return;
28+ return true;
29 }
30 }
31+
32+ return false;
33 }
34
35 #include "hotkeymonitor.moc"
36
37=== modified file 'libunity-2d-private/src/hotkeymonitor.h'
38--- libunity-2d-private/src/hotkeymonitor.h 2011-10-14 07:07:09 +0000
39+++ libunity-2d-private/src/hotkeymonitor.h 2012-01-25 12:28:04 +0000
40@@ -42,7 +42,7 @@
41 HotkeyMonitor(QObject* parent=0);
42
43 static bool keyEventFilter(void* message);
44- void processKeyEvent(uint x11Keycode, uint x11Modifiers,
45+ bool processKeyEvent(uint x11Keycode, uint x11Modifiers,
46 bool isPressEvent);
47
48 QList<Hotkey*> m_hotkeys;

Subscribers

People subscribed via source and target branches