From 8f077868cc5a34207ff473a18357cad67a2e76a3 Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 12 Mar 2026 09:00:18 +0100 Subject: [PATCH] fix: account for invisible DWM frame borders in click mapping Windows 10/11 getBounds() includes ~7px invisible resize borders that are not included in the window capture, causing click offset. Co-Authored-By: Claude Opus 4.6 --- main.js | 15 ++++++++++----- package.json | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index bb5892e..8334ee8 100644 --- a/main.js +++ b/main.js @@ -1023,13 +1023,18 @@ ipcMain.on('remote:input-event', (_event, data) => { if (!remote || !remote.allowInput) return; if (data.role !== 'admin') return; - // Capture includes window frame (title bar), but sendInputEvent is relative to content area + // Capture includes window frame (title bar) but NOT invisible DWM borders + // sendInputEvent coordinates are relative to web content area const winBounds = mainWindow.getBounds(); const contentBounds = mainWindow.getContentBounds(); - const frameLeft = contentBounds.x - winBounds.x; - const titleBarHeight = contentBounds.y - winBounds.y; - const x = Math.round((data.x || 0) * winBounds.width - frameLeft); - const y = Math.round((data.y || 0) * winBounds.height - titleBarHeight); + // Windows 10/11: getBounds() includes ~7px invisible resize borders not in capture + const dwm = process.platform === 'win32' ? 7 : 0; + const capturedW = winBounds.width - 2 * dwm; + const capturedH = winBounds.height - dwm; // only bottom has invisible border + const contentOffsetX = contentBounds.x - (winBounds.x + dwm); + const contentOffsetY = contentBounds.y - winBounds.y; + const x = Math.round((data.x || 0) * capturedW - contentOffsetX); + const y = Math.round((data.y || 0) * capturedH - contentOffsetY); switch (data.type) { case 'mousemove': diff --git a/package.json b/package.json index 6d2b15b..f6f53d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "multi-hoster-uploader", - "version": "2.1.8", + "version": "2.1.9", "description": "Upload files to doodstream, voe, vidmoly, byse simultaneously", "main": "main.js", "scripts": {