autoxkit 2.4.2__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.
- {autoxkit-2.4.2 → autoxkit-2.4.4}/PKG-INFO +1 -1
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/hook/hook_listener.py +41 -16
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit.egg-info/PKG-INFO +1 -1
- {autoxkit-2.4.2 → autoxkit-2.4.4}/pyproject.toml +1 -1
- {autoxkit-2.4.2 → autoxkit-2.4.4}/LICENSE.txt +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/README.md +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/__init__.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/android/__init__.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/android/adb.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/android/binary.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/android/client.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/android/control.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/android/control_backup.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/android/models.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/android/streams.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/constants.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/hook/__init__.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/hook/event.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/hook/hotkey_listener.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/match/__init__.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/match/match.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/mousekey/__init__.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/mousekey/input.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/mousekey/keyboard.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/mousekey/mouse.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/utils.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/window/__init__.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/window/window.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/window/window_action.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit/window/window_match.py +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit.egg-info/SOURCES.txt +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit.egg-info/dependency_links.txt +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit.egg-info/requires.txt +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/autoxkit.egg-info/top_level.txt +0 -0
- {autoxkit-2.4.2 → autoxkit-2.4.4}/setup.cfg +0 -0
|
@@ -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:
|
|
@@ -232,24 +236,51 @@ class HookListener:
|
|
|
232
236
|
elif wParam == HHC["MWheel"]:
|
|
233
237
|
delta = ctypes.c_short(ms.mouseData >> 16).value / 120
|
|
234
238
|
if delta > 0:
|
|
239
|
+
blocked = False
|
|
240
|
+
event = MouseEvent("MouseDown", "MUWheel", x, y, distance=delta)
|
|
241
|
+
for cb in self._on_mousedown:
|
|
242
|
+
try:
|
|
243
|
+
result = cb(event)
|
|
244
|
+
if result is True:
|
|
245
|
+
blocked = True
|
|
246
|
+
except Exception as e:
|
|
247
|
+
print(f"[hook_listener] Exception in mousedown callback: {e}", file=__import__("sys").stderr)
|
|
248
|
+
|
|
235
249
|
event = MouseEvent("MouseUp", "MUWheel", x, y, distance=delta)
|
|
236
250
|
for cb in self._on_mouseup:
|
|
237
251
|
try:
|
|
238
252
|
result = cb(event)
|
|
239
253
|
if result is True:
|
|
240
|
-
|
|
254
|
+
blocked = True
|
|
241
255
|
except Exception as e:
|
|
242
256
|
print(f"[hook_listener] Exception in mouseup callback: {e}", file=__import__("sys").stderr)
|
|
257
|
+
|
|
258
|
+
if blocked:
|
|
259
|
+
return 1 # 截断事件传播
|
|
260
|
+
|
|
243
261
|
elif delta < 0:
|
|
262
|
+
blocked = False
|
|
244
263
|
event = MouseEvent("MouseDown", "MDWheel", x, y, distance=delta)
|
|
245
264
|
for cb in self._on_mousedown:
|
|
246
265
|
try:
|
|
247
266
|
result = cb(event)
|
|
248
267
|
if result is True:
|
|
249
|
-
|
|
268
|
+
blocked = True
|
|
250
269
|
except Exception as e:
|
|
251
270
|
print(f"[hook_listener] Exception in mousedown callback: {e}", file=__import__("sys").stderr)
|
|
252
271
|
|
|
272
|
+
event = MouseEvent("MouseUp", "MDWheel", x, y, distance=delta)
|
|
273
|
+
for cb in self._on_mouseup:
|
|
274
|
+
try:
|
|
275
|
+
result = cb(event)
|
|
276
|
+
if result is True:
|
|
277
|
+
blocked = True
|
|
278
|
+
except Exception as e:
|
|
279
|
+
print(f"[hook_listener] Exception in mouseup callback: {e}", file=__import__("sys").stderr)
|
|
280
|
+
|
|
281
|
+
if blocked:
|
|
282
|
+
return 1 # 截断事件传播
|
|
283
|
+
|
|
253
284
|
except Exception as e:
|
|
254
285
|
print(f"[hook_listener] Exception in _mouse_proc: {e}", file=__import__("sys").stderr)
|
|
255
286
|
|
|
@@ -282,8 +313,9 @@ class HookListener:
|
|
|
282
313
|
# 停止监听并取消钩子
|
|
283
314
|
def stop(self):
|
|
284
315
|
self._stop_event.set()
|
|
285
|
-
#
|
|
316
|
+
# 发送 WM_QUIT 消息唤醒 GetMessageW 阻塞
|
|
286
317
|
if self._thread and self._thread.is_alive():
|
|
318
|
+
user32.PostThreadMessageW(self._thread.ident, 0x0012, 0, 0)
|
|
287
319
|
self._thread.join(timeout=1.0)
|
|
288
320
|
# 尝试取消钩子(若尚未取消)
|
|
289
321
|
if self.keyboard_hook:
|
|
@@ -315,19 +347,12 @@ class HookListener:
|
|
|
315
347
|
return
|
|
316
348
|
|
|
317
349
|
msg = wintypes.MSG()
|
|
318
|
-
while
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
else:
|
|
325
|
-
# 无消息时休眠,避免 CPU 忙等
|
|
326
|
-
time.sleep(MSG_POLL_INTERVAL)
|
|
327
|
-
except Exception:
|
|
328
|
-
# 记录异常但不退出循环,确保钩子持续工作
|
|
329
|
-
print("[hook_listener] Exception in message pump", file=__import__('sys').stderr)
|
|
330
|
-
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))
|
|
331
356
|
|
|
332
357
|
# 离开循环之前确保取消钩子
|
|
333
358
|
if self.keyboard_hook:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "autoxkit"
|
|
7
|
-
version = "2.4.
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|