diff options
author | Hendrik R <hendrikr_10@yahoo.de> | 2018-07-15 14:31:03 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2018-08-15 10:33:16 +0200 |
commit | 73786bb927227e8c7484332c88837e6c1b170822 (patch) | |
tree | ed40a12c7d1b5c1b8cd24c3ee74b535d9046fdc7 | |
parent | 75d153d6d84ec39fc51bc55f8c029e4e95870403 (diff) | |
download | qutebrowser-73786bb927227e8c7484332c88837e6c1b170822.tar.gz qutebrowser-73786bb927227e8c7484332c88837e6c1b170822.zip |
Process all events before issuing an alert
Fixes #2603
The call to processEvents fixes an apparent race condition with some window
managers, e.g. i3. QT seems to be thinking, that the window is not marked as
urgent and toggles it twice, so synchronizing before issuing the alert makes QT
behave correctly.
This change should not change the behaviour on other systems only correct the
fault reported in #2603.
(cherry picked from commit b1a060fb717865c338af5b4f5063bfb31e8ef74f)
-rw-r--r-- | qutebrowser/mainwindow/mainwindow.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 4cfee7eff..b95de54fc 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -24,7 +24,8 @@ import base64 import itertools import functools -from PyQt5.QtCore import pyqtSlot, QRect, QPoint, QTimer, Qt +from PyQt5.QtCore import (pyqtSlot, QRect, QPoint, QTimer, Qt, + QCoreApplication, QEventLoop) from PyQt5.QtWidgets import QWidget, QVBoxLayout, QApplication, QSizePolicy from qutebrowser.commands import runners, cmdutils @@ -98,6 +99,8 @@ def raise_window(window, alert=True): window.setWindowState(window.windowState() & ~Qt.WindowMinimized) window.setWindowState(window.windowState() | Qt.WindowActive) window.raise_() + QCoreApplication.processEvents( + QEventLoop.ExcludeUserInputEvents | QEventLoop.ExcludeSocketNotifiers) window.activateWindow() if alert: |