gpt4 book ai didi

cocoa - Mac OS X 狮子 : Detect if another application is running in full screen mode?

转载 作者:行者123 更新时间:2023-12-03 16:02:15 25 4
gpt4 key购买 nike

在 Cocoa 应用程序中,有没有办法判断另一个应用程序当前是否处于全屏模式?

我的应用程序配置为显示在所有空间上,并监听 mouseEntered 事件以将其自身排序到前面。

问题是,当另一个应用程序处于全屏模式并且用户碰巧将鼠标移过我的应用程序窗口所在的黑色区域时,它会被带到前面(在多个显示器上发生)。

我仅在启用 [self setCollectionBehavior: NSWindowCollectionBehaviorCanJoinAllSpaces]; 的情况下看到上述行为。

这是我的应用程序的其他相关代码。

- (void) mouseEntered:(NSEvent *)theEvent
{
// Don't do this when another app is in full screen mode:
[[self window] orderFront:self];
}

最佳答案

上述注册方法

“NSWindowWillEnterFullScreenNotification”

不起作用,它们可以用来通知您自己的应用程序,使用它们我们无法检测任何其他应用程序是否处于全屏模式。

然而,在尝试了这么多选项之后,在 github 上发现了全屏检测器应用程序,这个有用的链接..:):)

https://github.com/shinypb/FullScreenDetector.git

关于cocoa - Mac OS X 狮子 : Detect if another application is running in full screen mode?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7138194/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com