← Commit history

v1.6.35: fix ctypes handle truncation in focus-guard (guard was no-op'ing)

John Lauer ·4343ce623c ·3mo ago ·parent 1d40e24
5 files changed +29−8
BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.6.34\ No newline at end of file+1.6.35\ No newline at end of file
CHANGELOG.md+10
@@ -3,6 +3,16 @@ All notable changes to the Adom Desktop Fusion 360 bridge, newest first. Canonical: https://wiki.adom.inc/adom/adom-desktop-fusion-bridge · GitHub backup: `adom-inc/adom-desktop-fusion-bridge` +## 1.6.35 - 2026-07-06++- **Fixed the focus-guard doing NOTHING due to a ctypes handle-truncation bug** (the real reason+  1.6.33/1.6.34 still let windows steal focus, caught 2026-07-06). `user32.GetForegroundWindow()` was+  called with no `restype`, so ctypes defaulted the returned HWND to `c_int` and TRUNCATED it to 32+  bits on 64-bit Windows - `ShowWindowAsync` then got a garbage handle and silently no-op'd, so the+  guard never actually minimized anything and the user had to alt-tab back themselves. Now the guard+  sets proper `restype`/`argtypes` (HWND/DWORD/BOOL) so handles survive, and polls at 0.1s. Family+  windows that steal focus are now genuinely minimized within ~100ms.+ ## 1.6.34 - 2026-07-06  - **Focus-guard now covers the whole Autodesk launch FAMILY** (fix for the 1.6.33 guard, caught live).
adom-bridge-fusion-manifest.json+5−5
@@ -1,13 +1,13 @@ {   "manifest_version": 1,   "name": "fusion360",-  "version": "1.6.34",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-fusion-bridge/1.6.34/adom-bridge-fusion-v1.6.34.zip",-  "sha256": "da0ae88c943bab901db9509c800359459a20507baf6e469cbb2c287afafa3a5d",-  "size": 334972,+  "version": "1.6.35",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-fusion-bridge/1.6.35/adom-bridge-fusion-v1.6.35.zip",+  "sha256": "1c6c5e151b651dbb964e5b88e42bcca8ae2ab32f0daf2a8e6d15fe66b8817952",+  "size": 335516,   "verbPrefixes": [     "fusion_"   ],   "healthEndpoint": "/status",-  "released_at": "2026-07-06T11:20:43Z"+  "released_at": "2026-07-06T11:28:28Z" }
bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "fusion360",   "displayName": "Autodesk Fusion 360",-  "version": "1.6.34",+  "version": "1.6.35",   "description": "Drive Autodesk Fusion 360 from the cloud: launch Fusion, electronics board layout, design rules, exports (STEP/IGES/STL/3MF/USDZ/OBJ/DXF/DWG/Gerbers/BOM/CPL), fast APS server-indexed cloud search plus browse/recent/file-info/versions, cloud file download/upload and folder creation, and in-app parametric modeling (fusion_run_modeling_script). Never-charge: APS calls are capped to the free tier.",   "homepage": "https://wiki.adom.inc/adom/adom-desktop-fusion-bridge",   "author": "Adom Inc.",
fusion_detect.py+12−1
@@ -373,6 +373,17 @@ def _focus_guard(seconds: float = 150.0):     never raises."""     try:         user32 = ctypes.windll.user32+        # ⚠️ CRITICAL: set restype/argtypes or ctypes defaults every HANDLE to c_int+        # (32-bit) and TRUNCATES it on 64-bit Windows - GetForegroundWindow then hands+        # back a garbage HWND and ShowWindowAsync silently no-ops (the guard fires into+        # the void; the window is never minimized - the exact 1.6.34 failure, 2026-07-06).+        HWND = ctypes.wintypes.HWND+        user32.GetForegroundWindow.restype = HWND+        user32.GetForegroundWindow.argtypes = []+        user32.GetWindowThreadProcessId.argtypes = [HWND, ctypes.POINTER(ctypes.wintypes.DWORD)]+        user32.GetWindowThreadProcessId.restype = ctypes.wintypes.DWORD+        user32.ShowWindowAsync.argtypes = [HWND, ctypes.c_int]+        user32.ShowWindowAsync.restype = ctypes.wintypes.BOOL     except Exception:         return     end = time.time() + seconds@@ -393,7 +404,7 @@ def _focus_guard(seconds: float = 150.0):                     user32.ShowWindowAsync(fg, _SW_SHOWMINNOACTIVE)         except Exception:             pass-        time.sleep(0.15)+        time.sleep(0.1)   def _start_focus_guard(seconds: float = 120.0):