mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 12:09:51 +00:00
20 lines
512 B
Objective-C
20 lines
512 B
Objective-C
#import <AppKit/NSApplication.h>
|
|
#import <AppKit/NSWindowScripting.h>
|
|
|
|
@implementation NSWindow (scripting)
|
|
|
|
- (NSInteger) orderedIndex {
|
|
NSInteger result = [[NSApp orderedWindows] indexOfObjectIdenticalTo: self];
|
|
|
|
/* Documentation says orderedIndex is zero based, but tests say it is 1
|
|
based Possible there is a window at 0 which is not in -[NSApp windows] ?
|
|
Either way, available windows are 1 based.
|
|
*/
|
|
if (result != NSNotFound)
|
|
result += 1;
|
|
|
|
return result;
|
|
}
|
|
|
|
@end
|