Don't filter events if mainwindow is not focused
This commit is contained in:
parent
19af445da0
commit
68b134b4a9
2
TODO
2
TODO
@ -11,8 +11,6 @@ Before 0.1
|
|||||||
- Autosave feature (against segfaults/...)
|
- Autosave feature (against segfaults/...)
|
||||||
- Save tabs feature
|
- Save tabs feature
|
||||||
- More dwb keybindings
|
- More dwb keybindings
|
||||||
- Filter events in QMainWindow, not QApplication
|
|
||||||
or at least release them when opening other windows, e.g. print dialog
|
|
||||||
- Use :open engine searchterm syntax for searching
|
- Use :open engine searchterm syntax for searching
|
||||||
|
|
||||||
Crashes
|
Crashes
|
||||||
|
@ -135,6 +135,7 @@ class QuteBrowser(QApplication):
|
|||||||
self._init_cmds()
|
self._init_cmds()
|
||||||
self.mainwindow = MainWindow()
|
self.mainwindow = MainWindow()
|
||||||
|
|
||||||
|
self.modeman.mainwindow = self.mainwindow
|
||||||
self.installEventFilter(self.modeman)
|
self.installEventFilter(self.modeman)
|
||||||
self.setQuitOnLastWindowClosed(False)
|
self.setQuitOnLastWindowClosed(False)
|
||||||
|
|
||||||
@ -399,13 +400,6 @@ class QuteBrowser(QApplication):
|
|||||||
|
|
||||||
self._quit_status['crash'] = False
|
self._quit_status['crash'] = False
|
||||||
|
|
||||||
# Give key input back for crash dialog
|
|
||||||
try:
|
|
||||||
self.removeEventFilter(self.modeman)
|
|
||||||
except AttributeError:
|
|
||||||
# self.modeman could be None
|
|
||||||
pass
|
|
||||||
|
|
||||||
if exctype is BdbQuit or not issubclass(exctype, Exception):
|
if exctype is BdbQuit or not issubclass(exctype, Exception):
|
||||||
# pdb exit, KeyboardInterrupt, ...
|
# pdb exit, KeyboardInterrupt, ...
|
||||||
try:
|
try:
|
||||||
|
@ -62,6 +62,7 @@ class ModeManager(QObject):
|
|||||||
Attributes:
|
Attributes:
|
||||||
mode: The current mode (readonly property).
|
mode: The current mode (readonly property).
|
||||||
passthrough: A list of modes in which to pass through events.
|
passthrough: A list of modes in which to pass through events.
|
||||||
|
mainwindow: The mainwindow object
|
||||||
_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.
|
||||||
@ -84,6 +85,7 @@ class ModeManager(QObject):
|
|||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
self.mainwindow = None
|
||||||
self._handlers = {}
|
self._handlers = {}
|
||||||
self.passthrough = []
|
self.passthrough = []
|
||||||
self._mode_stack = []
|
self._mode_stack = []
|
||||||
@ -248,7 +250,10 @@ class ModeManager(QObject):
|
|||||||
logging.debug("Ignoring event {} for {}".format(
|
logging.debug("Ignoring event {} for {}".format(
|
||||||
debug.EVENTS[typ], obj.__class__.__name__))
|
debug.EVENTS[typ], obj.__class__.__name__))
|
||||||
return False
|
return False
|
||||||
|
if QApplication.instance().activeWindow() is not self.mainwindow:
|
||||||
|
# Some other window (print dialog, etc.) is focused so we pass
|
||||||
|
# the event through.
|
||||||
|
return False
|
||||||
logging.debug("Got event {} for {} in mode {}".format(
|
logging.debug("Got event {} for {} in mode {}".format(
|
||||||
debug.EVENTS[typ], obj.__class__.__name__, self.mode))
|
debug.EVENTS[typ], obj.__class__.__name__, self.mode))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user