2017-05-19 15:40:52 -05:00
|
|
|
// 19 may 2017
|
|
|
|
#import "uipriv_darwin.h"
|
|
|
|
|
|
|
|
// functions and constants FROM THE FUTURE!
|
2017-05-27 17:19:08 -05:00
|
|
|
// note: for constants, dlsym() returns the address of the constant itself, as if we had done &constantName
|
2017-05-19 15:40:52 -05:00
|
|
|
|
|
|
|
// added in OS X 10.10; we need 10.8
|
2018-05-05 21:02:25 -05:00
|
|
|
CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureTag = NULL;
|
|
|
|
CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureValue = NULL;
|
2017-05-19 15:40:52 -05:00
|
|
|
|
2018-03-11 01:26:32 -06:00
|
|
|
// added in OS X 10.12; we need 10.8
|
2018-05-05 21:02:25 -05:00
|
|
|
CFStringRef *uiprivFUTURE_kCTBackgroundColorAttributeName = NULL;
|
2018-03-11 01:26:32 -06:00
|
|
|
|
2017-05-19 15:40:52 -05:00
|
|
|
// note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed)
|
2018-05-05 21:02:25 -05:00
|
|
|
void uiprivLoadFutures(void)
|
2017-05-19 15:40:52 -05:00
|
|
|
{
|
|
|
|
void *handle;
|
|
|
|
|
|
|
|
// dlsym() walks the dependency chain, so opening the current process should be sufficient
|
|
|
|
handle = dlopen(NULL, RTLD_LAZY);
|
|
|
|
if (handle == NULL)
|
|
|
|
return;
|
|
|
|
#define GET(var, fn) *((void **) (&var)) = dlsym(handle, #fn)
|
2018-05-05 21:02:25 -05:00
|
|
|
GET(uiprivFUTURE_kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureTag);
|
|
|
|
GET(uiprivFUTURE_kCTFontOpenTypeFeatureValue, kCTFontOpenTypeFeatureValue);
|
|
|
|
GET(uiprivFUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName);
|
2017-05-19 15:40:52 -05:00
|
|
|
dlclose(handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
// wrappers for methods that exist in the future that we can check for with respondsToSelector:
|
|
|
|
// keep them in one place for convenience
|
|
|
|
|
|
|
|
// apparently only added in 10.9; we need 10.8
|
2018-05-05 21:02:25 -05:00
|
|
|
void uiprivFUTURE_NSLayoutConstraint_setIdentifier(NSLayoutConstraint *constraint, NSString *identifier)
|
2017-05-19 15:40:52 -05:00
|
|
|
{
|
|
|
|
id cid = (id) constraint;
|
|
|
|
|
|
|
|
if ([constraint respondsToSelector:@selector(setIdentifier:)])
|
|
|
|
[cid setIdentifier:identifier];
|
|
|
|
}
|
|
|
|
|
|
|
|
// added in 10.11; we need 10.8
|
|
|
|
// return whether this was done because we recreate its effects if not (see winmoveresize.m)
|
2018-05-05 21:02:25 -05:00
|
|
|
BOOL uiprivFUTURE_NSWindow_performWindowDragWithEvent(NSWindow *w, NSEvent *initialEvent)
|
2017-05-19 15:40:52 -05:00
|
|
|
{
|
|
|
|
id cw = (id) w;
|
|
|
|
|
|
|
|
if ([w respondsToSelector:@selector(performWindowDragWithEvent:)]) {
|
|
|
|
[cw performWindowDragWithEvent:initialEvent];
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
return NO;
|
|
|
|
}
|