diff --git a/virtualkeyboard.cpp b/virtualkeyboard.cpp
index 5533e8d602..fd624f427d 100644
--- a/virtualkeyboard.cpp
+++ b/virtualkeyboard.cpp
@@ -27,6 +27,7 @@ along with this program. If not, see .
#include "workspace.h"
#include "xkb.h"
#include "xdgshellclient.h"
+#include "screenlockerwatcher.h"
#include
#include
@@ -87,6 +88,8 @@ void VirtualKeyboard::init()
}
m_inputWindow->setProperty("__kwin_input_method", true);
+ connect(ScreenLockerWatcher::self(), &ScreenLockerWatcher::aboutToLock, this, &VirtualKeyboard::hide);
+
if (waylandServer()) {
m_enabled = !input()->hasAlphaNumericKeyboard();
qCDebug(KWIN_VIRTUALKEYBOARD) << "enabled by default: " << m_enabled;
@@ -289,6 +292,7 @@ void VirtualKeyboard::hide()
if (m_inputWindow.isNull()) {
return;
}
+ m_inputWindow->hide();
qApp->inputMethod()->hide();
}