From 4d4aaf882e6814d2876357eda2028dc6cb33e62b Mon Sep 17 00:00:00 2001 From: AuroraWright Date: Wed, 24 Jan 2024 19:08:48 +0100 Subject: [PATCH] Work around quality code from Microsoft --- owocr/run.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/owocr/run.py b/owocr/run.py index cd6df9b..7b5e87b 100644 --- a/owocr/run.py +++ b/owocr/run.py @@ -36,12 +36,15 @@ class WindowsClipboardThread(threading.Thread): def __init__(self): super().__init__() self.daemon = True + self.last_update = time.time() def process_message(self, hwnd: int, msg: int, wparam: int, lparam: int): 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): clipboard_event.set() + self.last_update = timestamp return 0 def create_window(self):