Remove setting forward_unbound_keys.
It introduced a lot of unnecessary complexity (e.g. tracking KeyReleases to their KeyPresses...) for little benefit.
This commit is contained in:
parent
83f829ed93
commit
d07e22bd91
@ -284,7 +284,7 @@ class QuteBrowser(QApplication):
|
|||||||
# config
|
# config
|
||||||
self.config.style_changed.connect(style.invalidate_caches)
|
self.config.style_changed.connect(style.invalidate_caches)
|
||||||
for obj in [tabs, completion, self.mainwindow, config.cmd_history,
|
for obj in [tabs, completion, self.mainwindow, config.cmd_history,
|
||||||
websettings, kp["normal"], modes.manager]:
|
websettings, kp["normal"]]:
|
||||||
self.config.changed.connect(obj.on_config_changed)
|
self.config.changed.connect(obj.on_config_changed)
|
||||||
|
|
||||||
# statusbar
|
# statusbar
|
||||||
|
@ -186,10 +186,6 @@ DATA = OrderedDict([
|
|||||||
SettingValue(types.Bool(), "true"),
|
SettingValue(types.Bool(), "true"),
|
||||||
"Whether to automatically enter insert mode if an editable element "
|
"Whether to automatically enter insert mode if an editable element "
|
||||||
"is focused after page load."),
|
"is focused after page load."),
|
||||||
|
|
||||||
('forward_unbound_keys',
|
|
||||||
SettingValue(types.Bool(), "false"),
|
|
||||||
"Whether to forward unbound keys to the website in normal mode."),
|
|
||||||
)),
|
)),
|
||||||
|
|
||||||
('tabbar', sect.KeyValue(
|
('tabbar', sect.KeyValue(
|
||||||
|
@ -75,7 +75,6 @@ class ModeManager(QObject):
|
|||||||
_handlers: A dictionary of modes and their handlers.
|
_handlers: A dictionary of modes and their handlers.
|
||||||
_mode_stack: A list of the modes we're currently in, with the active
|
_mode_stack: A list of the modes we're currently in, with the active
|
||||||
one on the right.
|
one on the right.
|
||||||
_forward_unbound_keys: If we should forward unbound keys.
|
|
||||||
|
|
||||||
Signals:
|
Signals:
|
||||||
entered: Emitted when a mode is entered.
|
entered: Emitted when a mode is entered.
|
||||||
@ -94,8 +93,6 @@ class ModeManager(QObject):
|
|||||||
self._handlers = {}
|
self._handlers = {}
|
||||||
self.passthrough = []
|
self.passthrough = []
|
||||||
self._mode_stack = []
|
self._mode_stack = []
|
||||||
self._forward_unbound_keys = config.get('general',
|
|
||||||
'forward_unbound_keys')
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mode(self):
|
def mode(self):
|
||||||
@ -160,13 +157,6 @@ class ModeManager(QObject):
|
|||||||
raise ValueError("Can't leave normal mode!")
|
raise ValueError("Can't leave normal mode!")
|
||||||
self.leave(self.mode)
|
self.leave(self.mode)
|
||||||
|
|
||||||
@pyqtSlot(str, str)
|
|
||||||
def on_config_changed(self, section, option):
|
|
||||||
"""Update local setting when config changed."""
|
|
||||||
if (section, option) == ('general', 'forward_unbound_keys'):
|
|
||||||
self._forward_unbound_keys = config.get('general',
|
|
||||||
'forward_unbound_keys')
|
|
||||||
|
|
||||||
def eventFilter(self, obj, evt):
|
def eventFilter(self, obj, evt):
|
||||||
"""Filter all events based on the currently set mode.
|
"""Filter all events based on the currently set mode.
|
||||||
|
|
||||||
@ -213,17 +203,11 @@ class ModeManager(QObject):
|
|||||||
# KeyPress in a non-passthrough mode - call handler and filter
|
# KeyPress in a non-passthrough mode - call handler and filter
|
||||||
# event from widgets (unless unhandled and configured to pass
|
# event from widgets (unless unhandled and configured to pass
|
||||||
# unhandled events through)
|
# unhandled events through)
|
||||||
logging.debug("KeyPress, calling handler {}".format(handler))
|
logging.debug("KeyPress, calling handler {} and "
|
||||||
|
"filtering".format(handler))
|
||||||
self.key_pressed.emit(evt)
|
self.key_pressed.emit(evt)
|
||||||
handled = handler(evt) if handler is not None else False
|
handled = handler(evt) if handler is not None else False
|
||||||
logging.debug("handled: {}, forward_unbound_keys: {} -> "
|
return True
|
||||||
"filtering: {}".format(
|
|
||||||
handled, self._forward_unbound_keys,
|
|
||||||
handled or not self._forward_unbound_keys))
|
|
||||||
if handled or not self._forward_unbound_keys:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
else:
|
else:
|
||||||
# KeyRelease in a non-passthrough mode - filter event and
|
# KeyRelease in a non-passthrough mode - filter event and
|
||||||
# ignore it entirely.
|
# ignore it entirely.
|
||||||
|
Loading…
Reference in New Issue
Block a user