diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-03-20 14:14:37 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-03-21 07:46:44 +0000 |
commit | 034451087025ba69312600b16c3c0343744e78cd (patch) | |
tree | 0e00e324faabc94dd380cef9d46fbacb8e302325 | |
parent | 26a6372bb0c6528358e34f8175a14ff0be47fb12 (diff) | |
download | qtwayland-034451087025ba69312600b16c3c0343744e78cd.tar.gz |
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.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 21b3a531..752e4a42 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(); } |