mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-03 09:24:55 +01:00
Also ignore OSErrors when reading lParam
This commit is contained in:
parent
46c0a57a25
commit
d2ec919155
1 changed files with 9 additions and 4 deletions
|
|
@ -1622,10 +1622,15 @@ def nativeEventFilter(self, eventType, message):
|
|||
msg = ctypes.wintypes.MSG.from_address(message.__int__())
|
||||
# https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-settingchange
|
||||
if msg.message == 0x001A and msg.lParam: # WM_SETTINGCHANGE
|
||||
if ctypes.wstring_at(msg.lParam) == 'ImmersiveColorSet':
|
||||
QApplication.instance().check_for_windows_palette_change()
|
||||
# prevent Qt from handling this event
|
||||
return True, 0
|
||||
try:
|
||||
s = ctypes.wstring_at(msg.lParam)
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
if s == 'ImmersiveColorSet':
|
||||
QApplication.instance().check_for_windows_palette_change()
|
||||
# prevent Qt from handling this event
|
||||
return True, 0
|
||||
return False, 0
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue