diff options
author | Florian Bruhin <git@the-compiler.org> | 2015-04-09 19:51:50 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2015-04-09 19:59:16 +0200 |
commit | f77ba5744b4d08b7dff34b1f7d3a9886f3a69bb9 (patch) | |
tree | 1aa218b3fc530ef31915a6b7a627b186fdd9c5f5 /qutebrowser/keyinput/modeman.py | |
parent | 7160a89cb91ff6965861ca085e9a39a63f5dcb9c (diff) | |
download | qutebrowser-f77ba5744b4d08b7dff34b1f7d3a9886f3a69bb9.tar.gz qutebrowser-f77ba5744b4d08b7dff34b1f7d3a9886f3a69bb9.zip |
Add a ui -> hide-mouse-cursor option.
Diffstat (limited to 'qutebrowser/keyinput/modeman.py')
-rw-r--r-- | qutebrowser/keyinput/modeman.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index 4699de8e9..00c0a4d73 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -131,9 +131,20 @@ class EventFilter(QObject): def eventFilter(self, obj, event): """Forward events to the correct modeman.""" try: + qapp = QApplication.instance() if not self._activated: return False - if event.type() not in [QEvent.KeyPress, QEvent.KeyRelease]: + if event.type() in [QEvent.MouseButtonDblClick, + QEvent.MouseButtonPress, + QEvent.MouseButtonRelease, + QEvent.MouseMove]: + if qapp.overrideCursor() is None: + # Mouse cursor shown -> don't filter event + return False + else: + # Mouse cursor hidden -> filter event + return True + elif event.type() not in [QEvent.KeyPress, QEvent.KeyRelease]: # We're not interested in non-key-events so we pass them # through. return False @@ -141,8 +152,7 @@ class EventFilter(QObject): # We already handled this same event at some point earlier, so # we're not interested in it anymore. return False - if (QApplication.instance().activeWindow() not in - objreg.window_registry.values()): + if qapp.activeWindow() not in objreg.window_registry.values(): # Some other window (print dialog, etc.) is focused so we pass # the event through. return False |