summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-03-20 14:14:37 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-03-21 07:46:44 +0000
commit034451087025ba69312600b16c3c0343744e78cd (patch)
tree0e00e324faabc94dd380cef9d46fbacb8e302325
parent26a6372bb0c6528358e34f8175a14ff0be47fb12 (diff)
Ensure a QWaylandQuickItem has keyboard focus before sending key events
If a QWaylandQuickItem had gotten focus in other ways than through QWaylandQuickItem::takeFocus, then the keyboard focus would not be updated. Change-Id: I6b5ee6d33449f0048e1c44765c1723eaa82ffd69 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 21b3a531e..752e4a423 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -618,7 +618,10 @@ void QWaylandQuickItem::keyPressEvent(QKeyEvent *event)
Q_D(QWaylandQuickItem);
if (d->shouldSendInputEvents()) {
QWaylandSeat *seat = compositor()->seatFor(event);
- seat->sendFullKeyEvent(event);
+ if (seat->setKeyboardFocus(d->view->surface()))
+ seat->sendFullKeyEvent(event);
+ else
+ qWarning() << "Unable to set keyboard focus, cannot send key press event";
} else {
event->ignore();
}