diff --git a/input.cpp b/input.cpp index 93a1a7f33f..571264417c 100644 --- a/input.cpp +++ b/input.cpp @@ -21,6 +21,9 @@ along with this program. If not, see . #include "client.h" #include "effects.h" #include "globalshortcuts.h" +#ifdef KWIN_BUILD_TABBOX +#include "tabbox/tabbox.h" +#endif #include "unmanaged.h" #include "workspace.h" // KDE @@ -258,6 +261,14 @@ void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::Keyboa #if HAVE_XKB m_xkb->updateKey(key, state); // TODO: pass to internal parts of KWin +#ifdef KWIN_BUILD_TABBOX + if (TabBox::TabBox::self()->isGrabbed()) { + if (state == KWin::InputRedirection::KeyboardKeyPressed) { + TabBox::TabBox::self()->keyPress(m_xkb->modifiers() | m_xkb->toQtKey(m_xkb->toKeysym(key))); + } + return; + } +#endif if (effects && static_cast< EffectsHandlerImpl* >(effects)->hasKeyboardGrab()) { const xkb_keysym_t keysym = m_xkb->toKeysym(key); // TODO: start auto-repeat diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index 200222c595..a4339878f3 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -470,6 +470,8 @@ TabBox::TabBox(QObject *parent) connect(&m_delayedShowTimer, SIGNAL(timeout()), this, SLOT(show())); connect(Workspace::self(), SIGNAL(configChanged()), this, SLOT(reconfigure())); QDBusConnection::sessionBus().registerObject(QStringLiteral("/TabBox"), this, QDBusConnection::ExportScriptableContents); + + connect(input(), &InputRedirection::keyboardModifiersChanged, this, &TabBox::modifiersChanged); } TabBox::~TabBox() @@ -1525,6 +1527,28 @@ void TabBox::keyRelease(const xcb_key_release_event_t *ev) } } +void TabBox::modifiersChanged(Qt::KeyboardModifiers mods) +{ + if (m_noModifierGrab || !(!mods)) { + return; + } + if (m_tabGrab) { + bool old_control_grab = m_desktopGrab; + accept(); + m_desktopGrab = old_control_grab; + } + if (m_desktopGrab) { + bool old_tab_grab = m_tabGrab; + int desktop = currentDesktop(); + close(); + m_tabGrab = old_tab_grab; + if (desktop != -1) { + setCurrentDesktop(desktop); + VirtualDesktopManager::self()->setCurrent(desktop); + } + } +} + int TabBox::nextDesktopStatic(int iDesktop) const { DesktopNext functor; diff --git a/tabbox/tabbox.h b/tabbox/tabbox.h index 30575e278e..90418f4ee0 100644 --- a/tabbox/tabbox.h +++ b/tabbox/tabbox.h @@ -257,6 +257,7 @@ private: private Q_SLOTS: void reconfigure(); void globalShortcutChanged(QAction *action, const QKeySequence &seq); + void modifiersChanged(Qt::KeyboardModifiers mods); private: TabBoxMode m_tabBoxMode;