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.
This commit is contained in:
parent
d1a25b6c3f
commit
b1a060fb71
@ -24,7 +24,8 @@ import base64
|
|||||||
import itertools
|
import itertools
|
||||||
import functools
|
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 PyQt5.QtWidgets import QWidget, QVBoxLayout, QApplication, QSizePolicy
|
||||||
|
|
||||||
from qutebrowser.commands import runners, cmdutils
|
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.WindowMinimized)
|
||||||
window.setWindowState(window.windowState() | Qt.WindowActive)
|
window.setWindowState(window.windowState() | Qt.WindowActive)
|
||||||
window.raise_()
|
window.raise_()
|
||||||
|
QCoreApplication.processEvents(
|
||||||
|
QEventLoop.ExcludeUserInputEvents | QEventLoop.ExcludeSocketNotifiers)
|
||||||
window.activateWindow()
|
window.activateWindow()
|
||||||
|
|
||||||
if alert:
|
if alert:
|
||||||
|
Loading…
Reference in New Issue
Block a user