NSPanel 在错误的空间弹出
所以,我正在浏览这个 源代码,尝试使用 NSPanel 制作带有自定义弹出窗口的状态栏应用程序之一 -
一切正常且花哨。单击菜单会调用 [panel makeKeyandOrderFront:nil]
,这在大多数情况下都有效 - 窗口通常会在其他所有内容前面的正确空间中弹出。
但是,如果我移动到全屏空间(例如,全屏模式下的 Xcode)并尝试使用那里的菜单应用程序,面板会在错误的空间中弹出(之前调出的空间),并且在预期的位置中不会显示任何内容。空间。只有在单击第二次后,它才会出现在正确的位置。
有人对这种现象有解释吗?
So, I'm looking through this source, trying to make one of those status bar applications with a custom popover using an NSPanel -
All works fine and dandy. Clicking the menulet calls [panel makeKeyandOrderFront:nil]
which works in most cases - the window usually pops up in the correct space in front of everything else.
However, if I move to a fullscreen space (e.g. Xcode in fullscreen mode) and try to use the menu application there, the panel pops up in the wrong space (the one it was previously brought up in) and nothing shows up in the intended space. Only after clicking a second time does it come up in the right place.
Does anyone have an explanation for this phenomenon?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也注意到了这一点,虽然我没有解释,但我找到了解决办法。在PanelController.m第249行,在
closePanel
方法中,您必须将[self close]
更改为[self.window orderOut:self]
。I noticed that too, and while I don't have an explanation, I found a fix. On line 249 in PanelController.m, in the
closePanel
method, you have to change[self close]
to[self.window orderOut:self]
.