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 <noreply@anthropic.com>
This commit is contained in:
parent
f19d883a69
commit
8f077868cc
15
main.js
15
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':
|
||||
|
||||
@ -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": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user