Mac OSX 覆盖

发布于 2024-08-12 19:29:31 字数 112 浏览 2 评论 0原文

我将如何在 OSX 中编写 HUD 类型覆盖层。 我希望能够有一个应用程序能够在不同应用程序窗口的某个点显示文本。

因此,如果(其他应用程序)窗口移动,HUD 部分将保持在其他窗口的相同坐标处。

How would I go about programming a HUD type overlay in OSX.
I want to be able to have an application that will display text at a certain point over a different application's window.

And thus if the (other applications) window moves the HUD part will stay at the same coordinate of the other window.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温柔少女心 2024-08-19 19:29:31

对于窗口本身,请使用无边框、透明的窗口(大量示例)以及您自己的自定义视图,以在其中绘制重叠元素。

对于“其他应用程序的窗口”部分,没有公共 API 可以让您顺利地完成此操作。您使用Universal Access及其窗口位置/导航API,但它要求您的用户打开“启用辅助设备的访问”(我认为它仍然无法以编程方式完成)。我不相信它会在窗口移动时“让你知道”,但我可能是错的。如果是这样,很可能是一次性的“这就是我现在所在的位置”,因此您的叠加层可能无法跟上。我也不认为它为您提供了“窗口级别”以允许您确保您位于任何给定窗口/工作表/调色板“上方”。

唯一的其他选择(与其他应用程序的窗口一起移动)是系统范围内的侵入性黑客应用程序增强器(这是相当有争议的)。很容易出错并破坏用户系统的稳定性(因此引起争议)。

For the window itself, use a borderless, transparent window (plenty of examples) with your own custom view into which to draw your overlaid elements.

For the "other applications' windows" part, there's no public API that's going to let you do this smoothly. You use Universal Access and its window location/navigation API, but it requires your users to turn on "Enable access for assistive devices" (I think it still can't be done programmatically). I don't believe it "lets you know" when a window moves, but I could be wrong. If it does, it'd likely be a one-shot "here's where I am now", so your overlay would likely not keep up. I also don't think it gives you the "window level" to allow you to make sure you're "above" any given window/sheet/palette.

The only other option (to move with other apps' windows) is a system-wide, invasive hack a la Application Enhancer (which is quite controversial). It's easy to get this wrong and destabilize a user's system (hence the controversy).

┾廆蒐ゝ 2024-08-19 19:29:31

您可以使用未记录的 CoreGraphics 函数来跟踪窗口,请参阅 http://code.google.com/p/undocumented-goodness/source/browse/trunk/CoreGraphics/CGPSrivate.h

You could use undocumented CoreGraphics Functions in order to track a window, see http://code.google.com/p/undocumented-goodness/source/browse/trunk/CoreGraphics/CGSPrivate.h

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文