Mac OS: computing a method's address once is enough.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10750 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2015-06-12 13:15:38 +00:00
parent 0a16c93a42
commit a097978096

View File

@ -663,7 +663,7 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data)
else {
// replaces return [super convertBaseToScreen:aPoint] that may trigger a compiler warning
typedef NSPoint (*convertIMP)(id, SEL, NSPoint);
convertIMP addr = (convertIMP)[NSWindow instanceMethodForSelector:@selector(convertBaseToScreen:)];
static convertIMP addr = (convertIMP)[NSWindow instanceMethodForSelector:@selector(convertBaseToScreen:)];
return addr(self, @selector(convertBaseToScreen:), aPoint);
}
}
@ -679,7 +679,7 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data)
if (fl_mac_os_version >= 100700) {
// replaces [self setRestorable:NO] that may trigger a compiler warning
typedef void (*setIMP)(id, SEL, BOOL);
setIMP addr = (setIMP)[self methodForSelector:@selector(setRestorable:)];
static setIMP addr = (setIMP)[NSWindow instanceMethodForSelector:@selector(setRestorable:)];
addr(self, @selector(setRestorable:), NO);
}
}