mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 08:52:20 +00:00
Add windowID to info dictionary
This commit is contained in:
@@ -13,9 +13,11 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
APPKIT_EXTERN NSString *const MPWindowIDKey;
|
||||
APPKIT_EXTERN NSString *const MPWindowTitleKey;
|
||||
APPKIT_EXTERN NSString *const MPProcessIdentifierKey;
|
||||
|
||||
|
||||
@interface NSRunningApplication (MPAdditions)
|
||||
|
||||
@property (readonly, copy) NSDictionary *mp_infoDictionary;
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
|
||||
NSString *const MPWindowIDKey = @"MPWindowIDKey";
|
||||
NSString *const MPWindowTitleKey = @"MPWindowTitleKey";
|
||||
NSString *const MPProcessIdentifierKey = @"MPProcessIdentifierKey";
|
||||
|
||||
|
||||
BOOL skipWindowTitle(NSString *windowTitle) {
|
||||
if(windowTitle.length <= 0) {
|
||||
return YES;
|
||||
@@ -45,11 +44,12 @@ BOOL skipWindowTitle(NSString *windowTitle) {
|
||||
NSNumber *processId = windowDict[(NSString *)kCGWindowOwnerPID];
|
||||
if(processId && [processId isEqualToNumber:@(self.processIdentifier)]) {
|
||||
|
||||
NSNumber *number = (NSNumber *)windowDict[(NSString *)kCGWindowNumber];
|
||||
NSUInteger zIndex = [windowNumbers indexOfObject:number];
|
||||
NSNumber *windowId = (NSNumber *)windowDict[(NSString *)kCGWindowNumber];
|
||||
NSUInteger zIndex = [windowNumbers indexOfObject:windowId];
|
||||
if(zIndex < minZIndex) {
|
||||
minZIndex = zIndex;
|
||||
infoDict = @{
|
||||
MPWindowIDKey: windowId,
|
||||
MPWindowTitleKey: windowTitle,
|
||||
MPProcessIdentifierKey : processId
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user