Respect FxRemoteWindow geometry and follow host content bounds in LUT browser

这个提交包含在:
mac 于 2026-11-02 21:42:20 +08:00 提交
1 父节点 e62d5532f2
当前提交 f9dea76a45
11 个文件已更改
+261 -14

没有与搜索条件相匹配的文件

+7
查看文件
@@ -0,0 +1,7 @@
# 大鱼调色 1.7.2(47)
修正风格LUT缩略图浏览库的远程窗口尺寸处理:按FCP提供的实际内容区域布局,避免用本地保存的位置、尺寸和min/max覆盖宿主窗口;容器变更时同步填充深色内容区。缩略图大小、列表/网格、侧栏、分类和最近使用继续保留。
本地脱离式窗口使用系统实际标题栏尺寸,并把恢复位置约束到当前显示器。保留1.7.1的Cube文字行兼容。
要求Apple Silicon、macOS14.6或更新,唯一位置`/Library/Plug-Ins/FxPlug/大鱼调色.app`。本机宿主为FCP12.4;反馈来自FCP12.3/系统27.01,目标机显示器配置未知,目标版本仍需更新后复测。测试和交付结果见本轮verification记录。
+23
查看文件
@@ -0,0 +1,23 @@
# 1.7.2:LUT浏览库远程窗口尺寸
基线 `e62d5532f2360d157d5a4d96488e58f4113a55af`,正式安装1.7.1(46)。用户转述另一使用者的“窗口很大、出现灰色空白、深色内容被裁切”,并提供第三方源码分析;版本为FCP12.3、系统输入为27.01(按27.0.1记录),分辨率及缩放未知。本机为FCP12.4,不能把本机验证写成对方12.3实测。
## 已确认的代码问题与分析边界
`DYInspector`优先请求FxRemoteWindowAPI_v3/v2,并同步把浏览器根视图接入SDK提供的parent。随后`configurePresentationWindow`原先还会修改`_root.window`的最小/最大内容尺寸、标题和frame,恢复插件自行保存的位置。远程桥接窗口的几何不应由这条本地恢复逻辑覆盖。
本机FxPlug4.3.5的`FxRemoteWindowAPI.h`说明v2的最大尺寸会限制到宿主**窗口**大小的80%。它没有说按检视器宽度限制;固定28点标题栏换算不准确,也不能单凭不同常量认定每台机器必然出现灰边。多屏时机、FCP12.3具体桥接行为及对方真实灰边仍需目标机复核。
隐藏AppKit桥接模型从相同内容大小开始,关闭parent自动调整子视图,种入离屏/大屏历史记录。旧源码失败9项:宿主frame/min/max/标题被改、桥接缩放策略被覆盖、若干parent变化未跟随、非零bounds原点未跟随、远程窗口事件污染本地历史。修正后21项几何检查、23项浏览库回归通过,摘要见`verification/BrowserGeometryRegression1.7.2.json`。测试模型的失败证明不安全路径,不冒充对方系统的实际截图复现。
## 修改
- 远程模式仅观察生命周期并按parent.bounds布局,直接返回;不设宿主窗口frame、min/max、标题、位置或背景,不从本地历史恢复远程窗口。
- 保留桥接容器自己的autoresizesSubviews设置;监听parent的frame/bounds变化,即使自动缩放关闭、初始零尺寸或bounds原点非零,根视图也填满实际可用区域。关闭后移除这些观察。
- 远程窗口事件不再写插件的本地frame偏好;缩略图大小、布局、分类、侧栏和最近使用保留原机制。
- 仅本地脱离式弹窗保留位置恢复,用AppKit实际frame/content转换取代固定28/448/1228点;按保存frame与显示器的交集选择可用屏幕,将内容和外框约束到真实可见区域。
- SDK v2/v3仍负责可调整远程窗口的范围;不通过改min/max伪装初始尺寸,也不清空用户配置来掩盖问题。
`tools/verify_browser_remote_geometry.mm`覆盖576×336、720×420、1280×800、900×620等桥接内容大小、旧记录、禁用自动缩放、非零原点、晚到尺寸、一次关闭和本地窗口恢复。正式`--self-test`加入8项对应检查。所有构建目录窗口测试保持不可见;用户可见验证只运行正式签名、公证并安装的版本。
本轮继续保留1.7.1的Cube文字行容错。最终公证、宿主、安装包和Release结果以交付记录为准;目标使用者的FCP12.3仍需更新后复测。
+1 -1
查看文件
@@ -32,7 +32,7 @@ int main(int argc,const char **argv){@autoreleasepool{
NSSplitView *split=[browser valueForKey:@"splitView"];[split setPosition:240 ofDividerAtIndex:0];[browser layoutBrowser];NSScrollView *folders=[browser valueForKey:@"folderScroll"],*grid=[browser valueForKey:@"gridScroll"];require(fabs(folders.frame.size.width-240)<2&&NSMaxX(folders.frame)<=NSMinX(grid.frame),@"sidebar divider changes folder width without overlapping previews");
[browser close];[browser release];browser=[[DYLUTBrowser alloc]initWithLibrary:library preview:nil selectedPath:nil palette:@{} selection:nil];pump(^{return [browser valueForKey:@"libraryTask"]==nil;});require([(NSPopUpButton*)[browser valueForKey:@"layoutMenu"]indexOfSelectedItem]==1&&fabs([[browser valueForKey:@"sidebarWidth"]doubleValue]-240)<2,@"layout and sidebar width survive reopening");
NSPanel *host=[[[NSPanel alloc]initWithContentRect:NSMakeRect(120,160,900,620) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]autorelease];__block int closes=0;[browser showInRemoteParent:host.contentView close:^{closes++;}];pump(^{return [browser valueForKey:@"presentationWindow"]==host;});require(!host.visible&&browser.visible,@"remote-parent checks never display a test window");
NSRect desired=NSMakeRect(190,210,1000,680);[host setFrame:desired display:NO];NSString *frameKey=[@"com.dayu.color.lookLUTPreview.windowFrame|" stringByAppendingString:library.rootURL.path];require(NSEqualRects(NSRectFromString([NSUserDefaults.standardUserDefaults stringForKey:frameKey]),host.frame),@"window position and size are remembered");[browser close];[browser close];require(closes==1,@"remote close callback runs once");[browser release];[ack release];ack=nil;
NSRect desired=NSMakeRect(190,210,1000,680);[host setFrame:desired display:NO];NSString *frameKey=[@"com.dayu.color.lookLUTPreview.windowFrame|" stringByAppendingString:library.rootURL.path];require([NSUserDefaults.standardUserDefaults stringForKey:frameKey]==nil,@"remote window geometry is owned and remembered by the host");[browser close];[browser close];require(closes==1,@"remote close callback runs once");[browser release];[ack release];ack=nil;
for(int i=0;i<50;i++)[library recordUsedPath:[root.path stringByAppendingPathComponent:[NSString stringWithFormat:@"History-%d.cube",i]]];require(library.recentPaths.count==40&&[library.recentPaths[0]hasSuffix:@"History-49.cube"],@"recent history stays bounded at 40 newest paths");
NSArray *keys=NSUserDefaults.standardUserDefaults.dictionaryRepresentation.allKeys;for(NSString *key in keys)if([key containsString:library.rootURL.path])[NSUserDefaults.standardUserDefaults removeObjectForKey:key];require([fm removeItemAtURL:root error:nil],@"isolated fixtures and preferences cleaned");
NSDictionary *report=@{@"pass":@YES,@"checks":checks,@"scope":@"Real AppKit browser objects, hidden host-owned window fixture, asynchronous acknowledgement and root-scoped history; no visible test app or user LUT changes."};[[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted error:nil]writeToFile:[NSString stringWithUTF8String:argv[1]] atomically:YES];printf("PASS %lu browser checks\n",(unsigned long)checks.count);[checks release];return 0;
+62
查看文件
@@ -0,0 +1,62 @@
#import <AppKit/AppKit.h>
#import "../大鱼调色/Plugin/DYLUTBrowser.h"
#import "../大鱼调色/Plugin/DYLUTLibrary.h"
#include <cmath>
@interface DYLUTBrowser (GeometryProbe)
- (void)configurePresentationWindow;
@end
static NSMutableArray *checks;
static void check(BOOL pass,NSString *name){[checks addObject:@{@"name":name,@"pass":@(pass)}];if(!pass)fprintf(stderr,"FAIL %s\n",name.UTF8String);}
static void pump(void){double until=NSProcessInfo.processInfo.systemUptime+.08;while(NSProcessInfo.processInfo.systemUptime<until)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];}
int main(int argc,const char **argv){@autoreleasepool{
if(argc!=2)return 2;checks=[NSMutableArray new];[NSApplication sharedApplication];[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
NSURL *directory=[NSURL fileURLWithPath:[NSTemporaryDirectory()stringByAppendingPathComponent:[@"dayu-remote-geometry-" stringByAppendingString:NSUUID.UUID.UUIDString]]];
[NSFileManager.defaultManager createDirectoryAtURL:directory withIntermediateDirectories:YES attributes:nil error:nil];
DYLUTLibrary *library=[[[DYLUTLibrary alloc]initWithRootURL:directory]autorelease];
NSString *key=[@"com.dayu.color.lookLUTPreview.windowFrame|" stringByAppendingString:library.rootURL.path];
NSString *stale=NSStringFromRect(NSMakeRect(-9000,8000,1800,1228));[NSUserDefaults.standardUserDefaults setObject:stale forKey:key];
NSPanel *host=[[[NSPanel alloc]initWithContentRect:NSMakeRect(80,100,900,620) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]autorelease];
// A remote bridge can publish its content bounds separately from its local
// service-side window. Never resize that window to restore plug-in history.
NSView *parent=[[[NSView alloc]initWithFrame:host.contentView.bounds]autorelease];parent.autoresizesSubviews=NO;[host.contentView addSubview:parent];
NSRect initial=host.frame;NSSize minimum=host.contentMinSize,maximum=host.contentMaxSize;NSString *title=[host.title copy];
__block NSUInteger closes=0;DYLUTBrowser *browser=[[DYLUTBrowser alloc]initWithLibrary:library preview:nil selectedPath:nil palette:@{} selection:nil];
[browser showInRemoteParent:parent close:^{closes++;}];pump();
NSView *root=[browser valueForKey:@"root"];
check(NSEqualRects(host.frame,initial),@"remote attach never restores a stale frame onto the host window");
check(NSEqualSizes(host.contentMinSize,minimum)&&NSEqualSizes(host.contentMaxSize,maximum),@"remote attach preserves host minimum and maximum sizes");
check([host.title isEqual:title],@"remote attach preserves host-owned window metadata");
check(!parent.autoresizesSubviews,@"remote attach preserves the bridge's autoresizing policy");
check(NSEqualRects(root.frame,parent.bounds),@"root initially covers exactly the supplied remote bounds");
check(!host.visible&&browser.visible,@"native geometry fixtures remain invisible");
for(NSValue *value in @[[NSValue valueWithSize:NSMakeSize(576,336)],[NSValue valueWithSize:NSMakeSize(720,420)],[NSValue valueWithSize:NSMakeSize(1280,800)],[NSValue valueWithSize:NSMakeSize(900,620)]]){
parent.autoresizesSubviews=NO;[parent setFrameSize:value.sizeValue];pump();
check(NSEqualRects(root.frame,parent.bounds),@"root follows bridge resize even when autoresizing is disabled");
NSView *done=[browser valueForKey:@"done"],*search=[browser valueForKey:@"search"],*split=[browser valueForKey:@"splitView"];
check(NSContainsRect(root.bounds,done.frame)&&NSContainsRect(root.bounds,search.frame)&&NSContainsRect(root.bounds,split.frame),@"footer, search and browser panes remain within host-capped content");
}
[parent setBoundsOrigin:NSMakePoint(17,23)];pump();check(NSEqualRects(root.frame,parent.bounds),@"root tracks nonzero remote bounds origins");
[host setFrame:NSMakeRect(140,160,1000,700) display:NO];pump();check([[NSUserDefaults.standardUserDefaults stringForKey:key]isEqual:stale],@"remote window events never overwrite local window history");
[browser close];[browser close];check(closes==1,@"remote dismissal is delivered once");[browser release];[title release];
// Late SDK attachment: a zero-sized placeholder gets real bounds later.
NSView *late=[[[NSView alloc]initWithFrame:NSZeroRect]autorelease];late.autoresizesSubviews=NO;[host.contentView addSubview:late];
browser=[[DYLUTBrowser alloc]initWithLibrary:library preview:nil selectedPath:nil palette:@{} selection:nil];[browser showInRemoteParent:late close:nil];
[late setFrame:NSMakeRect(0,0,720,420)];pump();root=[browser valueForKey:@"root"];
check(NSEqualRects(root.frame,late.bounds),@"zero-size SDK placeholder expands after late host attachment");[browser close];[browser release];
// Detached popovers are local windows and retain their geometry behavior.
NSPanel *local=[[[NSPanel alloc]initWithContentRect:NSMakeRect(120,140,900,620) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]autorelease];
browser=[[DYLUTBrowser alloc]initWithLibrary:library preview:nil selectedPath:nil palette:@{} selection:nil];[browser showInRemoteParent:local.contentView close:nil];
[browser setValue:@NO forKey:@"remoteMode"];[browser setValue:@YES forKey:@"detached"];pump();
BOOL onScreen=NO;for(NSScreen *screen in NSScreen.screens)onScreen|=NSContainsRect(screen.visibleFrame,local.frame);
check(onScreen,@"local detached window constrains disconnected-display history to a visible screen");
NSRect chosen=[local frameRectForContentRect:NSMakeRect(180,200,900,620)];[local setFrame:chosen display:NO];pump();
check(NSEqualRects(NSRectFromString([NSUserDefaults.standardUserDefaults stringForKey:key]),local.frame),@"local detached window still remembers user position and size");
check(!local.visible,@"local fallback geometry checks also remain invisible");[browser close];[browser release];
for(NSString *item in NSUserDefaults.standardUserDefaults.dictionaryRepresentation.allKeys)if([item containsString:library.rootURL.path])[NSUserDefaults.standardUserDefaults removeObjectForKey:item];
[NSFileManager.defaultManager removeItemAtURL:directory error:nil];
BOOL pass=YES;for(NSDictionary *item in checks)pass&=[item[@"pass"]boolValue];
NSDictionary *report=@{@"pass":@(pass),@"checks":checks,@"scope":@"Hidden native AppKit remote-bridge fixtures: stale off-screen history, host-owned geometry, disabled autoresizing, capped content sizes, nonzero bounds and late attachment. No visible test app or user settings modified."};
[[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted error:nil]writeToFile:[NSString stringWithUTF8String:argv[1]] atomically:YES];
printf("%s %lu checks\n",pass?"PASS":"FAIL",(unsigned long)checks.count);return pass?0:1;
}}
+1 -1
查看文件
@@ -78,7 +78,7 @@
"pass" : true
},
{
"name" : "window position and size are remembered",
"name" : "remote window geometry is owned and remembered by the host",
"pass" : true
},
{
@@ -0,0 +1,21 @@
{
"baselineCommit": "e62d5532f2360d157d5a4d96488e58f4113a55af",
"baselineFailures": [
"remote attach never restores a stale frame onto the host window",
"remote attach preserves host minimum and maximum sizes",
"remote attach preserves host-owned window metadata",
"remote attach preserves the bridge's autoresizing policy",
"root follows bridge resize even when autoresizing is disabled",
"root follows bridge resize even when autoresizing is disabled",
"root follows bridge resize even when autoresizing is disabled",
"root tracks nonzero remote bounds origins",
"remote window events never overwrite local window history"
],
"fixedChecks": 21,
"fixedPass": true,
"reportedHost": "Final Cut Pro 12.3",
"reportedOS": "macOS 27.0.1 (user entered 27.01)",
"reportedDisplay": "not supplied",
"localHost": "Final Cut Pro 12.4",
"scope": "A native bridge model reproduces unsafe geometry ownership; the affected user system has not been directly tested."
}
@@ -0,0 +1,90 @@
{
"pass" : true,
"checks" : [
{
"name" : "remote attach never restores a stale frame onto the host window",
"pass" : true
},
{
"name" : "remote attach preserves host minimum and maximum sizes",
"pass" : true
},
{
"name" : "remote attach preserves host-owned window metadata",
"pass" : true
},
{
"name" : "remote attach preserves the bridge's autoresizing policy",
"pass" : true
},
{
"name" : "root initially covers exactly the supplied remote bounds",
"pass" : true
},
{
"name" : "native geometry fixtures remain invisible",
"pass" : true
},
{
"name" : "root follows bridge resize even when autoresizing is disabled",
"pass" : true
},
{
"name" : "footer, search and browser panes remain within host-capped content",
"pass" : true
},
{
"name" : "root follows bridge resize even when autoresizing is disabled",
"pass" : true
},
{
"name" : "footer, search and browser panes remain within host-capped content",
"pass" : true
},
{
"name" : "root follows bridge resize even when autoresizing is disabled",
"pass" : true
},
{
"name" : "footer, search and browser panes remain within host-capped content",
"pass" : true
},
{
"name" : "root follows bridge resize even when autoresizing is disabled",
"pass" : true
},
{
"name" : "footer, search and browser panes remain within host-capped content",
"pass" : true
},
{
"name" : "root tracks nonzero remote bounds origins",
"pass" : true
},
{
"name" : "remote window events never overwrite local window history",
"pass" : true
},
{
"name" : "remote dismissal is delivered once",
"pass" : true
},
{
"name" : "zero-size SDK placeholder expands after late host attachment",
"pass" : true
},
{
"name" : "local detached window constrains disconnected-display history to a visible screen",
"pass" : true
},
{
"name" : "local detached window still remembers user position and size",
"pass" : true
},
{
"name" : "local fallback geometry checks also remain invisible",
"pass" : true
}
],
"scope" : "Hidden native AppKit remote-bridge fixtures: stale off-screen history, host-owned geometry, disabled autoresizing, capped content sizes, nonzero bounds and late attachment. No visible test app or user settings modified."
}
+21
查看文件
@@ -5,6 +5,7 @@
#import "DYRenderer.h"
#import "DYAutoGrade.h"
#import "DYLUTLibrary.h"
#import "DYLUTBrowser.h"
#import "DYInspector.h"
#include "DYSpiderState.h"
#include <string>
@@ -198,6 +199,26 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
DYAssetState *copy=[[assets copy]autorelease];copy.paths=@{};run.record(@"asset-copy-is-independent",assets.paths.count==2&&copy.paths.count==0);
// Exercise the real AppKit actions against a separate, in-memory host.
[NSApplication sharedApplication];
DYLUTLibrary *geometryLibrary=[[[DYLUTLibrary alloc]initWithRootURL:[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"browser-geometry"]]]autorelease];
NSString *geometryKey=[@"com.dayu.color.lookLUTPreview.windowFrame|" stringByAppendingString:geometryLibrary.rootURL.path],*staleGeometry=NSStringFromRect(NSMakeRect(-9000,8000,1800,1228));
[NSUserDefaults.standardUserDefaults setObject:staleGeometry forKey:geometryKey];
NSPanel *geometryHost=[[[NSPanel alloc]initWithContentRect:NSMakeRect(80,100,900,620) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]autorelease];
NSView *geometryParent=[[[NSView alloc]initWithFrame:geometryHost.contentView.bounds]autorelease];geometryParent.autoresizesSubviews=NO;[geometryHost.contentView addSubview:geometryParent];
NSRect geometryFrame=geometryHost.frame;NSSize geometryMin=geometryHost.contentMinSize,geometryMax=geometryHost.contentMaxSize;
__block NSUInteger geometryCloses=0;DYLUTBrowser *geometryBrowser=[[[DYLUTBrowser alloc]initWithLibrary:geometryLibrary preview:nil selectedPath:nil palette:@{} selection:nil]autorelease];
[geometryBrowser showInRemoteParent:geometryParent close:^{geometryCloses++;}];double geometryDeadline=NSProcessInfo.processInfo.systemUptime+2;
while([geometryBrowser valueForKey:@"presentationWindow"]!=geometryHost&&NSProcessInfo.processInfo.systemUptime<geometryDeadline)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];
run.need(@"browser-remote-presentation-attached",[geometryBrowser valueForKey:@"presentationWindow"]==geometryHost);
run.record(@"browser-remote-preserves-host-window-geometry",NSEqualRects(geometryHost.frame,geometryFrame)&&NSEqualSizes(geometryHost.contentMinSize,geometryMin)&&NSEqualSizes(geometryHost.contentMaxSize,geometryMax));
run.record(@"browser-remote-preserves-bridge-resize-policy",!geometryParent.autoresizesSubviews);
NSView *geometryRoot=[geometryBrowser valueForKey:@"root"];[geometryParent setFrameSize:NSMakeSize(576,336)];
run.record(@"browser-remote-fills-host-capped-bounds",NSEqualRects(geometryRoot.frame,geometryParent.bounds));
NSView *geometryDone=[geometryBrowser valueForKey:@"done"],*geometrySplit=[geometryBrowser valueForKey:@"splitView"];
run.record(@"browser-remote-footer-and-grid-fit-capped-bounds",NSContainsRect(geometryRoot.bounds,geometryDone.frame)&&NSContainsRect(geometryRoot.bounds,geometrySplit.frame));
[geometryParent setBoundsOrigin:NSMakePoint(17,23)];run.record(@"browser-remote-tracks-bounds-origin",NSEqualRects(geometryRoot.frame,geometryParent.bounds));
[geometryHost setFrame:NSMakeRect(140,160,1000,700) display:NO];run.record(@"browser-remote-keeps-local-history-isolated",[[NSUserDefaults.standardUserDefaults stringForKey:geometryKey]isEqual:staleGeometry]);
[geometryBrowser close];[geometryBrowser close];run.record(@"browser-remote-close-once-without-visible-test-window",geometryCloses==1&&!geometryHost.visible);
for(NSString *key in NSUserDefaults.standardUserDefaults.dictionaryRepresentation.allKeys)if([key containsString:geometryLibrary.rootURL.path])[NSUserDefaults.standardUserDefaults removeObjectForKey:key];
DYDiagnosticManager *uiHost=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(uiHost,nil);
DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:uiHost]autorelease];[inspector refresh];
NSArray *cards=[inspector valueForKey:@"cards"];BOOL initialUI=YES;
+30 -7
查看文件
@@ -144,7 +144,8 @@ static NSString *DYBrowserPreference(NSString *key,DYLUTLibrary *library){return
NSString *key=[NSString stringWithFormat:@"%@|%@",DYBrowserFramePreference,DYLUTLibrary.defaultRootURL.path];
NSString *saved=[[NSUserDefaults standardUserDefaults]stringForKey:key];NSRect frame=saved?NSRectFromString(saved):NSZeroRect;
if(!std::isfinite(frame.size.width)||!std::isfinite(frame.size.height)||frame.size.width<720||frame.size.height<420)return NSMakeSize(900,620);
return NSMakeSize(MIN(1800,frame.size.width),MIN(1200,MAX(420,frame.size.height-28)));
NSSize content=[NSWindow contentRectForFrameRect:frame styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable].size;
return NSMakeSize(MIN(1800,MAX(720,content.width)),MIN(1200,MAX(420,content.height)));
}
static NSTextField *BrowserLabel(NSString *title,CGFloat size){NSTextField *label=[NSTextField labelWithString:title];label.font=[NSFont systemFontOfSize:size];label.lineBreakMode=NSLineBreakByTruncatingTail;return label;}
static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *button=[NSButton buttonWithTitle:title target:target action:action];button.font=[NSFont systemFontOfSize:11];button.bezelStyle=NSBezelStyleRounded;return button;}
@@ -223,31 +224,52 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
if(_closed||!parent||self.visible)return;
_remoteMode=YES;_visible=YES;[_closeAction release];_closeAction=[closeAction copy];
self.window.contentView=[[[NSView alloc]initWithFrame:NSMakeRect(0,0,1,1)]autorelease];
[_root removeFromSuperview];_root.frame=parent.bounds;_root.autoresizingMask=NSViewWidthSizable|NSViewHeightSizable;parent.autoresizesSubviews=YES;_root.hidden=NO;
[_root removeFromSuperview];_root.frame=parent.bounds;_root.autoresizingMask=NSViewWidthSizable|NSViewHeightSizable;_root.hidden=NO;
// FxRemoteWindow owns the window and may publish view geometry separately.
// Follow the supplied parent without changing the bridge's resize policy.
parent.postsFrameChangedNotifications=YES;parent.postsBoundsChangedNotifications=YES;
for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(remoteParentGeometryChanged:) name:name object:parent];
[parent addSubview:_root];[self layoutBrowser];[_root setNeedsDisplay:YES];
// The SDK reads the first child size as soon as its reply returns.
// Restore geometry only after that first synchronous attachment is complete.
// Attach synchronously: the SDK reads the first child before reply returns.
dispatch_async(dispatch_get_main_queue(),^{if(!_closed)[self configurePresentationWindow];});
NSAccessibilityPostNotification(parent,NSAccessibilityLayoutChangedNotification);
}
- (void)fitRemoteParent{
NSView *parent=_root.superview;if(_closed||!_remoteMode||!parent)return;
if(!NSEqualRects(_root.frame,parent.bounds))_root.frame=parent.bounds;
[self layoutBrowser];[_root setNeedsDisplay:YES];
}
- (void)remoteParentGeometryChanged:(NSNotification *)notification{
if(notification.object==_root.superview)[self fitRemoteParent];
}
- (void)configurePresentationWindow{
NSWindow *window=_root.window;if(!window||window==self.window)return;
if(_presentationWindow!=window){[_presentationWindow release];_presentationWindow=[window retain];
for(NSNotificationName name in @[NSWindowDidMoveNotification,NSWindowDidResizeNotification])[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(presentationGeometryChanged:) name:name object:window];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(presentationWindowClosed:) name:NSWindowWillCloseNotification object:window];
}
// The v2 API caps the size to 80% of the host window. A service-side NSWindow
// is not authority to override that geometry, metadata or saved position.
if(_remoteMode){[self fitRemoteParent];return;}
window.title=@"风格 LUT";window.contentMinSize=self.class.minimumContentSize;window.contentMaxSize=self.class.maximumContentSize;
if(_detached)window.styleMask|=NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable;
NSString *saved=[NSUserDefaults.standardUserDefaults stringForKey:DYBrowserPreference(DYBrowserFramePreference,_library)];
NSRect frame=saved?NSRectFromString(saved):[window frameRectForContentRect:(NSRect){window.frame.origin,self.class.preferredContentSize}];
if(std::isfinite(frame.origin.x)&&std::isfinite(frame.origin.y)&&std::isfinite(frame.size.width)&&std::isfinite(frame.size.height)&&frame.size.width>=720&&frame.size.height>=420){
NSRect screen=(window.screen?:NSScreen.mainScreen).visibleFrame;frame.size.width=MIN(MAX(720,frame.size.width),MIN(1800,screen.size.width));frame.size.height=MIN(MAX(448,frame.size.height),MIN(1228,screen.size.height));
frame.origin.x=MAX(NSMinX(screen),MIN(frame.origin.x,NSMaxX(screen)-frame.size.width));frame.origin.y=MAX(NSMinY(screen),MIN(frame.origin.y,NSMaxY(screen)-frame.size.height));[window setFrame:frame display:YES];
NSScreen *target=window.screen?:NSScreen.mainScreen;CGFloat largest=0;
for(NSScreen *candidate in NSScreen.screens){NSRect overlap=NSIntersectionRect(frame,candidate.visibleFrame);CGFloat area=overlap.size.width*overlap.size.height;if(area>largest){largest=area;target=candidate;}}
if(target){
NSRect screen=target.visibleFrame;NSSize available=[window contentRectForFrameRect:screen].size,minimum=self.class.minimumContentSize,maximum=self.class.maximumContentSize;
minimum=NSMakeSize(MIN(minimum.width,available.width),MIN(minimum.height,available.height));maximum=NSMakeSize(MIN(maximum.width,available.width),MIN(maximum.height,available.height));
window.contentMinSize=minimum;window.contentMaxSize=maximum;
NSRect content=[window contentRectForFrameRect:frame];content.size=NSMakeSize(MIN(maximum.width,MAX(minimum.width,content.size.width)),MIN(maximum.height,MAX(minimum.height,content.size.height)));frame=[window frameRectForContentRect:content];
frame.origin.x=MAX(NSMinX(screen),MIN(frame.origin.x,NSMaxX(screen)-frame.size.width));frame.origin.y=MAX(NSMinY(screen),MIN(frame.origin.y,NSMaxY(screen)-frame.size.height));[window setFrame:frame display:YES];
}
}
[self layoutBrowser];
}
- (void)presentationGeometryChanged:(NSNotification *)notification{
if(_closed||!_presentationWindow)return;NSRect frame=_presentationWindow.frame;
if(_closed||!_presentationWindow)return;if(_remoteMode){[self fitRemoteParent];return;}NSRect frame=_presentationWindow.frame;
if(std::isfinite(frame.size.width)&&std::isfinite(frame.size.height)&&frame.size.width>=720&&frame.size.height>=420)[NSUserDefaults.standardUserDefaults setObject:NSStringFromRect(frame) forKey:DYBrowserPreference(DYBrowserFramePreference,_library)];
[self layoutBrowser];
}
@@ -272,6 +294,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
[NSObject cancelPreviousPerformRequestsWithTarget:self];
_closed=YES;_visible=NO;_work.cancelled=YES;_work.owner=nil;[_libraryTask cancel];[_selectionTask cancel];[_progressTimer invalidate];[_progressTimer release];_progressTimer=nil;
_popover.delegate=nil;if(_popover.shown)[_popover close];
if(_remoteMode&&_root.superview)for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[[NSNotificationCenter defaultCenter]removeObserver:self name:name object:_root.superview];
[_root removeFromSuperview];[_queuedPaths removeAllObjects];[_thumbnailCache removeAllObjects];
[_selection release];_selection=nil;
void (^closeAction)(void)=[_closeAction copy];[_closeAction release];_closeAction=nil;
+3 -3
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.7.1</string>
<string>1.7.2</string>
<key>CFBundleVersion</key>
<string>46</string>
<string>47</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>
@@ -71,7 +71,7 @@
<key>uuid</key>
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
<key>version</key>
<string>1.7.1</string>
<string>1.7.2</string>
</dict>
<dict>
<key>className</key>
+2 -2
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.7.1</string>
<string>1.7.2</string>
<key>CFBundleVersion</key>
<string>46</string>
<string>47</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>