CGWindowListCopyWindowInfo, kCGWindowLayer and window level

The file CGWindowLevel.hdefines the constants that are used to set the window level, and the largest value that can be used as the window level is 20. But if you retrieve the list of windows using a call CGWindowListCopyWindowInfo, you can have a value of kCGWindowLayermore than 20 (25, 103, etc. .).

Does kCGWindowLayer and window level not match? If they do not match, how do I get the window level for windows that are obtained with CGWindowListCopyWindowInfo? If they are the same, why do we get a value> 20?

+2
source share
2 answers

, kCGWindowLayer , , .

, 20 - kCGBaseWindowLevelKey kCGAssistiveTechHighWindowLevelKey, 20. , , CGWindowLevelForKey. , kCGStatusWindowLevelKey 9, kCGStatusWindowLevel CGWindowLevelForKey(kCGStatusWindowLevelKey), - 25.

+2

. kCGWindowLayer . . , .

        CFArrayRef windowArray = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
        NSMutableArray *windowsInMap = [NSMutableArray arrayWithCapacity:64];
        NSArray*  windows = (NSArray*)CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
        NSUInteger count = [windows count];
        for (NSUInteger i = 0; i < count; i++)
        {
            NSDictionary*   nswindowsdescription = [windows objectAtIndex:i];
            NSNumber* windowid = (NSNumber*)[nswindowsdescription objectForKey:@"kCGWindowNumber"];
            if(windowid)
            {
                       // Entried will be in front to back order.
            }
        }
        CFRelease(windowArray);
0

All Articles