~ci-train-bot/qtubuntu/qtubuntu-ubuntu-xenial-landing-057

« back to all changes in this revision

Viewing changes to src/ubuntumirclient/input.cpp

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. Fixes: #1433138
Approved by: Lukáš Tinkl, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
367
367
    if (sym >= XKB_KEY_F1 && sym <= XKB_KEY_F35)
368
368
        return Qt::Key_F1 + (int(sym) - XKB_KEY_F1);
369
369
 
 
370
    if (sym == XKB_KEY_Return || sym == XKB_KEY_KP_Enter) {
 
371
        string[0] = '\r';
 
372
        string[1] = '\0';
 
373
    }
 
374
 
370
375
    for (int i = 0; KeyTable[i]; i += 2) {
371
376
        if (sym == KeyTable[i])
372
377
            return KeyTable[i + 1];
404
409
 
405
410
    ulong timestamp = mir_input_event_get_event_time(event) / 1000000;
406
411
    xkb_keysym_t xk_sym = mir_keyboard_event_key_code(key_event);
 
412
    quint32 scan_code = mir_keyboard_event_scan_code(key_event);
 
413
    quint32 native_modifiers = mir_keyboard_event_modifiers(key_event);
407
414
 
408
415
    // Key modifier and unicode index mapping.
409
416
    auto modifiers = qt_modifiers_from_mir(mir_keyboard_event_modifiers(key_event));
423
430
 
424
431
    QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext();
425
432
    if (context) {
426
 
        QKeyEvent qKeyEvent(keyType, sym, modifiers, text, is_auto_rep);
 
433
        QKeyEvent qKeyEvent(keyType, sym, modifiers, scan_code, xk_sym, native_modifiers, text, is_auto_rep);
427
434
        qKeyEvent.setTimestamp(timestamp);
428
435
        if (context->filterEvent(&qKeyEvent)) {
429
436
            DLOG("key event filtered out by input context");
431
438
        }
432
439
    }
433
440
 
434
 
    QWindowSystemInterface::handleKeyEvent(window->window(), timestamp, keyType, sym, modifiers, text, is_auto_rep);
 
441
    QWindowSystemInterface::handleExtendedKeyEvent(window->window(), timestamp, keyType, sym, modifiers, scan_code, xk_sym, native_modifiers, text, is_auto_rep);
435
442
}
436
443
 
437
444
namespace