简体   繁体   English

有没有办法在NSWindow上获得NSPanel“非激活”样式功能?

[英]Is there a way to get NSPanel “Non activating” style functionality on an NSWindow?

NSPanel has a “Non activating” option for HUD Panels. NSPanel为HUD面板提供了“非激活”选项。 I'd like to get that same functionality working on an NSWindow , ie I want the window to accept clicks but not take focus away from whatever the active app is (by this I mean the app that was active before clicking on the window activated my app—in this case Sketch). 我希望在NSWindow上使用相同的功能,即我希望窗口接受点击但不关注活动应用程序的任何内容(我的意思是在点击窗口激活我之前激活的应用程序app-在这种情况下Sketch)。

I have tried creating an NSWindow subclass and setting canBecomeMainWindow and canBecomeKeyWindow to NO but that doesn't seem to be working—I think because those settings only apply to windows within the same app . 我已经尝试创建一个NSWindow子类并将canBecomeMainWindowcanBecomeKeyWindow设置为NO但这似乎不起作用 - 我认为因为这些设置仅适用于同一应用程序中的窗口。

What I'm trying to do here is prevent this flickering . 我在这里尝试做的是防止这种闪烁 I'm pretty sure this is doable as apps like Alfred seem to be doing it. 我很确定这是可行的,因为像Alfred这样的应用程序似乎正在这样做。

如果有其他人遇到这个,虽然不是问题的确切答案,你确实可以通过向视图控制器添加NSVisualEffectView并将其设置为NSVisualEffectView来使NSPanel变亮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM