From 8616d5f0c2a66c237cecbe1904f64e953be7bd14 Mon Sep 17 00:00:00 2001 From: Tobias Markmann <tm@ayena.de> Date: Wed, 25 Nov 2015 10:16:02 +0100 Subject: Fix Ctrl + Tab shortcut when MUC contact list is selected This also fixes the issue of Ctrl + Backtab moving two tabs back on Windows. Test-Information: Tested on Debian 8.2 with Gnome 3 and Qt 5.3.2, OS X 10.10.5 with Qt 5.4.2 and Windows 8 with Qt 5.4.2. Verified that Ctrl + Tab works correctly. Verified that Ctrl + Tab works correctly when the chat room contact list is selected. Verified that Ctrl + Backtab works correctly. Change-Id: I9e461d741a399aed59142505e29c03cebe26097e diff --git a/Swift/QtUI/QtTabbable.cpp b/Swift/QtUI/QtTabbable.cpp index feab35e..2a0bbc2 100644 --- a/Swift/QtUI/QtTabbable.cpp +++ b/Swift/QtUI/QtTabbable.cpp @@ -40,7 +40,9 @@ bool QtTabbable::event(QEvent* event) { if (keyEvent) { // According to Qt's focus documentation, one can only override CTRL+TAB via reimplementing QWidget::event(). if (keyEvent->modifiers().testFlag(QtUtilities::ctrlHardwareKeyModifier) && keyEvent->key() == Qt::Key_Tab) { - if (keyEvent->type() != QEvent::ShortcutOverride) { + // Only handle KeyRelease event as Linux also generate KeyPress event in case of CTRL+TAB being pressed + // in the roster of a MUC. + if (keyEvent->type() == QEvent::KeyRelease) { emit requestNextTab(); } return true; @@ -50,7 +52,12 @@ bool QtTabbable::event(QEvent* event) { #else else if (keyEvent->modifiers().testFlag(QtUtilities::ctrlHardwareKeyModifier) && keyEvent->key() == Qt::Key_Backtab) { #endif +#ifdef SWIFTEN_PLATFORM_WINDOWS + // Windows emits both the KeyPress and KeyRelease events. + if (keyEvent->type() == QEvent::KeyPress) { +#else if (keyEvent->type() != QEvent::ShortcutOverride) { +#endif emit requestPreviousTab(); } return true; -- cgit v0.10.2-6-g49f6