mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Windows: Fix an issue where closing a maximized calibre window to the system tray and then reconnecting with remote desktop would cause a blank calibre window to be displayed. Fixes #2044118 [Issue with "--start-in-tray" switch and MS RDP](https://bugs.launchpad.net/calibre/+bug/2044118)
Hopefully the workaround for the Qt bug wont break anything else. https://bugreports.qt.io/browse/QTBUG-124177
This commit is contained in:
parent
d0ef679928
commit
01c21f4288
@ -19,7 +19,7 @@ from collections import OrderedDict, deque
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
import apsw
|
import apsw
|
||||||
from qt.core import QAction, QApplication, QDialog, QFont, QIcon, QMenu, QSystemTrayIcon, Qt, QTimer, QUrl, pyqtSignal
|
from qt.core import QAction, QApplication, QDialog, QEvent, QFont, QIcon, QMenu, QSystemTrayIcon, Qt, QTimer, QUrl, pyqtSignal
|
||||||
|
|
||||||
from calibre import detect_ncpus, force_unicode, prints
|
from calibre import detect_ncpus, force_unicode, prints
|
||||||
from calibre.constants import DEBUG, __appname__, config_dir, filesystem_encoding, ismacos, iswindows
|
from calibre.constants import DEBUG, __appname__, config_dir, filesystem_encoding, ismacos, iswindows
|
||||||
@ -613,6 +613,17 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
|
|||||||
setattr(window, '__systray_minimized', False)
|
setattr(window, '__systray_minimized', False)
|
||||||
self.update_toggle_to_tray_action()
|
self.update_toggle_to_tray_action()
|
||||||
|
|
||||||
|
def changeEvent(self, ev):
|
||||||
|
# Handle bug in Qt 6 that causes the window to be shown as blank if it was first
|
||||||
|
# maximized and then closed to system tray, when remote desktop is
|
||||||
|
# reconnected: https://bugreports.qt.io/browse/QTBUG-124177
|
||||||
|
if (
|
||||||
|
iswindows and ev.type() == QEvent.Type.ActivationChange and self.is_minimized_to_tray and self.isMaximized() and
|
||||||
|
self.isActiveWindow() and not self.isVisible()
|
||||||
|
):
|
||||||
|
QTimer.singleShot(0, self.show_windows)
|
||||||
|
return super().changeEvent(ev)
|
||||||
|
|
||||||
def test_server(self, *args):
|
def test_server(self, *args):
|
||||||
if self.content_server is not None and \
|
if self.content_server is not None and \
|
||||||
self.content_server.exception is not None:
|
self.content_server.exception is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user