如果窗口不是最前面,获取 beginGestureWithEvent/endGestureWithEvent 的方法
即使包含的窗口位于后台,是否有办法获取
- (void)beginGestureWithEvent:(NSEvent *)event
和
- (void)endGestureWithEvent:(NSEvent *)event
调用视图?看来这些调用只有在关键时才会传递到窗口。
Is there a way to get
- (void)beginGestureWithEvent:(NSEvent *)event
and
- (void)endGestureWithEvent:(NSEvent *)event
calls to a view even if the containing window is in the background? It seems these calls are only delivered to windows if they are key.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一般来说没有。在 Leopard 和 SnowLeopard 中,手势仅针对前景窗口。正如您所发现的,窗口服务器甚至不会将手势事件发送到后台应用程序。
您可以安装事件分接头,但这些事件看起来与 NS 等效项并不完全一样。不过,如果您真的想深入研究的话,所有数据都在那里。
请提交一份雷达询问此内容以及为什么此内容有用。
In general no. In Leopard and SnowLeopard, gestures are intended to target only the foreground window. As you discovered, the window server will not even send gesture events to background applications.
You could instal an event tap, but those events don't look exactly their the NS equivalents. All the data is there, though, if you really want to dig into it.
Please file a radar asking for this along with why this would be useful.
但这里有一个解决方法:
使用选项
NSTrackingMouseEnteredAndExited | 将跟踪区域添加到视图边界。 NSTrackingActiveAlways
…并在
mouseEntered 时激活您的应用程序:
这是非标准的,但它会起作用。
But here's a workaround:
Add a tracking area to your view bounds with options
NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways
…and activate your application upon
mouseEntered:
It's non-standard but it will work.