From 73786bb927227e8c7484332c88837e6c1b170822 Mon Sep 17 00:00:00 2001 From: Hendrik R Date: Sun, 15 Jul 2018 14:31:03 +0200 Subject: 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) --- qutebrowser/mainwindow/mainwindow.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3-54-g00ecf