node-mac-recorder 2.16.22 โ 2.16.23
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
|
-
"Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''
|
|
4
|
+
"Bash(FORCE_AVFOUNDATION=1 node -e \"\nconsole.log(''๐งช Testing fixed window selector screen ID mapping...'');\nconst WindowSelector = require(''./window-selector.js'');\nconst selector = new WindowSelector();\n\nconst testResults = [];\n\nselector.checkPermissions().then(perms => {\n console.log(''โ
Permissions OK'');\n console.log('''');\n console.log(''๐ Expected Screen IDs from MacRecorder:'');\n console.log('' MacBook (Primary): ID=1, Position=(0,0)'');\n console.log('' External Display: ID=3, Position=(-3440,-56)'');\n console.log('''');\n \n return selector.startSelection();\n}).then(() => {\n console.log(''โ
Window selection started'');\n console.log(''๐ฏ Move cursor over windows on BOTH displays to see CGDirectDisplayID mapping logs'');\n console.log('''');\n \n setTimeout(() => {\n console.log(''โฐ Test complete - stopping window selection'');\n selector.stopSelection();\n }, 15000);\n \n}).catch(console.error);\")"
|
|
5
5
|
],
|
|
6
6
|
"deny": [],
|
|
7
7
|
"ask": []
|
package/package.json
CHANGED
package/src/window_selector.mm
CHANGED
|
@@ -2360,10 +2360,33 @@ Napi::Value GetSelectedWindowInfo(const Napi::CallbackInfo& info) {
|
|
|
2360
2360
|
windowScreen = mainScreen;
|
|
2361
2361
|
}
|
|
2362
2362
|
|
|
2363
|
-
// Add screen information
|
|
2363
|
+
// CRITICAL FIX: Add screen information using real CGDirectDisplayID
|
|
2364
2364
|
NSRect screenFrame = [windowScreen frame];
|
|
2365
|
-
|
|
2366
|
-
|
|
2365
|
+
|
|
2366
|
+
// Find real CGDirectDisplayID for this screen (matching GetDisplays logic)
|
|
2367
|
+
CGDirectDisplayID realDisplayID = 0;
|
|
2368
|
+
CGDirectDisplayID activeDisplays[32];
|
|
2369
|
+
uint32_t displayCount;
|
|
2370
|
+
CGGetActiveDisplayList(32, activeDisplays, &displayCount);
|
|
2371
|
+
|
|
2372
|
+
for (uint32_t j = 0; j < displayCount; j++) {
|
|
2373
|
+
CGDirectDisplayID candidateID = activeDisplays[j];
|
|
2374
|
+
CGRect displayBounds = CGDisplayBounds(candidateID);
|
|
2375
|
+
|
|
2376
|
+
if (fabs(screenFrame.origin.x - displayBounds.origin.x) < 1.0 &&
|
|
2377
|
+
fabs(screenFrame.origin.y - displayBounds.origin.y) < 1.0 &&
|
|
2378
|
+
fabs(screenFrame.size.width - displayBounds.size.width) < 1.0 &&
|
|
2379
|
+
fabs(screenFrame.size.height - displayBounds.size.height) < 1.0) {
|
|
2380
|
+
realDisplayID = candidateID;
|
|
2381
|
+
break;
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
NSLog(@"๐ Window screen mapping: Frame=(%.0f,%.0f,%.0fx%.0f) โ CGDirectDisplayID=%u",
|
|
2386
|
+
screenFrame.origin.x, screenFrame.origin.y,
|
|
2387
|
+
screenFrame.size.width, screenFrame.size.height, realDisplayID);
|
|
2388
|
+
|
|
2389
|
+
result.Set("screenId", Napi::Number::New(env, realDisplayID));
|
|
2367
2390
|
result.Set("screenX", Napi::Number::New(env, (int)screenFrame.origin.x));
|
|
2368
2391
|
result.Set("screenY", Napi::Number::New(env, (int)screenFrame.origin.y));
|
|
2369
2392
|
result.Set("screenWidth", Napi::Number::New(env, (int)screenFrame.size.width));
|