🐰
プライベートAPIを使ってNSWindowのドロップシャドウの情報を得る
実用性はほぼないのですが、NSWindowのメソッドをダンプしていたらドロップシャドウに関するプライベートAPIを見つけたため、メモを残しておきます。
let window = NSWindow()
let shadowParameters = window.value(forKey: "shadowParameters")
shadowParameters
でドロップシャドウに関するさまざまな値を取得できます。辞書形式です。
setterと思われる_setShadowParameters
も見つけたのですが、これは引数を取らないように見え、使い方が分かりませんでした。よってドロップシャドウを書き換える方法は見つけられていません。
以下Objective-C形式のダンプです。
StandardWindow
{
"com.apple.WindowShadowContentAwareActive" = 1;
"com.apple.WindowShadowContentAwareInctive" = 1;
"com.apple.WindowShadowDensityActive" = "0.4";
"com.apple.WindowShadowDensityInactive" = "0.25";
"com.apple.WindowShadowInnerRimDensityActive" = "0.1";
"com.apple.WindowShadowInnerRimDensityInactive" = "0.1";
"com.apple.WindowShadowInnerRimRadiusActive" = 2;
"com.apple.WindowShadowInnerRimRadiusInactive" = 2;
"com.apple.WindowShadowInnerRimStyleWhiteActive" = 1;
"com.apple.WindowShadowInnerRimStyleWhiteInactive" = 1;
"com.apple.WindowShadowRadiusActive" = 20;
"com.apple.WindowShadowRadiusInactive" = 12;
"com.apple.WindowShadowRimDensityActive" = "0.6";
"com.apple.WindowShadowRimDensityInactive" = "0.55";
"com.apple.WindowShadowRimRadiusActive" = 3;
"com.apple.WindowShadowRimRadiusInactive" = 3;
"com.apple.WindowShadowRimStyleHardActive" = 0;
"com.apple.WindowShadowRimStyleHardInactive" = 0;
"com.apple.WindowShadowRimStyleWhiteActive" = 0;
"com.apple.WindowShadowRimStyleWhiteInactive" = 0;
"com.apple.WindowShadowVerticalOffsetActive" = 18;
"com.apple.WindowShadowVerticalOffsetInactive" = 8;
}
UtilityWindow
{
"com.apple.WindowShadowContentAwareActive" = 1;
"com.apple.WindowShadowContentAwareInctive" = 1;
"com.apple.WindowShadowDensityActive" = "0.25";
"com.apple.WindowShadowDensityInactive" = "0.25";
"com.apple.WindowShadowInnerRimDensityActive" = "0.1";
"com.apple.WindowShadowInnerRimDensityInactive" = "0.1";
"com.apple.WindowShadowInnerRimRadiusActive" = 2;
"com.apple.WindowShadowInnerRimRadiusInactive" = 2;
"com.apple.WindowShadowInnerRimStyleWhiteActive" = 1;
"com.apple.WindowShadowInnerRimStyleWhiteInactive" = 1;
"com.apple.WindowShadowRadiusActive" = 8;
"com.apple.WindowShadowRadiusInactive" = 8;
"com.apple.WindowShadowRimDensityActive" = "0.55";
"com.apple.WindowShadowRimDensityInactive" = "0.55";
"com.apple.WindowShadowRimRadiusActive" = 3;
"com.apple.WindowShadowRimRadiusInactive" = 3;
"com.apple.WindowShadowRimStyleHardActive" = 0;
"com.apple.WindowShadowRimStyleHardInactive" = 0;
"com.apple.WindowShadowRimStyleWhiteActive" = 0;
"com.apple.WindowShadowRimStyleWhiteInactive" = 0;
"com.apple.WindowShadowVerticalOffsetActive" = 4;
"com.apple.WindowShadowVerticalOffsetInactive" = 4;
}
Discussion