Work around quality code from Microsoft

This commit is contained in:
AuroraWright
2024-01-24 19:08:48 +01:00
parent a7282fc9b5
commit 4d4aaf882e

View File

@@ -36,12 +36,15 @@ class WindowsClipboardThread(threading.Thread):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.daemon = True self.daemon = True
self.last_update = time.time()
def process_message(self, hwnd: int, msg: int, wparam: int, lparam: int): def process_message(self, hwnd: int, msg: int, wparam: int, lparam: int):
WM_CLIPBOARDUPDATE = 0x031D WM_CLIPBOARDUPDATE = 0x031D
if msg == WM_CLIPBOARDUPDATE and not (paused or tmp_paused): timestamp = time.time()
if msg == WM_CLIPBOARDUPDATE and timestamp - self.last_update > 1 and not (paused or tmp_paused):
if win32clipboard.IsClipboardFormatAvailable(win32con.CF_BITMAP): if win32clipboard.IsClipboardFormatAvailable(win32con.CF_BITMAP):
clipboard_event.set() clipboard_event.set()
self.last_update = timestamp
return 0 return 0
def create_window(self): def create_window(self):