diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-03-27 15:30:26 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-04-27 10:17:10 +0000 |
commit | bd5917025fe7491c9f24e99c20484c7ffce9f172 (patch) | |
tree | 006435d90eb25738b04a2c86aa45c0b3e8babdf1 /tests/auto/compositor/compositor/compositor.pro | |
parent | 531a767040782007181bb13583fe69b4ba4b1ba3 (diff) |
Add QWaylandSeat::sendKeyEvent(int qtKey, bool pressed)
Makes it possible to send keyboard events using the QML API:
Button {
onPressedChanged: seat.sendKeyEvent(Qt.Key_Left, pressed)
}
The wl_keyboard.key event requires a keyboard scan code, so in order to get
this we iterate over all the keys in the current keymap checking which QtKey
they map to, storing the results in a QMap which is reused by later calls to
QWaylandKeymap::toScanCode.
This also fixes a bug when sending QKeyEvents without a native scan code using
QWaylandSeat::sendFullKeyEvent. (generated key events have no nativeScanCode).
Now we try QWaylandKeyboard::toScanCode, and if unsuccessful we return with a
warning instead of letting the assertion in QWaylandKeyboard fail.
This also adds more thorough testing for the keyboard, including keymaps and
checking that the events, including enter and leave, are actually received on
the client side.
Change-Id: I601b0c7d909071863abb146bd65a990215dcaff7
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/compositor/compositor/compositor.pro')
-rw-r--r-- | tests/auto/compositor/compositor/compositor.pro | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/compositor/compositor/compositor.pro b/tests/auto/compositor/compositor/compositor.pro index 2919fa4bb..68b18c974 100644 --- a/tests/auto/compositor/compositor/compositor.pro +++ b/tests/auto/compositor/compositor/compositor.pro @@ -21,6 +21,7 @@ SOURCES += \ mockclient.cpp \ mockseat.cpp \ testseat.cpp \ + mockkeyboard.cpp \ mockpointer.cpp HEADERS += \ @@ -29,4 +30,5 @@ HEADERS += \ mockclient.h \ mockseat.h \ testseat.h \ + mockkeyboard.h \ mockpointer.h |