diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2012-03-27 15:50:03 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2012-03-27 16:15:42 +0200 |
commit | e60c124146da19bd56292a31eae91eac2a175b37 (patch) | |
tree | 31a0905d9b12518a822e11ce478d3723d5219483 /src/compositor/wayland_wrapper/wlinputdevice.cpp | |
parent | 6ace81964c8786700aaa82568e7f3a4c35b63172 (diff) |
Added qtkey extension to send raw QKeyEvents over the protocol.
For Qt based compositors we already have the full QKeyEvent, so we might
as well send it over the wayland protocol. This pretty much mirrors the
touch extension we already have.
Change-Id: I922f0cab6fe137272744762d6c57a31056b45672
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper/wlinputdevice.cpp')
-rw-r--r-- | src/compositor/wayland_wrapper/wlinputdevice.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/compositor/wayland_wrapper/wlinputdevice.cpp b/src/compositor/wayland_wrapper/wlinputdevice.cpp index 198c2ba09..9b20edd41 100644 --- a/src/compositor/wayland_wrapper/wlinputdevice.cpp +++ b/src/compositor/wayland_wrapper/wlinputdevice.cpp @@ -45,6 +45,7 @@ #include "wldatadevice.h" #include "wlsurface.h" #include "wltouch.h" +#include "wlqtkey.h" #include "waylandcompositor.h" #include <QtGui/QTouchEvent> @@ -168,6 +169,25 @@ void InputDevice::sendTouchCancelEvent() } } +void InputDevice::sendFullKeyEvent(QKeyEvent *event) +{ + if (!keyboardFocus()) { + qWarning("Cannot send key event, no keyboard focus, fix the compositor"); + return; + } + + QtKeyExtensionGlobal *ext = m_compositor->qtkeyExtension(); + if (ext) { + ext->postQtKeyEvent(event, keyboardFocus()); + return; + } + + if (event->type() == QEvent::KeyPress) + sendKeyPressEvent(event->nativeScanCode()); + else if (event->type() == QEvent::KeyRelease) + sendKeyReleaseEvent(event->nativeScanCode()); +} + void InputDevice::sendFullTouchEvent(QTouchEvent *event) { if (!mouseFocus()) { |