@skylandnpm/octopus-proxy 0.1.54 → 0.1.55

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.
@@ -138,8 +138,16 @@ int main(int argc, const char *argv[]) {
138
138
  if (!display) { dispatch_async(dispatch_get_main_queue(), ^{ fail(@"所选显示器已断开,请刷新显示器列表后重试。" ); }); return; }
139
139
  SCContentFilter *filter = [[SCContentFilter alloc] initWithDisplay:display excludingWindows:@[]];
140
140
  SCStreamConfiguration *configuration = [SCStreamConfiguration new];
141
- configuration.width = CGDisplayPixelsWide(display.displayID);
142
- configuration.height = CGDisplayPixelsHigh(display.displayID);
141
+ if (@available(macOS 14.0, *)) {
142
+ configuration.width = CGDisplayPixelsWide(display.displayID);
143
+ configuration.height = CGDisplayPixelsHigh(display.displayID);
144
+ } else {
145
+ // On macOS 13, re-entering Quartz display queries from the
146
+ // SCShareableContent callback can block indefinitely. The returned
147
+ // SCDisplay already contains the dimensions needed for capture.
148
+ configuration.width = display.width;
149
+ configuration.height = display.height;
150
+ }
143
151
  configuration.pixelFormat = kCVPixelFormatType_32BGRA;
144
152
  configuration.showsCursor = YES;
145
153
  configuration.queueDepth = 3;
@@ -271,6 +271,14 @@ int main(int argc,const char *argv[]) {
271
271
  emit(@{@"capture":@(CGPreflightScreenCaptureAccess()),@"input":@((BOOL)(AXIsProcessTrusted() && CGPreflightPostEventAccess())),@"session":@(sessionPresent()),@"locked":@(screenLocked()),@"lockCapture":@(lockCapture)}); return 0;
272
272
  }
273
273
  if(argc!=6 || strcmp(argv[1],"serve")!=0 || !inputOK() || !CGPreflightScreenCaptureAccess()) return 1;
274
+ if (@available(macOS 14.0, *)) {
275
+ // Keep the current display initialization on modern macOS.
276
+ } else {
277
+ // Initialize AppKit's display connection on the main thread first.
278
+ // Otherwise Quartz display queries can hang on macOS 13 before the
279
+ // capture stream is even created. This does not request permissions.
280
+ (void)NSScreen.screens;
281
+ }
274
282
  displayID=(CGDirectDisplayID)strtoul(argv[2],NULL,10);
275
283
  int w=atoi(argv[3]),h=atoi(argv[4]),fps=atoi(argv[5]);
276
284
  if(!CGDisplayIsOnline(displayID) || w<2 || h<2 || w>3840 || h>2160 || w%2 || h%2 || fps<1 || fps>30) return 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skylandnpm/octopus-proxy",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "type": "module",
5
5
  "description": "Octopus host proxy: OpenCode, Codex, ZCode and Pi adapters with service installer CLI",
6
6
  "bin": {