CGWindowListCopyWindowInfo,kCGWindowLayer和窗口级别 [英] CGWindowListCopyWindowInfo, kCGWindowLayer and window level
问题描述
CGWindowLevel.h
文件定义用于设置窗口级别的常量,并且可用作窗口级别的最大值为20.但是,如果使用调用CGWindowListCopyWindowInfo
检索窗口列表,则可以请注意,kCGWindowLayer
的值大于20(25、103等).
The CGWindowLevel.h
file defines the constants that are used to set the window level and the largest value that can be used as window level is 20. But, if you retrieve the window list using the call CGWindowListCopyWindowInfo
, you can observe that the value of kCGWindowLayer
is more than 20 (25, 103 etc).
kCGWindowLayer和窗口级别不一样吗?
如果它们不相同,如何获得使用CGWindowListCopyWindowInfo
获得的窗口的窗口级别?
如果它们相同,为什么我们会得到> 20的值?
Aren't kCGWindowLayer and window level same?
If they are not same, how do I get the window level for the windows that are obtained using CGWindowListCopyWindowInfo
?
If they are same, why do we get value >20?
推荐答案
尽管我还没有找到任何文档来说明kCGWindowLayer
确实是指窗口级别.
It appears that kCGWindowLayer
does refer to a window level, though I haven't found any documentation saying that.
您似乎认为,由于从kCGBaseWindowLevelKey
到kCGAssistiveTechHighWindowLevelKey
的枚举,窗口级别最多可以为20,最后一个级别的值为20.但是这些不是窗口级别,它们是可以使用的键使用CGWindowLevelForKey
查找窗口级别.例如,kCGStatusWindowLevelKey
的值为9,但kCGStatusWindowLevel
被定义为CGWindowLevelForKey(kCGStatusWindowLevelKey)
,而其值则为25.
You seem to think that window levels can be at most 20 because of the enumeration from kCGBaseWindowLevelKey
to kCGAssistiveTechHighWindowLevelKey
, that last one having the value 20. But these are not window levels, they are keys that can be used to look up window levels using CGWindowLevelForKey
. For example, kCGStatusWindowLevelKey
has the value 9, but kCGStatusWindowLevel
is defined as CGWindowLevelForKey(kCGStatusWindowLevelKey)
, and the value of that turns out to be 25.
这篇关于CGWindowListCopyWindowInfo,kCGWindowLayer和窗口级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!