autoxkit 2.4.3__tar.gz → 2.4.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {autoxkit-2.4.3 → autoxkit-2.4.4}/PKG-INFO +1 -1
  2. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/hook/hook_listener.py +12 -14
  3. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit.egg-info/PKG-INFO +1 -1
  4. {autoxkit-2.4.3 → autoxkit-2.4.4}/pyproject.toml +1 -1
  5. {autoxkit-2.4.3 → autoxkit-2.4.4}/LICENSE.txt +0 -0
  6. {autoxkit-2.4.3 → autoxkit-2.4.4}/README.md +0 -0
  7. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/__init__.py +0 -0
  8. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/android/__init__.py +0 -0
  9. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/android/adb.py +0 -0
  10. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/android/binary.py +0 -0
  11. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/android/client.py +0 -0
  12. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/android/control.py +0 -0
  13. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/android/control_backup.py +0 -0
  14. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/android/models.py +0 -0
  15. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/android/streams.py +0 -0
  16. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/constants.py +0 -0
  17. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/hook/__init__.py +0 -0
  18. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/hook/event.py +0 -0
  19. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/hook/hotkey_listener.py +0 -0
  20. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/match/__init__.py +0 -0
  21. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/match/match.py +0 -0
  22. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/mousekey/__init__.py +0 -0
  23. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/mousekey/input.py +0 -0
  24. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/mousekey/keyboard.py +0 -0
  25. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/mousekey/mouse.py +0 -0
  26. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/utils.py +0 -0
  27. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/window/__init__.py +0 -0
  28. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/window/window.py +0 -0
  29. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/window/window_action.py +0 -0
  30. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit/window/window_match.py +0 -0
  31. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit.egg-info/SOURCES.txt +0 -0
  32. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit.egg-info/dependency_links.txt +0 -0
  33. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit.egg-info/requires.txt +0 -0
  34. {autoxkit-2.4.3 → autoxkit-2.4.4}/autoxkit.egg-info/top_level.txt +0 -0
  35. {autoxkit-2.4.3 → autoxkit-2.4.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autoxkit
3
- Version: 2.4.3
3
+ Version: 2.4.4
4
4
  Summary: Python library for Windows automation and Android device screen casting and control
5
5
  Author-email: YorickFin <1582456060@qq.com>
6
6
  License: GPL-3.0-or-later
@@ -64,6 +64,10 @@ user32.TranslateMessage.argtypes = [POINTER(wintypes.MSG)]
64
64
  user32.TranslateMessage.restype = wintypes.BOOL
65
65
  user32.DispatchMessageW.argtypes = [POINTER(wintypes.MSG)]
66
66
  user32.DispatchMessageW.restype = ctypes.c_long
67
+ user32.GetMessageW.argtypes = [POINTER(wintypes.MSG), wintypes.HWND, wintypes.UINT, wintypes.UINT]
68
+ user32.GetMessageW.restype = wintypes.BOOL
69
+ user32.PostThreadMessageW.argtypes = [wintypes.DWORD, wintypes.UINT, wintypes.WPARAM, wintypes.LPARAM]
70
+ user32.PostThreadMessageW.restype = wintypes.BOOL
67
71
 
68
72
  # ---------- HookListener 类 ----------
69
73
  class HookListener:
@@ -309,8 +313,9 @@ class HookListener:
309
313
  # 停止监听并取消钩子
310
314
  def stop(self):
311
315
  self._stop_event.set()
312
- # 等待线程退出并且取消钩子
316
+ # 发送 WM_QUIT 消息唤醒 GetMessageW 阻塞
313
317
  if self._thread and self._thread.is_alive():
318
+ user32.PostThreadMessageW(self._thread.ident, 0x0012, 0, 0)
314
319
  self._thread.join(timeout=1.0)
315
320
  # 尝试取消钩子(若尚未取消)
316
321
  if self.keyboard_hook:
@@ -342,19 +347,12 @@ class HookListener:
342
347
  return
343
348
 
344
349
  msg = wintypes.MSG()
345
- while not self._stop_event.is_set():
346
- try:
347
- # 使用 PeekMessageW 配合超时,以便可以检查 _stop_event
348
- if user32.PeekMessageW(byref(msg), 0, 0, 0, 1): # PM_REMOVE = 1
349
- user32.TranslateMessage(byref(msg))
350
- user32.DispatchMessageW(byref(msg))
351
- else:
352
- # 无消息时休眠,避免 CPU 忙等
353
- time.sleep(MSG_POLL_INTERVAL)
354
- except Exception:
355
- # 记录异常但不退出循环,确保钩子持续工作
356
- print("[hook_listener] Exception in message pump", file=__import__('sys').stderr)
357
- continue
350
+ while True:
351
+ ret = user32.GetMessageW(byref(msg), 0, 0, 0)
352
+ if ret <= 0:
353
+ break
354
+ user32.TranslateMessage(byref(msg))
355
+ user32.DispatchMessageW(byref(msg))
358
356
 
359
357
  # 离开循环之前确保取消钩子
360
358
  if self.keyboard_hook:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autoxkit
3
- Version: 2.4.3
3
+ Version: 2.4.4
4
4
  Summary: Python library for Windows automation and Android device screen casting and control
5
5
  Author-email: YorickFin <1582456060@qq.com>
6
6
  License: GPL-3.0-or-later
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "autoxkit"
7
- version = "2.4.3"
7
+ version = "2.4.4"
8
8
  description = "Python library for Windows automation and Android device screen casting and control"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes