Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file modified bin/mac/main
Binary file not shown.
17 changes: 7 additions & 10 deletions src/natives/utils/mac/utils.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@ id getApplicationForProcess (NSString *processId) {
}

id getWindowOfApplication (id app, NSString *windowId) {
id windows = [app windows];
id windowsProperties = [windows arrayByApplyingSelector:@selector(properties)];
id windows = [app windows];

NSUInteger index = [windowsProperties indexOfObjectPassingTest:^(NSDictionary *properties, NSUInteger index, BOOL *stop){
return [[properties[@"id"] stringValue] isEqualToString: windowId];
}];
for (id window in windows) {
if ([[window properties][@"id"] intValue] == [windowId intValue])
return window;
}

if (index == NSNotFound)
return nil;

return windows[index];
return nil;
}

id getWindowOfProcess (NSString *processId, NSString *windowId) {
id app = getApplicationForProcess(processId);

return getWindowOfApplication(app, windowId);
}
}