diff options
-rw-r--r-- | src/compositor/compositor_api/qwaylandinput.cpp | 5 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandinput.h | 1 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlinputdevice.cpp | 7 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlinputdevice_p.h | 2 | ||||
-rw-r--r-- | src/compositor/wayland_wrapper/qwlqtkey.cpp | 1 | ||||
-rw-r--r-- | src/extensions/qtkey-extension.xml | 3 | ||||
-rw-r--r-- | src/plugins/platforms/wayland_common/qwaylandqtkey.cpp | 25 | ||||
-rw-r--r-- | src/plugins/platforms/wayland_common/qwaylandqtkey.h | 22 |
8 files changed, 43 insertions, 23 deletions
diff --git a/src/compositor/compositor_api/qwaylandinput.cpp b/src/compositor/compositor_api/qwaylandinput.cpp index 76e83030b..c2b7c5108 100644 --- a/src/compositor/compositor_api/qwaylandinput.cpp +++ b/src/compositor/compositor_api/qwaylandinput.cpp @@ -122,6 +122,11 @@ void QWaylandInputDevice::sendFullKeyEvent(QKeyEvent *event) d->sendFullKeyEvent(event); } +void QWaylandInputDevice::sendFullKeyEvent(QWaylandSurface *surface, QKeyEvent *event) +{ + d->sendFullKeyEvent(surface->handle(), event); +} + QWaylandSurface *QWaylandInputDevice::keyboardFocus() const { QtWayland::Surface *wlsurface = d->keyboardFocus(); diff --git a/src/compositor/compositor_api/qwaylandinput.h b/src/compositor/compositor_api/qwaylandinput.h index b9d66178d..8e453af4e 100644 --- a/src/compositor/compositor_api/qwaylandinput.h +++ b/src/compositor/compositor_api/qwaylandinput.h @@ -73,6 +73,7 @@ public: void sendKeyReleaseEvent(uint code); void sendFullKeyEvent(QKeyEvent *event); + void sendFullKeyEvent(QWaylandSurface *surface, QKeyEvent *event); void sendTouchPointEvent(int id, double x, double y, Qt::TouchPointState state); void sendTouchFrameEvent(); diff --git a/src/compositor/wayland_wrapper/qwlinputdevice.cpp b/src/compositor/wayland_wrapper/qwlinputdevice.cpp index de448c53b..abc208430 100644 --- a/src/compositor/wayland_wrapper/qwlinputdevice.cpp +++ b/src/compositor/wayland_wrapper/qwlinputdevice.cpp @@ -212,6 +212,13 @@ void InputDevice::sendFullKeyEvent(QKeyEvent *event) m_keyboard->sendKeyReleaseEvent(event->nativeScanCode()); } +void InputDevice::sendFullKeyEvent(Surface *surface, QKeyEvent *event) +{ + QtKeyExtensionGlobal *ext = m_compositor->qtkeyExtension(); + if (ext) + ext->postQtKeyEvent(event, surface); +} + void InputDevice::sendFullTouchEvent(QTouchEvent *event) { if (!mouseFocus()) { diff --git a/src/compositor/wayland_wrapper/qwlinputdevice_p.h b/src/compositor/wayland_wrapper/qwlinputdevice_p.h index 3f7e4cc87..8c5b411ab 100644 --- a/src/compositor/wayland_wrapper/qwlinputdevice_p.h +++ b/src/compositor/wayland_wrapper/qwlinputdevice_p.h @@ -90,6 +90,8 @@ public: void sendTouchCancelEvent(); void sendFullKeyEvent(QKeyEvent *event); + void sendFullKeyEvent(Surface *surface, QKeyEvent *event); + void sendFullTouchEvent(QTouchEvent *event); Surface *keyboardFocus() const; diff --git a/src/compositor/wayland_wrapper/qwlqtkey.cpp b/src/compositor/wayland_wrapper/qwlqtkey.cpp index a2b99ebc1..ba0288782 100644 --- a/src/compositor/wayland_wrapper/qwlqtkey.cpp +++ b/src/compositor/wayland_wrapper/qwlqtkey.cpp @@ -63,6 +63,7 @@ bool QtKeyExtensionGlobal::postQtKeyEvent(QKeyEvent *event, Surface *surface) if (target) { send_qtkey(target->handle, + surface ? surface->resource()->handle : 0, time, event->type(), event->key(), event->modifiers(), event->nativeScanCode(), event->nativeVirtualKey(), diff --git a/src/extensions/qtkey-extension.xml b/src/extensions/qtkey-extension.xml index 1d0db59df..711a2c284 100644 --- a/src/extensions/qtkey-extension.xml +++ b/src/extensions/qtkey-extension.xml @@ -38,12 +38,13 @@ $QT_END_LICENSE$ </copyright> - <interface name="qt_key_extension" version="1"> + <interface name="qt_key_extension" version="2"> <event name="qtkey"> <description summary="qtkey event"> Serialized QKeyEvent </description> + <arg name="surface" type="object" interface="wl_surface"/> <arg name="time" type="uint"/> <arg name="type" type="uint"/> <arg name="key" type="uint"/> diff --git a/src/plugins/platforms/wayland_common/qwaylandqtkey.cpp b/src/plugins/platforms/wayland_common/qwaylandqtkey.cpp index e723078cd..6cc4597d9 100644 --- a/src/plugins/platforms/wayland_common/qwaylandqtkey.cpp +++ b/src/plugins/platforms/wayland_common/qwaylandqtkey.cpp @@ -50,25 +50,26 @@ QWaylandQtKeyExtension::QWaylandQtKeyExtension(QWaylandDisplay *display, uint32_ { } -void QWaylandQtKeyExtension::key_extension_qtkey(uint32_t time, - uint32_t type, - uint32_t key, - uint32_t modifiers, - uint32_t nativeScanCode, - uint32_t nativeVirtualKey, - uint32_t nativeModifiers, - const QString &text, - uint32_t autorep, - uint32_t count) +void QWaylandQtKeyExtension::key_extension_qtkey(struct wl_surface *surface, + uint32_t time, + uint32_t type, + uint32_t key, + uint32_t modifiers, + uint32_t nativeScanCode, + uint32_t nativeVirtualKey, + uint32_t nativeModifiers, + const QString &text, + uint32_t autorep, + uint32_t count) { QList<QWaylandInputDevice *> inputDevices = m_display->inputDevices(); - if (inputDevices.isEmpty()) { + if (!surface && inputDevices.isEmpty()) { qWarning("qt_key_extension: handle_qtkey: No input device"); return; } QWaylandInputDevice *dev = inputDevices.first(); - QWaylandWindow *win = dev->mKeyboardFocus; + QWaylandWindow *win = surface ? QWaylandWindow::fromWlSurface(surface) : dev->mKeyboardFocus; if (!win || !win->window()) { qWarning("qt_key_extension: handle_qtkey: No keyboard focus"); diff --git a/src/plugins/platforms/wayland_common/qwaylandqtkey.h b/src/plugins/platforms/wayland_common/qwaylandqtkey.h index 17b758cf9..c02831304 100644 --- a/src/plugins/platforms/wayland_common/qwaylandqtkey.h +++ b/src/plugins/platforms/wayland_common/qwaylandqtkey.h @@ -57,16 +57,18 @@ public: private: QWaylandDisplay *m_display; - void key_extension_qtkey(uint32_t time, - uint32_t type, - uint32_t key, - uint32_t modifiers, - uint32_t nativeScanCode, - uint32_t nativeVirtualKey, - uint32_t nativeModifiers, - const QString &text, - uint32_t autorep, - uint32_t count) Q_DECL_OVERRIDE; + void key_extension_qtkey(struct wl_surface *surface, + uint32_t time, + uint32_t type, + uint32_t key, + uint32_t modifiers, + uint32_t nativeScanCode, + uint32_t nativeVirtualKey, + uint32_t nativeModifiers, + const QString &text, + uint32_t autorep, + uint32_t count) Q_DECL_OVERRIDE; + }; QT_END_NAMESPACE |