node-mac-recorder 2.20.14 → 2.20.15
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/package.json
CHANGED
package/src/window_selector.mm
CHANGED
|
@@ -56,6 +56,70 @@ static id g_screenKeyEventMonitor = nil;
|
|
|
56
56
|
static NSTimer *g_screenTrackingTimer = nil;
|
|
57
57
|
static NSInteger g_currentActiveScreenIndex = -1;
|
|
58
58
|
|
|
59
|
+
// Record icon helpers
|
|
60
|
+
static NSImage *CreateRecordIconImage(CGFloat size) {
|
|
61
|
+
NSImage *image = [[[NSImage alloc] initWithSize:NSMakeSize(size, size)] autorelease];
|
|
62
|
+
if (!image) {
|
|
63
|
+
return nil;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[image lockFocus];
|
|
67
|
+
|
|
68
|
+
[[NSColor clearColor] setFill];
|
|
69
|
+
NSRectFill(NSMakeRect(0, 0, size, size));
|
|
70
|
+
|
|
71
|
+
CGFloat strokeWidth = MAX(2.0, size * 0.12);
|
|
72
|
+
NSRect outerRect = NSMakeRect(strokeWidth / 2.0,
|
|
73
|
+
strokeWidth / 2.0,
|
|
74
|
+
size - strokeWidth,
|
|
75
|
+
size - strokeWidth);
|
|
76
|
+
NSBezierPath *outerPath = [NSBezierPath bezierPathWithOvalInRect:outerRect];
|
|
77
|
+
[outerPath setLineWidth:strokeWidth];
|
|
78
|
+
[[NSColor whiteColor] setStroke];
|
|
79
|
+
[outerPath stroke];
|
|
80
|
+
|
|
81
|
+
CGFloat innerDiameter = size * 0.45;
|
|
82
|
+
NSRect innerRect = NSMakeRect((size - innerDiameter) / 2.0,
|
|
83
|
+
(size - innerDiameter) / 2.0,
|
|
84
|
+
innerDiameter,
|
|
85
|
+
innerDiameter);
|
|
86
|
+
NSBezierPath *innerPath = [NSBezierPath bezierPathWithOvalInRect:innerRect];
|
|
87
|
+
[[NSColor whiteColor] setFill];
|
|
88
|
+
[innerPath fill];
|
|
89
|
+
|
|
90
|
+
[image unlockFocus];
|
|
91
|
+
[image setTemplate:NO];
|
|
92
|
+
|
|
93
|
+
return image;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static NSImage *GetStartRecordIcon(void) {
|
|
97
|
+
static NSImage *recordIcon = nil;
|
|
98
|
+
if (!recordIcon) {
|
|
99
|
+
recordIcon = [CreateRecordIconImage(18.0) retain];
|
|
100
|
+
}
|
|
101
|
+
return recordIcon;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static void ApplyStartRecordButtonIcon(NSButton *button) {
|
|
105
|
+
if (!button) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
NSImage *icon = GetStartRecordIcon();
|
|
110
|
+
if (!icon) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
[button setImage:icon];
|
|
115
|
+
[button setImageScaling:NSImageScaleNone];
|
|
116
|
+
[button setImagePosition:NSImageLeft];
|
|
117
|
+
|
|
118
|
+
if ([button respondsToSelector:@selector(setContentTintColor:)]) {
|
|
119
|
+
[button setContentTintColor:[NSColor whiteColor]];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
59
123
|
// Forward declarations
|
|
60
124
|
void cleanupWindowSelector();
|
|
61
125
|
void updateOverlay();
|
|
@@ -1133,7 +1197,9 @@ void updateOverlay() {
|
|
|
1133
1197
|
[targetOverlay.contentView addSubview:targetSelectButton];
|
|
1134
1198
|
NSLog(@"🆕 Added new button to Screen %ld overlay - total subviews now: %lu", targetScreenIndex, [targetOverlay.contentView subviews].count);
|
|
1135
1199
|
}
|
|
1136
|
-
|
|
1200
|
+
|
|
1201
|
+
ApplyStartRecordButtonIcon(targetSelectButton);
|
|
1202
|
+
|
|
1137
1203
|
// Position buttons - Start Record in center of selected window
|
|
1138
1204
|
if (targetSelectButton) {
|
|
1139
1205
|
NSLog(@"🎯 Positioning button on Screen %ld - current frame: (%.0f,%.0f,%.0f,%.0f)", targetScreenIndex,
|
|
@@ -1736,9 +1802,11 @@ bool startScreenSelection() {
|
|
|
1736
1802
|
value:[NSColor whiteColor]
|
|
1737
1803
|
range:NSMakeRange(0, [titleString length])];
|
|
1738
1804
|
[selectButton setAttributedTitle:titleString];
|
|
1739
|
-
|
|
1805
|
+
|
|
1806
|
+
ApplyStartRecordButtonIcon(selectButton);
|
|
1807
|
+
|
|
1740
1808
|
// Clean button - no shadows or highlights
|
|
1741
|
-
|
|
1809
|
+
|
|
1742
1810
|
// Set button target and action (reuse global delegate)
|
|
1743
1811
|
if (!g_delegate) {
|
|
1744
1812
|
g_delegate = [[WindowSelectorDelegate alloc] init];
|
|
@@ -2217,7 +2285,9 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
2217
2285
|
value:[NSColor whiteColor]
|
|
2218
2286
|
range:NSMakeRange(0, [titleString length])];
|
|
2219
2287
|
[g_selectButton setAttributedTitle:titleString];
|
|
2220
|
-
|
|
2288
|
+
|
|
2289
|
+
ApplyStartRecordButtonIcon(g_selectButton);
|
|
2290
|
+
|
|
2221
2291
|
// Create delegate for button action and timer
|
|
2222
2292
|
g_delegate = [[WindowSelectorDelegate alloc] init];
|
|
2223
2293
|
[g_selectButton setTarget:g_delegate];
|
|
@@ -2743,4 +2813,3 @@ extern "C" void showOverlays() {
|
|
|
2743
2813
|
}
|
|
2744
2814
|
});
|
|
2745
2815
|
}
|
|
2746
|
-
|