以编程方式在另一个桌面(空间)中打开NSWindow [英] Programmatically open NSWindow in another Desktop (Space)

查看:107
本文介绍了以编程方式在另一个桌面(空间)中打开NSWindow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的OSX计划中,我想要:




  • 标识NSWindow所在的桌面;



在已确定的空间中打开NSWindow。



探索文档(NSWindowController,NSWindow,NSScreen)我找不到这些简单的任务

解决方案


$ b <你会认为有一些API使用Spaces,但实际上不是。您可以使用 CGWindowListCopyWindowInfo 来确定特定窗口所在的空间,但是没有简单的方法可以在特定空间上打开特定窗口。



当然,还有 private API在空格之间移动窗口。是否要在您的应用程序中使用这一点取决于您的需求 - 你不能在Mac App Store应用程序中使用它,显然。



找到一个我正在寻找的反向工程的头文件副本:
https://gist.github.com/rjw57/5495406


In my OSX Project I want to:

  • identify the Desktop (one of the expose Spaces) where a NSWindow resides;

  • open a NSWindow in a determined Space, not only on current Space.

Is there a way to do these simple tasks?

Exploring the documentation (NSWindowController, NSWindow, NSScreen) I can't find anything regarding multiple Desktop Management.

Thanks in advance!

解决方案

You'd think there would be some API for working with Spaces, but there really isn't. You can use CGWindowListCopyWindowInfo to determine which Space a particular window is on, but there's no easy way to open a particular window on a specific space.

There is private API to move windows between spaces, of course. Whether you want to use this in your application depends on your needs - you couldn't use it on a Mac App Store application, obviously.

Found a copy-of-a-copy of the reverse-engineered header I was looking for: https://gist.github.com/rjw57/5495406

这篇关于以编程方式在另一个桌面(空间)中打开NSWindow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆