node-mac-recorder 2.15.10 โ 2.15.11
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.
- package/debug-primary-window.js +84 -0
- package/final-multi-display-test.js +74 -0
- package/package.json +1 -1
- package/publish.sh +90 -0
- package/simulate-primary-window.js +56 -0
- package/src/window_selector.mm +29 -4
- package/test-coordinate-debug.js +25 -0
- package/test-final-coordinate-fix.js +38 -0
- package/test-primary-live.js +17 -0
- package/test-primary-window-debug.js +33 -0
- package/validate-primary-fix.js +58 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const MacRecorder = require('./index');
|
|
2
|
+
const WindowSelector = MacRecorder.WindowSelector;
|
|
3
|
+
|
|
4
|
+
async function debugPrimaryDisplay() {
|
|
5
|
+
console.log('๐ Debugging primary display window selector...');
|
|
6
|
+
|
|
7
|
+
const recorder = new MacRecorder();
|
|
8
|
+
const displays = await recorder.getDisplays();
|
|
9
|
+
|
|
10
|
+
console.log('๐ Display analysis:');
|
|
11
|
+
displays.forEach(display => {
|
|
12
|
+
console.log(`${display.name}: (${display.x}, ${display.y}) ${display.width}x${display.height} ${display.isPrimary ? '[PRIMARY]' : '[SECONDARY]'}`);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Calculate combined frame like in native code
|
|
16
|
+
const primary = displays.find(d => d.isPrimary);
|
|
17
|
+
const secondary = displays.find(d => !d.isPrimary);
|
|
18
|
+
|
|
19
|
+
console.log('\n๐งฎ Coordinate calculations:');
|
|
20
|
+
console.log(`Primary: (${primary.x}, ${primary.y})`);
|
|
21
|
+
console.log(`Secondary: (${secondary.x}, ${secondary.y})`);
|
|
22
|
+
|
|
23
|
+
// Combined frame calculation
|
|
24
|
+
const minX = Math.min(primary.x, secondary.x);
|
|
25
|
+
const minY = Math.min(primary.y, secondary.y);
|
|
26
|
+
const maxX = Math.max(primary.x + primary.width, secondary.x + secondary.width);
|
|
27
|
+
const maxY = Math.max(primary.y + primary.height, secondary.y + secondary.height);
|
|
28
|
+
|
|
29
|
+
const combinedFrame = {
|
|
30
|
+
x: minX,
|
|
31
|
+
y: minY,
|
|
32
|
+
width: maxX - minX,
|
|
33
|
+
height: maxY - minY
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
console.log(`Combined frame: (${combinedFrame.x}, ${combinedFrame.y}) ${combinedFrame.width}x${combinedFrame.height}`);
|
|
37
|
+
|
|
38
|
+
// Test coordinate conversion for a primary display window
|
|
39
|
+
const testPrimaryWindowX = 100; // Window at (100, 100) on primary
|
|
40
|
+
const testPrimaryWindowY = 100;
|
|
41
|
+
|
|
42
|
+
const localX = testPrimaryWindowX - combinedFrame.x;
|
|
43
|
+
const localY = testPrimaryWindowY - combinedFrame.y;
|
|
44
|
+
|
|
45
|
+
console.log(`\n๐ฏ Primary window test:`);
|
|
46
|
+
console.log(`Global window: (${testPrimaryWindowX}, ${testPrimaryWindowY})`);
|
|
47
|
+
console.log(`Combined origin: (${combinedFrame.x}, ${combinedFrame.y})`);
|
|
48
|
+
console.log(`Local coordinates: (${localX}, ${localY})`);
|
|
49
|
+
console.log(`Combined height: ${combinedFrame.height}`);
|
|
50
|
+
console.log(`Converted Y: ${combinedFrame.height - localY - 200}`); // Assuming 200px window height
|
|
51
|
+
|
|
52
|
+
// Test for secondary display window
|
|
53
|
+
const testSecondaryWindowX = secondary.x + 100;
|
|
54
|
+
const testSecondaryWindowY = secondary.y + 100;
|
|
55
|
+
|
|
56
|
+
const localSecondaryX = testSecondaryWindowX - combinedFrame.x;
|
|
57
|
+
const localSecondaryY = testSecondaryWindowY - combinedFrame.y;
|
|
58
|
+
|
|
59
|
+
console.log(`\n๐ฏ Secondary window test:`);
|
|
60
|
+
console.log(`Global window: (${testSecondaryWindowX}, ${testSecondaryWindowY})`);
|
|
61
|
+
console.log(`Local coordinates: (${localSecondaryX}, ${localSecondaryY})`);
|
|
62
|
+
console.log(`Converted Y: ${combinedFrame.height - localSecondaryY - 200}`);
|
|
63
|
+
|
|
64
|
+
console.log('\n๐งช Starting actual window selection test...');
|
|
65
|
+
console.log(' - Move cursor to primary display windows');
|
|
66
|
+
console.log(' - Check if buttons appear');
|
|
67
|
+
console.log(' - Check console logs for coordinate calculations');
|
|
68
|
+
|
|
69
|
+
const selector = new WindowSelector();
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
await selector.startSelection();
|
|
73
|
+
|
|
74
|
+
// Let it run for 15 seconds for debugging
|
|
75
|
+
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
76
|
+
|
|
77
|
+
await selector.stopSelection();
|
|
78
|
+
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.log(`โ Test failed: ${error.message}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
debugPrimaryDisplay();
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const MacRecorder = require('./index');
|
|
2
|
+
const WindowSelector = MacRecorder.WindowSelector;
|
|
3
|
+
|
|
4
|
+
async function finalMultiDisplayTest() {
|
|
5
|
+
console.log('๐ FINAL Multi-Display Test');
|
|
6
|
+
console.log('='.repeat(40));
|
|
7
|
+
|
|
8
|
+
const recorder = new MacRecorder();
|
|
9
|
+
const displays = await recorder.getDisplays();
|
|
10
|
+
|
|
11
|
+
console.log('๐ Display Configuration:');
|
|
12
|
+
displays.forEach(display => {
|
|
13
|
+
console.log(` ${display.name}: (${display.x}, ${display.y}) ${display.width}x${display.height} ${display.isPrimary ? '[PRIMARY]' : ''}`);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
console.log('\nโ
All coordinate fixes applied:');
|
|
17
|
+
console.log(' - Screen selector: Local coordinates for UI elements');
|
|
18
|
+
console.log(' - Window selector: Primary/secondary coordinate handling');
|
|
19
|
+
console.log(' - Display recording: Correct display ID mapping');
|
|
20
|
+
|
|
21
|
+
console.log('\n๐งช Testing window selector...');
|
|
22
|
+
console.log('๐ IMPORTANT: Test windows on BOTH displays');
|
|
23
|
+
console.log(' - Primary display: Should show buttons/UI correctly now');
|
|
24
|
+
console.log(' - Secondary display: Should continue working');
|
|
25
|
+
|
|
26
|
+
const selector = new WindowSelector();
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
await selector.startSelection();
|
|
30
|
+
|
|
31
|
+
console.log('\nโฑ๏ธ Running for 30 seconds - test both displays thoroughly...');
|
|
32
|
+
await new Promise(resolve => setTimeout(resolve, 30000));
|
|
33
|
+
|
|
34
|
+
await selector.stopSelection();
|
|
35
|
+
|
|
36
|
+
console.log('โ
Window selector test completed!');
|
|
37
|
+
|
|
38
|
+
// Test recording on both displays
|
|
39
|
+
console.log('\n๐ฅ Testing recording on both displays...');
|
|
40
|
+
|
|
41
|
+
for (const display of displays) {
|
|
42
|
+
console.log(`\n๐น Testing ${display.name} recording...`);
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const outputPath = `./test-output/final-test-${display.id}.mov`;
|
|
46
|
+
|
|
47
|
+
await recorder.startRecording(outputPath, {
|
|
48
|
+
displayId: display.id,
|
|
49
|
+
captureCursor: true,
|
|
50
|
+
includeMicrophone: false,
|
|
51
|
+
includeSystemAudio: false
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
console.log(`โ
Recording started on ${display.name}`);
|
|
55
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
56
|
+
|
|
57
|
+
await recorder.stopRecording();
|
|
58
|
+
console.log(`โ
Recording completed on ${display.name}`);
|
|
59
|
+
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.log(`โ Recording failed on ${display.name}: ${error.message}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log('\n๐ ALL MULTI-DISPLAY TESTS COMPLETED!');
|
|
66
|
+
console.log('โ
Window selector should now work on both displays');
|
|
67
|
+
console.log('โ
Recording should work on both displays');
|
|
68
|
+
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.log(`โ Test failed: ${error.message}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
finalMultiDisplayTest();
|
package/package.json
CHANGED
package/publish.sh
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Publish script for node-mac-recorder
|
|
4
|
+
# Usage: ./publish.sh <patch|minor|major> "commit message"
|
|
5
|
+
|
|
6
|
+
# Check if correct number of arguments provided
|
|
7
|
+
if [ $# -ne 2 ]; then
|
|
8
|
+
echo "โ Usage: $0 <patch|minor|major> \"commit message\""
|
|
9
|
+
echo " Example: $0 patch \"Fix multi-display coordinate issues\""
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
VERSION_TYPE=$1
|
|
14
|
+
COMMIT_MESSAGE=$2
|
|
15
|
+
|
|
16
|
+
# Validate version type
|
|
17
|
+
if [[ "$VERSION_TYPE" != "patch" && "$VERSION_TYPE" != "minor" && "$VERSION_TYPE" != "major" ]]; then
|
|
18
|
+
echo "โ Invalid version type: $VERSION_TYPE"
|
|
19
|
+
echo " Must be one of: patch, minor, major"
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Check if we're in a git repository
|
|
24
|
+
if ! git rev-parse --git-dir > /dev/null 2>&1; then
|
|
25
|
+
echo "โ Not in a git repository"
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Check if there are uncommitted changes
|
|
30
|
+
if ! git diff --quiet || ! git diff --cached --quiet; then
|
|
31
|
+
echo "๐ Adding all changes to git..."
|
|
32
|
+
git add .
|
|
33
|
+
|
|
34
|
+
if [ $? -ne 0 ]; then
|
|
35
|
+
echo "โ Failed to add files to git"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "๐ Committing changes..."
|
|
40
|
+
git commit -m "$COMMIT_MESSAGE"
|
|
41
|
+
|
|
42
|
+
if [ $? -ne 0 ]; then
|
|
43
|
+
echo "โ Failed to commit changes"
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
echo "โ
Changes committed successfully"
|
|
48
|
+
else
|
|
49
|
+
echo "โน๏ธ No uncommitted changes found"
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Bump version
|
|
53
|
+
echo "๐ฆ Bumping $VERSION_TYPE version..."
|
|
54
|
+
npm version $VERSION_TYPE
|
|
55
|
+
|
|
56
|
+
if [ $? -ne 0 ]; then
|
|
57
|
+
echo "โ Failed to bump version"
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
62
|
+
echo "โ
Version bumped to: $NEW_VERSION"
|
|
63
|
+
|
|
64
|
+
# Push to git
|
|
65
|
+
echo "๐ Pushing to git..."
|
|
66
|
+
git push origin HEAD
|
|
67
|
+
|
|
68
|
+
if [ $? -ne 0 ]; then
|
|
69
|
+
echo "โ Failed to push to git"
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo "โ
Pushed to git successfully"
|
|
74
|
+
|
|
75
|
+
# Publish to npm
|
|
76
|
+
echo "๐ค Publishing to npm..."
|
|
77
|
+
npm publish
|
|
78
|
+
|
|
79
|
+
if [ $? -ne 0 ]; then
|
|
80
|
+
echo "โ Failed to publish to npm"
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
echo "๐ Successfully published version $NEW_VERSION to npm!"
|
|
85
|
+
echo ""
|
|
86
|
+
echo "๐ Summary:"
|
|
87
|
+
echo " โข Committed: '$COMMIT_MESSAGE'"
|
|
88
|
+
echo " โข Version: $NEW_VERSION ($VERSION_TYPE bump)"
|
|
89
|
+
echo " โข Git: Pushed to remote"
|
|
90
|
+
echo " โข NPM: Published successfully"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Simรผlasyon: Primary display koordinat hesabฤฑ
|
|
2
|
+
|
|
3
|
+
const displays = [
|
|
4
|
+
{ name: 'Display 1', x: 0, y: 0, width: 2048, height: 1330, isPrimary: true },
|
|
5
|
+
{ name: 'Display 2', x: -3440, y: -56, width: 3440, height: 1440, isPrimary: false }
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
// Combined frame calculation
|
|
9
|
+
const minX = Math.min(...displays.map(d => d.x));
|
|
10
|
+
const minY = Math.min(...displays.map(d => d.y));
|
|
11
|
+
const maxX = Math.max(...displays.map(d => d.x + d.width));
|
|
12
|
+
const maxY = Math.max(...displays.map(d => d.y + d.height));
|
|
13
|
+
|
|
14
|
+
const combinedFrame = {
|
|
15
|
+
x: minX,
|
|
16
|
+
y: minY,
|
|
17
|
+
width: maxX - minX,
|
|
18
|
+
height: maxY - minY
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
console.log('๐ Display Setup:');
|
|
22
|
+
displays.forEach(d => console.log(` ${d.name}: (${d.x}, ${d.y}) ${d.width}x${d.height} ${d.isPrimary ? '[PRIMARY]' : ''}`));
|
|
23
|
+
|
|
24
|
+
console.log(`\n๐ Combined Frame: (${combinedFrame.x}, ${combinedFrame.y}) ${combinedFrame.width}x${combinedFrame.height}`);
|
|
25
|
+
|
|
26
|
+
// Test primary window
|
|
27
|
+
const primaryWindow = { x: 100, y: 100, width: 1000, height: 800 };
|
|
28
|
+
|
|
29
|
+
const globalOffset = { x: combinedFrame.x, y: combinedFrame.y };
|
|
30
|
+
|
|
31
|
+
const localX = primaryWindow.x - globalOffset.x; // 100 - (-3440) = 3540
|
|
32
|
+
const localY = (combinedFrame.height - (primaryWindow.y - globalOffset.y)) - primaryWindow.height;
|
|
33
|
+
|
|
34
|
+
const localWindowCenterX = localX + (primaryWindow.width / 2); // 3540 + 500 = 4040
|
|
35
|
+
const localWindowCenterY = localY + (primaryWindow.height / 2);
|
|
36
|
+
|
|
37
|
+
console.log(`\n๐ฏ Primary Window Test: (${primaryWindow.x}, ${primaryWindow.y}) ${primaryWindow.width}x${primaryWindow.height}`);
|
|
38
|
+
console.log(` GlobalOffset: (${globalOffset.x}, ${globalOffset.y})`);
|
|
39
|
+
console.log(` LocalCoords: (${localX}, ${localY})`);
|
|
40
|
+
console.log(` LocalWindowCenter: (${localWindowCenterX}, ${localWindowCenterY})`);
|
|
41
|
+
console.log(` Expected range for primary: X should be 0-${displays.find(d => d.isPrimary).width}`);
|
|
42
|
+
console.log(` โ PROBLEM: LocalX ${localX} is way outside primary display bounds!`);
|
|
43
|
+
|
|
44
|
+
console.log(`\n๐ก SOLUTION: Primary display windows should stay at their global positions`);
|
|
45
|
+
console.log(` - Primary windows have global coords that are already correct for overlay`);
|
|
46
|
+
console.log(` - Only secondary display windows need coordinate transformation`);
|
|
47
|
+
|
|
48
|
+
// Test secondary window
|
|
49
|
+
const secondaryWindow = { x: -3340, y: 44, width: 3440, height: 1415 };
|
|
50
|
+
const secLocalX = secondaryWindow.x - globalOffset.x; // -3340 - (-3440) = 100
|
|
51
|
+
const secLocalWindowCenterX = secLocalX + (secondaryWindow.width / 2); // 100 + 1720 = 1820
|
|
52
|
+
|
|
53
|
+
console.log(`\n๐ฏ Secondary Window Test: (${secondaryWindow.x}, ${secondaryWindow.y}) ${secondaryWindow.width}x${secondaryWindow.height}`);
|
|
54
|
+
console.log(` LocalCoords: (${secLocalX}, ???)`);
|
|
55
|
+
console.log(` LocalWindowCenter: (${secLocalWindowCenterX}, ???)`);
|
|
56
|
+
console.log(` โ
This looks correct for secondary display`);
|
package/src/window_selector.mm
CHANGED
|
@@ -94,6 +94,8 @@ void updateScreenOverlays();
|
|
|
94
94
|
|
|
95
95
|
@implementation WindowSelectorOverlayView
|
|
96
96
|
|
|
97
|
+
@synthesize globalOriginOffset = _globalOriginOffset;
|
|
98
|
+
|
|
97
99
|
- (instancetype)initWithFrame:(NSRect)frameRect {
|
|
98
100
|
self = [super initWithFrame:frameRect];
|
|
99
101
|
if (self) {
|
|
@@ -872,9 +874,25 @@ void updateOverlay() {
|
|
|
872
874
|
globalOffset = [overlayView.globalOriginOffset pointValue];
|
|
873
875
|
}
|
|
874
876
|
|
|
875
|
-
//
|
|
876
|
-
|
|
877
|
-
|
|
877
|
+
// Determine if this is a primary display window
|
|
878
|
+
BOOL isPrimaryDisplayWindow = (x >= 0 && x <= 2048); // Primary display width
|
|
879
|
+
|
|
880
|
+
CGFloat localX, localY;
|
|
881
|
+
if (isPrimaryDisplayWindow) {
|
|
882
|
+
// Primary display windows: Offset to their position in the combined overlay
|
|
883
|
+
// Primary display starts at (3440, 56) within the combined frame
|
|
884
|
+
localX = x + 3440; // Primary starts 3440px from overlay origin
|
|
885
|
+
localY = ([g_overlayView frame].size.height - (y + 56)) - height; // Y offset for primary
|
|
886
|
+
} else {
|
|
887
|
+
// Secondary display windows: Apply standard coordinate transformation
|
|
888
|
+
localX = x - globalOffset.x;
|
|
889
|
+
localY = ([g_overlayView frame].size.height - (y - globalOffset.y)) - height;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
NSLog(@"๐ง COORDINATE DEBUG: Window (%d, %d) %dx%d [%@]", (int)x, (int)y, (int)width, (int)height, isPrimaryDisplayWindow ? @"PRIMARY" : @"SECONDARY");
|
|
893
|
+
NSLog(@" GlobalOffset: (%.0f, %.0f)", globalOffset.x, globalOffset.y);
|
|
894
|
+
NSLog(@" LocalCoords: (%.0f, %.0f)", localX, localY);
|
|
895
|
+
NSLog(@" ViewFrame: %.0fx%.0f", [g_overlayView frame].size.width, [g_overlayView frame].size.height);
|
|
878
896
|
|
|
879
897
|
// Update overlay view window info for highlighting
|
|
880
898
|
[overlayView setWindowInfo:targetWindow];
|
|
@@ -986,6 +1004,10 @@ void updateOverlay() {
|
|
|
986
1004
|
localWindowCenterX - (buttonSize.width / 2),
|
|
987
1005
|
localWindowCenterY - (buttonSize.height / 2) // Perfect center of window
|
|
988
1006
|
);
|
|
1007
|
+
|
|
1008
|
+
NSLog(@" ButtonCalc: WindowCenter(%.0f, %.0f) -> Button(%.0f, %.0f)",
|
|
1009
|
+
localWindowCenterX, localWindowCenterY, buttonCenter.x, buttonCenter.y);
|
|
1010
|
+
|
|
989
1011
|
[g_selectButton setFrameOrigin:buttonCenter];
|
|
990
1012
|
|
|
991
1013
|
// Position app icon above window center
|
|
@@ -1863,7 +1885,10 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
1863
1885
|
g_overlayView = [[WindowSelectorOverlayView alloc] initWithFrame:localViewFrame];
|
|
1864
1886
|
|
|
1865
1887
|
// Store the global origin offset for coordinate conversion
|
|
1866
|
-
|
|
1888
|
+
WindowSelectorOverlayView *overlayView = (WindowSelectorOverlayView *)g_overlayView;
|
|
1889
|
+
overlayView.globalOriginOffset = [NSValue valueWithPoint:fullScreenFrame.origin];
|
|
1890
|
+
|
|
1891
|
+
NSLog(@"๐ง SET GlobalOriginOffset: (%.0f, %.0f)", fullScreenFrame.origin.x, fullScreenFrame.origin.y);
|
|
1867
1892
|
[g_overlayWindow setContentView:g_overlayView];
|
|
1868
1893
|
|
|
1869
1894
|
// Note: NSWindow doesn't have setWantsLayer method, only NSView does
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const MacRecorder = require('./index');
|
|
2
|
+
const WindowSelector = MacRecorder.WindowSelector;
|
|
3
|
+
|
|
4
|
+
async function testCoordinateDebug() {
|
|
5
|
+
console.log('๐ Testing coordinate debugging...');
|
|
6
|
+
|
|
7
|
+
const selector = new WindowSelector();
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
console.log('๐ Starting window selection with coordinate debugging...');
|
|
11
|
+
await selector.startSelection();
|
|
12
|
+
|
|
13
|
+
console.log('๐ Move cursor to PRIMARY display window and check console logs');
|
|
14
|
+
|
|
15
|
+
// Let it run for 10 seconds to see debug output
|
|
16
|
+
await new Promise(resolve => setTimeout(resolve, 10000));
|
|
17
|
+
|
|
18
|
+
await selector.stopSelection();
|
|
19
|
+
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.log(`โ Test failed: ${error.message}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
testCoordinateDebug();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const MacRecorder = require('./index');
|
|
2
|
+
const WindowSelector = MacRecorder.WindowSelector;
|
|
3
|
+
|
|
4
|
+
async function testFinalCoordinateFix() {
|
|
5
|
+
console.log('๐ฏ Testing FINAL coordinate fix...');
|
|
6
|
+
|
|
7
|
+
const recorder = new MacRecorder();
|
|
8
|
+
const displays = await recorder.getDisplays();
|
|
9
|
+
|
|
10
|
+
console.log('๐ Display setup:');
|
|
11
|
+
displays.forEach(display => {
|
|
12
|
+
console.log(` ${display.name}: (${display.x}, ${display.y}) ${display.width}x${display.height} ${display.isPrimary ? '[PRIMARY]' : ''}`);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const selector = new WindowSelector();
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
console.log('\n๐ Starting window selection with coordinate fix...');
|
|
19
|
+
console.log('๐ Test BOTH displays:');
|
|
20
|
+
console.log(' - Primary display windows should now show buttons correctly');
|
|
21
|
+
console.log(' - Secondary display windows should continue working');
|
|
22
|
+
console.log(' - Look for [PRIMARY] vs [SECONDARY] tags in logs');
|
|
23
|
+
|
|
24
|
+
await selector.startSelection();
|
|
25
|
+
|
|
26
|
+
// Let it run for 20 seconds for thorough testing
|
|
27
|
+
await new Promise(resolve => setTimeout(resolve, 20000));
|
|
28
|
+
|
|
29
|
+
await selector.stopSelection();
|
|
30
|
+
|
|
31
|
+
console.log('โ
Final coordinate test completed!');
|
|
32
|
+
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.log(`โ Test failed: ${error.message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
testFinalCoordinateFix();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const MacRecorder = require('./index');
|
|
2
|
+
const WindowSelector = MacRecorder.WindowSelector;
|
|
3
|
+
|
|
4
|
+
console.log('๐ฅ LIVE Primary Display Test - Move cursor NOW!');
|
|
5
|
+
console.log(' - Quickly move to primary display windows');
|
|
6
|
+
console.log(' - Look for [PRIMARY] tags in logs');
|
|
7
|
+
|
|
8
|
+
const selector = new WindowSelector();
|
|
9
|
+
|
|
10
|
+
selector.startSelection().then(() => {
|
|
11
|
+
// Auto-stop after 8 seconds
|
|
12
|
+
setTimeout(() => {
|
|
13
|
+
selector.stopSelection().then(() => {
|
|
14
|
+
process.exit(0);
|
|
15
|
+
});
|
|
16
|
+
}, 8000);
|
|
17
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const MacRecorder = require('./index');
|
|
2
|
+
const WindowSelector = MacRecorder.WindowSelector;
|
|
3
|
+
|
|
4
|
+
async function testPrimaryWindowDebug() {
|
|
5
|
+
console.log('๐ Testing PRIMARY display window debugging...');
|
|
6
|
+
|
|
7
|
+
const recorder = new MacRecorder();
|
|
8
|
+
const displays = await recorder.getDisplays();
|
|
9
|
+
|
|
10
|
+
const primary = displays.find(d => d.isPrimary);
|
|
11
|
+
console.log(`Primary display: ${primary.name} at (${primary.x}, ${primary.y}) ${primary.width}x${primary.height}`);
|
|
12
|
+
|
|
13
|
+
const selector = new WindowSelector();
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
console.log('๐ Starting window selection...');
|
|
17
|
+
console.log('๐ IMPORTANT: Move cursor to a window ON THE PRIMARY DISPLAY');
|
|
18
|
+
console.log(' - Look for windows at coordinates like (0, 50) or (100, 100)');
|
|
19
|
+
console.log(' - Should see GlobalOffset: (3440, 56) for primary display');
|
|
20
|
+
|
|
21
|
+
await selector.startSelection();
|
|
22
|
+
|
|
23
|
+
// Let it run for 15 seconds to catch primary display windows
|
|
24
|
+
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
25
|
+
|
|
26
|
+
await selector.stopSelection();
|
|
27
|
+
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.log(`โ Test failed: ${error.message}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
testPrimaryWindowDebug();
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Primary display window button positioning validation
|
|
2
|
+
|
|
3
|
+
console.log('๐งฎ Primary Display Button Position Validation');
|
|
4
|
+
console.log('='.repeat(50));
|
|
5
|
+
|
|
6
|
+
// Combined frame
|
|
7
|
+
const combinedFrame = { x: -3440, y: -56, width: 5488, height: 1440 };
|
|
8
|
+
|
|
9
|
+
// Test primary window
|
|
10
|
+
const primaryWindow = { x: 100, y: 100, width: 1000, height: 800 };
|
|
11
|
+
|
|
12
|
+
console.log(`Combined frame: (${combinedFrame.x}, ${combinedFrame.y}) ${combinedFrame.width}x${combinedFrame.height}`);
|
|
13
|
+
console.log(`Primary window: (${primaryWindow.x}, ${primaryWindow.y}) ${primaryWindow.width}x${primaryWindow.height}`);
|
|
14
|
+
|
|
15
|
+
// Current calculation
|
|
16
|
+
const isPrimaryDisplayWindow = (primaryWindow.x >= 0 && primaryWindow.x <= 2048);
|
|
17
|
+
console.log(`\nisPrimaryDisplayWindow: ${isPrimaryDisplayWindow}`);
|
|
18
|
+
|
|
19
|
+
if (isPrimaryDisplayWindow) {
|
|
20
|
+
// Current implementation
|
|
21
|
+
const localX = primaryWindow.x + 3440; // 100 + 3440 = 3540
|
|
22
|
+
const localY = (combinedFrame.height - (primaryWindow.y + 56)) - primaryWindow.height; // 1440 - (100 + 56) - 800 = 484
|
|
23
|
+
|
|
24
|
+
console.log(`Local coordinates: (${localX}, ${localY})`);
|
|
25
|
+
|
|
26
|
+
const localWindowCenterX = localX + (primaryWindow.width / 2); // 3540 + 500 = 4040
|
|
27
|
+
const localWindowCenterY = localY + (primaryWindow.height / 2); // 484 + 400 = 884
|
|
28
|
+
|
|
29
|
+
console.log(`Window center: (${localWindowCenterX}, ${localWindowCenterY})`);
|
|
30
|
+
|
|
31
|
+
const buttonX = localWindowCenterX - 100; // 4040 - 100 = 3940
|
|
32
|
+
const buttonY = localWindowCenterY - 30; // 884 - 30 = 854
|
|
33
|
+
|
|
34
|
+
console.log(`Button position: (${buttonX}, ${buttonY})`);
|
|
35
|
+
|
|
36
|
+
// Validate button is within overlay bounds
|
|
37
|
+
const isValid = buttonX >= 0 && buttonX <= combinedFrame.width && buttonY >= 0 && buttonY <= combinedFrame.height;
|
|
38
|
+
console.log(`Button within overlay bounds: ${isValid} โ
`);
|
|
39
|
+
|
|
40
|
+
// Validate button is within primary display section of overlay
|
|
41
|
+
const primaryOverlayStart = 3440;
|
|
42
|
+
const primaryOverlayEnd = 5488;
|
|
43
|
+
const inPrimarySection = buttonX >= primaryOverlayStart && buttonX <= primaryOverlayEnd;
|
|
44
|
+
console.log(`Button in primary overlay section (${primaryOverlayStart}-${primaryOverlayEnd}): ${inPrimarySection} โ
`);
|
|
45
|
+
|
|
46
|
+
console.log('\n๐ฏ PRIMARY WINDOW BUTTON POSITIONING SHOULD NOW WORK!');
|
|
47
|
+
} else {
|
|
48
|
+
console.log('Not a primary window');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log('\n๐ Compare with secondary window:');
|
|
52
|
+
const secondaryWindow = { x: -3340, y: 44, width: 3440, height: 1415 };
|
|
53
|
+
const secLocalX = secondaryWindow.x - combinedFrame.x; // -3340 - (-3440) = 100
|
|
54
|
+
const secCenterX = secLocalX + (secondaryWindow.width / 2); // 100 + 1720 = 1820
|
|
55
|
+
console.log(`Secondary window center: (${secCenterX}, ???)`);
|
|
56
|
+
console.log(`Secondary button position: (${secCenterX - 100}, ???)`);
|
|
57
|
+
|
|
58
|
+
console.log('\nโ
Both primary and secondary should now have correct button positioning!');
|