Merge lp:~osomon/qtubuntu/qkeyevent-native-virtual-key into lp:qtubuntu

Proposed by Olivier Tilloy
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 310
Merged at revision: 307
Proposed branch: lp:~osomon/qtubuntu/qkeyevent-native-virtual-key
Merge into: lp:qtubuntu
Diff against target: 42 lines (+9/-2)
1 file modified
src/ubuntumirclient/input.cpp (+9/-2)
To merge this branch: bzr merge lp:~osomon/qtubuntu/qkeyevent-native-virtual-key
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Approve
PS Jenkins bot continuous-integration Approve
Ubuntu Phablet Team Pending
Review via email: mp+282515@code.launchpad.net

Commit message

Instantiate QKeyEvents with the scan code, native modifiers and native virtual key code, and special-case XKB_KEY_Return and XKB_KEY_KP_Enter to emit a carriage return character.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
308. By Olivier Tilloy

Also pass the scan code, native modifiers and native virtual key code to QWindowSystemInterface.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
309. By Olivier Tilloy

Special case Enter and Return to forward the event with the correct text.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
310. By Olivier Tilloy

Send the Carriage Return character to actually get a new line.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Works fine for me

P.S. Submitted from a u8 session :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntumirclient/input.cpp'
2--- src/ubuntumirclient/input.cpp 2015-12-23 13:55:42 +0000
3+++ src/ubuntumirclient/input.cpp 2016-01-15 17:21:55 +0000
4@@ -367,6 +367,11 @@
5 if (sym >= XKB_KEY_F1 && sym <= XKB_KEY_F35)
6 return Qt::Key_F1 + (int(sym) - XKB_KEY_F1);
7
8+ if (sym == XKB_KEY_Return || sym == XKB_KEY_KP_Enter) {
9+ string[0] = '\r';
10+ string[1] = '\0';
11+ }
12+
13 for (int i = 0; KeyTable[i]; i += 2) {
14 if (sym == KeyTable[i])
15 return KeyTable[i + 1];
16@@ -404,6 +409,8 @@
17
18 ulong timestamp = mir_input_event_get_event_time(event) / 1000000;
19 xkb_keysym_t xk_sym = mir_keyboard_event_key_code(key_event);
20+ quint32 scan_code = mir_keyboard_event_scan_code(key_event);
21+ quint32 native_modifiers = mir_keyboard_event_modifiers(key_event);
22
23 // Key modifier and unicode index mapping.
24 auto modifiers = qt_modifiers_from_mir(mir_keyboard_event_modifiers(key_event));
25@@ -423,7 +430,7 @@
26
27 QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext();
28 if (context) {
29- QKeyEvent qKeyEvent(keyType, sym, modifiers, text, is_auto_rep);
30+ QKeyEvent qKeyEvent(keyType, sym, modifiers, scan_code, xk_sym, native_modifiers, text, is_auto_rep);
31 qKeyEvent.setTimestamp(timestamp);
32 if (context->filterEvent(&qKeyEvent)) {
33 DLOG("key event filtered out by input context");
34@@ -431,7 +438,7 @@
35 }
36 }
37
38- QWindowSystemInterface::handleKeyEvent(window->window(), timestamp, keyType, sym, modifiers, text, is_auto_rep);
39+ QWindowSystemInterface::handleExtendedKeyEvent(window->window(), timestamp, keyType, sym, modifiers, scan_code, xk_sym, native_modifiers, text, is_auto_rep);
40 }
41
42 namespace

Subscribers

People subscribed via source and target branches