Skip to content
  • 0 Votes
    2 Posts
    116 Views
    HoratioH
    Answering my own question... Pass WaylandCompositor's property - defaultSeat into C++ as QWaylandSeat*. https://doc.qt.io/archives/qt-5.15/qml-qtwayland-compositor-waylandcompositor.html#defaultSeat-prop WaylandCompositor { id: iCompositor Component.onCompleted: { CppHelper.setDefaultWaylandSeat( iCompositor.defaultSeat ); } } Use QWaylandSeat's setKeyboardFocus(), which takes QWaylandSurface*. https://doc.qt.io/archives/qt-5.15/qwaylandseat.html#setKeyboardFocus QWaylandSurface* can be found in the onIviSurfaceCreated() as iviSurface. You can pass it into C++. IviApplication { onIviSurfaceCreated: { var surfaceArea = iviSurface.iviId === 1337 ? leftArea : rightArea; var item = chromeComponent.createObject(surfaceArea, { "shellSurface": iviSurface } ); item.handleResized(); // Pass QWaylandSurface* into C++. CppHelper.registerIviSurface( iviSurface ); } } The signal keyboardFocusChanged can be used to observe the change. https://doc.qt.io/archives/qt-5.15/qwaylandseat.html#keyboardFocusChanged However, setKeyboardFocus() doesn't work very well. I do get the signal keyboard focus changed, but the focus jump back to the original window if I actually press a keyboard key.