diff options
author | Florian Bruhin <git@the-compiler.org> | 2016-03-31 19:32:30 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2016-03-31 19:45:36 +0200 |
commit | 27b31b7ded4fe5fc2c2d980d679f00ba46757dbf (patch) | |
tree | d24879d74728768050c741ae44c38dc027375770 /qutebrowser/keyinput/modeman.py | |
parent | 123fd18af5a60a3b42d776844af67b5390100d31 (diff) | |
download | qutebrowser-27b31b7ded4fe5fc2c2d980d679f00ba46757dbf.tar.gz qutebrowser-27b31b7ded4fe5fc2c2d980d679f00ba46757dbf.zip |
Avoid DownloadView being focused when pressing tab
The previous fix didn't work in situations where the web view was
actually focused, but had no focused element (like about:blank).
The new fix always works, and even is a lot simpler!
Fixes #504.
Diffstat (limited to 'qutebrowser/keyinput/modeman.py')
-rw-r--r-- | qutebrowser/keyinput/modeman.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index 21c579761..fb948ec18 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -23,7 +23,6 @@ import functools from PyQt5.QtCore import pyqtSignal, Qt, QObject, QEvent from PyQt5.QtWidgets import QApplication -from PyQt5.QtWebKitWidgets import QWebView from qutebrowser.keyinput import modeparsers, keyparser from qutebrowser.config import config @@ -171,13 +170,9 @@ class ModeManager(QObject): is_non_alnum = ( event.modifiers() not in (Qt.NoModifier, Qt.ShiftModifier) or not event.text().strip()) - focus_widget = QApplication.instance().focusWidget() - is_tab = event.key() in (Qt.Key_Tab, Qt.Key_Backtab) if handled: filter_this = True - elif is_tab and not isinstance(focus_widget, QWebView): - filter_this = True elif (parser.passthrough or self._forward_unbound_keys == 'all' or (self._forward_unbound_keys == 'auto' and is_non_alnum)): @@ -189,11 +184,12 @@ class ModeManager(QObject): self._releaseevents_to_pass.add(KeyEvent(event)) if curmode != usertypes.KeyMode.insert: + focus_widget = QApplication.instance().focusWidget() log.modes.debug("handled: {}, forward-unbound-keys: {}, " - "passthrough: {}, is_non_alnum: {}, is_tab {} --> " + "passthrough: {}, is_non_alnum: {} --> " "filter: {} (focused: {!r})".format( handled, self._forward_unbound_keys, - parser.passthrough, is_non_alnum, is_tab, + parser.passthrough, is_non_alnum, filter_this, focus_widget)) return filter_this |