clickbank: never target a degenerate window (the 0x0 Plasma window ate all 144 clicks)

The picker matched any visible window whose title contains the substring and
took windows[0] -- which for a live game is 'BattleTech - Plasma', a 0x0-client
window.  Every posted click landed in it: 144 clicks, zero dispatches, and what
looked exactly like the click/render alignment regression being checked for.
Windows with a client smaller than 50x50 are skipped now; verified by re-running
the full 72-button pass with the broad 'BattleTech' title straight through to
72/72 dispatches.

(Found during the post-merge alignment regression check: boot geometry, a
mid-session resize to an odd 1120x640 letterbox, and a minimize/restore cycle --
72/72 dispatched in every round, 288 clicks total, zero Gitea #56 tripwire
lines.  The merge did NOT regress click-vs-render alignment.)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-26 14:51:21 -05:00
co-authored by Claude Opus 5
parent 8edce41f88
commit ab91b5e7c1
+9 -1
View File
@@ -60,7 +60,15 @@ def find_windows(substring):
buffer = ctypes.create_unicode_buffer(length + 1)
user32.GetWindowTextW(hwnd, buffer, length + 1)
if substring.lower() in buffer.value.lower() and user32.IsWindowVisible(hwnd):
found.append((hwnd, buffer.value))
# Skip zero/degenerate clients: the game also owns a
# "BattleTech - Plasma" window with a 0x0 client, and taking
# windows[0] blindly posted every click into it -- 144 clicks,
# zero dispatches, and a scary-looking false regression
# (2026-07-26). A window you cannot click in is not a target.
r = RECT()
user32.GetClientRect(hwnd, ctypes.byref(r))
if r.right > 50 and r.bottom > 50:
found.append((hwnd, buffer.value))
return True
user32.EnumWindows(callback, 0)