diff --git a/libinput/connection.h b/libinput/connection.h --- a/libinput/connection.h +++ b/libinput/connection.h @@ -60,6 +60,9 @@ bool hasKeyboard() const { return m_keyboard > 0; } + bool hasAlphaNumericKeyboard() const { + return m_alphaNumericKeyboard > 0; + } bool hasTouch() const { return m_touch > 0; } @@ -91,6 +94,7 @@ void touchUp(qint32 id, quint32 time); void touchMotion(qint32 id, const QPointF &absolutePos, quint32 time); void hasKeyboardChanged(bool); + void hasAlphaNumericKeyboardChanged(bool); void hasPointerChanged(bool); void hasTouchChanged(bool); void deviceAdded(KWin::LibInput::Device *); @@ -110,9 +114,11 @@ QSocketNotifier *m_notifier; QSize m_size; int m_keyboard = 0; + int m_alphaNumericKeyboard = 0; int m_pointer = 0; int m_touch = 0; bool m_keyboardBeforeSuspend = false; + bool m_alphaNumericKeyboardBeforeSuspend = false; bool m_pointerBeforeSuspend = false; bool m_touchBeforeSuspend = false; QMutex m_mutex; diff --git a/libinput/connection.cpp b/libinput/connection.cpp --- a/libinput/connection.cpp +++ b/libinput/connection.cpp @@ -183,6 +183,7 @@ return; } m_keyboardBeforeSuspend = hasKeyboard(); + m_alphaNumericKeyboardBeforeSuspend = hasAlphaNumericKeyboard(); m_pointerBeforeSuspend = hasPointer(); m_touchBeforeSuspend = hasTouch(); m_input->suspend(); @@ -217,6 +218,12 @@ m_devices << device; if (device->isKeyboard()) { m_keyboard++; + if (device->isAlphaNumericKeyboard()) { + m_alphaNumericKeyboard++; + if (m_alphaNumericKeyboard == 1) { + emit hasAlphaNumericKeyboardChanged(true); + } + } if (m_keyboard == 1) { emit hasKeyboardChanged(true); } @@ -249,6 +256,12 @@ if (device->isKeyboard()) { m_keyboard--; + if (device->isAlphaNumericKeyboard()) { + m_alphaNumericKeyboard--; + if (m_alphaNumericKeyboard == 0) { + emit hasAlphaNumericKeyboardChanged(false); + } + } if (m_keyboard == 0) { emit hasKeyboardChanged(false); } @@ -363,6 +376,9 @@ if (m_keyboardBeforeSuspend && !m_keyboard) { emit hasKeyboardChanged(false); } + if (m_alphaNumericKeyboardBeforeSuspend && !m_alphaNumericKeyboardBeforeSuspend) { + emit hasAlphaNumericKeyboardChanged(false); + } if (m_pointerBeforeSuspend && !m_pointer) { emit hasPointerChanged(false); }