Renamed future and undocumented names. Now for draw.h (and whatever other headers are left behind), and then we figure out what to do about other names (including specifically pinning a naming convention).

This commit is contained in:
Pietro Gagliardi 2018-05-05 22:02:25 -04:00
parent 3914451c34
commit fdff9b2dbb
11 changed files with 38 additions and 40 deletions

View File

@ -1,13 +0,0 @@
// future.m
extern CFStringRef *FUTURE_kCTFontOpenTypeFeatureTag;
extern CFStringRef *FUTURE_kCTFontOpenTypeFeatureValue;
extern CFStringRef *FUTURE_kCTBackgroundColorAttributeName;
extern void loadFutures(void);
extern void FUTURE_NSLayoutConstraint_setIdentifier(NSLayoutConstraint *constraint, NSString *identifier);
extern BOOL FUTURE_NSWindow_performWindowDragWithEvent(NSWindow *w, NSEvent *initialEvent);
// undocumented.m
extern CFStringRef UNDOC_kCTFontPreferredSubFamilyNameKey;
extern CFStringRef UNDOC_kCTFontPreferredFamilyNameKey;
extern void loadUndocumented(void);

View File

@ -296,14 +296,14 @@ static void addBackgroundAttribute(struct foreachParams *p, size_t start, size_t
uiprivDrawTextBackgroundParams *dtb; uiprivDrawTextBackgroundParams *dtb;
// TODO make sure this works properly with line paragraph spacings (after figuring out what that means, of course) // TODO make sure this works properly with line paragraph spacings (after figuring out what that means, of course)
if (FUTURE_kCTBackgroundColorAttributeName != NULL) { if (uiprivFUTURE_kCTBackgroundColorAttributeName != NULL) {
CGColorRef color; CGColorRef color;
CFRange range; CFRange range;
color = mkcolor(r, g, b, a); color = mkcolor(r, g, b, a);
range.location = start; range.location = start;
range.length = end - start; range.length = end - start;
CFAttributedStringSetAttribute(p->mas, range, *FUTURE_kCTBackgroundColorAttributeName, color); CFAttributedStringSetAttribute(p->mas, range, *uiprivFUTURE_kCTBackgroundColorAttributeName, color);
CFRelease(color); CFRelease(color);
return; return;
} }

View File

@ -12,7 +12,7 @@ NSLayoutConstraint *uiprivMkConstraint(id view1, NSLayoutAttribute attr1, NSLayo
attribute:attr2 attribute:attr2
multiplier:multiplier multiplier:multiplier
constant:c]; constant:c];
FUTURE_NSLayoutConstraint_setIdentifier(constraint, desc); uiprivFUTURE_NSLayoutConstraint_setIdentifier(constraint, desc);
return constraint; return constraint;
} }

View File

@ -246,7 +246,7 @@
FONTNAME(preferredSubFamilyName, FONTNAME(preferredSubFamilyName,
self->didPreferredSubFamilyName, self->didPreferredSubFamilyName,
self->preferredSubFamilyName, self->preferredSubFamilyName,
UNDOC_kCTFontPreferredSubFamilyNameKey) uiprivUNDOC_kCTFontPreferredSubFamilyNameKey)
FONTNAME(subFamilyName, FONTNAME(subFamilyName,
self->didSubFamilyName, self->didSubFamilyName,
self->subFamilyName, self->subFamilyName,
@ -258,7 +258,7 @@ FONTNAME(fullName,
FONTNAME(preferredFamilyName, FONTNAME(preferredFamilyName,
self->didPreferredFamilyName, self->didPreferredFamilyName,
self->preferredFamilyName, self->preferredFamilyName,
UNDOC_kCTFontPreferredFamilyNameKey) uiprivUNDOC_kCTFontPreferredFamilyNameKey)
FONTNAME(familyName, FONTNAME(familyName,
self->didFamilyName, self->didFamilyName,
self->familyName, self->familyName,

View File

@ -5,14 +5,14 @@
// note: for constants, dlsym() returns the address of the constant itself, as if we had done &constantName // note: for constants, dlsym() returns the address of the constant itself, as if we had done &constantName
// added in OS X 10.10; we need 10.8 // added in OS X 10.10; we need 10.8
CFStringRef *FUTURE_kCTFontOpenTypeFeatureTag = NULL; CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureTag = NULL;
CFStringRef *FUTURE_kCTFontOpenTypeFeatureValue = NULL; CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureValue = NULL;
// added in OS X 10.12; we need 10.8 // added in OS X 10.12; we need 10.8
CFStringRef *FUTURE_kCTBackgroundColorAttributeName = NULL; CFStringRef *uiprivFUTURE_kCTBackgroundColorAttributeName = NULL;
// note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed) // note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed)
void loadFutures(void) void uiprivLoadFutures(void)
{ {
void *handle; void *handle;
@ -21,9 +21,9 @@ void loadFutures(void)
if (handle == NULL) if (handle == NULL)
return; return;
#define GET(var, fn) *((void **) (&var)) = dlsym(handle, #fn) #define GET(var, fn) *((void **) (&var)) = dlsym(handle, #fn)
GET(FUTURE_kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureTag); GET(uiprivFUTURE_kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureTag);
GET(FUTURE_kCTFontOpenTypeFeatureValue, kCTFontOpenTypeFeatureValue); GET(uiprivFUTURE_kCTFontOpenTypeFeatureValue, kCTFontOpenTypeFeatureValue);
GET(FUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName); GET(uiprivFUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName);
dlclose(handle); dlclose(handle);
} }
@ -31,7 +31,7 @@ void loadFutures(void)
// keep them in one place for convenience // keep them in one place for convenience
// apparently only added in 10.9; we need 10.8 // apparently only added in 10.9; we need 10.8
void FUTURE_NSLayoutConstraint_setIdentifier(NSLayoutConstraint *constraint, NSString *identifier) void uiprivFUTURE_NSLayoutConstraint_setIdentifier(NSLayoutConstraint *constraint, NSString *identifier)
{ {
id cid = (id) constraint; id cid = (id) constraint;
@ -41,7 +41,7 @@ void FUTURE_NSLayoutConstraint_setIdentifier(NSLayoutConstraint *constraint, NSS
// added in 10.11; we need 10.8 // added in 10.11; we need 10.8
// return whether this was done because we recreate its effects if not (see winmoveresize.m) // return whether this was done because we recreate its effects if not (see winmoveresize.m)
BOOL FUTURE_NSWindow_performWindowDragWithEvent(NSWindow *w, NSEvent *initialEvent) BOOL uiprivFUTURE_NSWindow_performWindowDragWithEvent(NSWindow *w, NSEvent *initialEvent)
{ {
id cw = (id) w; id cw = (id) w;

View File

@ -37,7 +37,7 @@ uiLabel *uiNewLabel(const char *text)
uiDarwinNewControl(uiLabel, l); uiDarwinNewControl(uiLabel, l);
l->textfield = newLabel(uiprivToNSString(text)); l->textfield = uiprivNewLabel(uiprivToNSString(text));
return l; return l;
} }

View File

@ -120,8 +120,8 @@ const char *uiInit(uiInitOptions *o)
[uiprivNSApp() setDelegate:delegate]; [uiprivNSApp() setDelegate:delegate];
uiprivInitAlloc(); uiprivInitAlloc();
loadFutures(); uiprivLoadFutures();
loadUndocumented(); uiprivLoadUndocumented();
// always do this so we always have an application menu // always do this so we always have an application menu
uiprivAppDelegate().menuManager = [[uiprivMenuManager new] autorelease]; uiprivAppDelegate().menuManager = [[uiprivMenuManager new] autorelease];

View File

@ -74,7 +74,7 @@ static uiForEach otfArrayForEachOT(const uiOpenTypeFeatures *otf, char a, char b
p.array = (CFMutableArrayRef) data; p.array = (CFMutableArrayRef) data;
p.tagKey = *FUTURE_kCTFontOpenTypeFeatureTag; p.tagKey = *uiprivFUTURE_kCTFontOpenTypeFeatureTag;
p.tagIsNumber = NO; p.tagIsNumber = NO;
tagcstr[0] = a; tagcstr[0] = a;
tagcstr[1] = b; tagcstr[1] = b;
@ -87,7 +87,7 @@ static uiForEach otfArrayForEachOT(const uiOpenTypeFeatures *otf, char a, char b
} }
p.tagValue = tagstr; p.tagValue = tagstr;
p.valueKey = *FUTURE_kCTFontOpenTypeFeatureValue; p.valueKey = *uiprivFUTURE_kCTFontOpenTypeFeatureValue;
p.valueType = kCFNumberSInt32Type; p.valueType = kCFNumberSInt32Type;
p.valueValue = (const SInt32 *) (&value); p.valueValue = (const SInt32 *) (&value);
addCTFeatureEntry(&p); addCTFeatureEntry(&p);
@ -106,7 +106,7 @@ CFArrayRef uiprivOpenTypeFeaturesToCTFeatures(const uiOpenTypeFeatures *otf)
// TODO // TODO
} }
f = otfArrayForEachAAT; f = otfArrayForEachAAT;
if (FUTURE_kCTFontOpenTypeFeatureTag != NULL && FUTURE_kCTFontOpenTypeFeatureValue != NULL) if (uiprivFUTURE_kCTFontOpenTypeFeatureTag != NULL && uiprivFUTURE_kCTFontOpenTypeFeatureValue != NULL)
f = otfArrayForEachOT; f = otfArrayForEachOT;
uiOpenTypeFeaturesForEach(otf, f, array); uiOpenTypeFeaturesForEach(otf, f, array);
return array; return array;

View File

@ -151,4 +151,15 @@ extern NSImage *uiprivImageNSImage(uiImage *);
extern void uiprivDoManualMove(NSWindow *w, NSEvent *initialEvent); extern void uiprivDoManualMove(NSWindow *w, NSEvent *initialEvent);
extern void uiprivDoManualResize(NSWindow *w, NSEvent *initialEvent, uiWindowResizeEdge edge); extern void uiprivDoManualResize(NSWindow *w, NSEvent *initialEvent, uiWindowResizeEdge edge);
#import "OLD_uipriv_darwin.h" // future.m
extern CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureTag;
extern CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureValue;
extern CFStringRef *uiprivFUTURE_kCTBackgroundColorAttributeName;
extern void uiprivLoadFutures(void);
extern void uiprivFUTURE_NSLayoutConstraint_setIdentifier(NSLayoutConstraint *constraint, NSString *identifier);
extern BOOL uiprivFUTURE_NSWindow_performWindowDragWithEvent(NSWindow *w, NSEvent *initialEvent);
// undocumented.m
extern CFStringRef uiprivUNDOC_kCTFontPreferredSubFamilyNameKey;
extern CFStringRef uiprivUNDOC_kCTFontPreferredFamilyNameKey;
extern void uiprivLoadUndocumented(void);

View File

@ -6,11 +6,11 @@
// we also provide default values just in case // we also provide default values just in case
// these values come from 10.12.6 // these values come from 10.12.6
CFStringRef UNDOC_kCTFontPreferredSubFamilyNameKey = CFSTR("CTFontPreferredSubFamilyName"); CFStringRef uiprivUNDOC_kCTFontPreferredSubFamilyNameKey = CFSTR("CTFontPreferredSubFamilyName");
CFStringRef UNDOC_kCTFontPreferredFamilyNameKey = CFSTR("CTFontPreferredFamilyName"); CFStringRef uiprivUNDOC_kCTFontPreferredFamilyNameKey = CFSTR("CTFontPreferredFamilyName");
// note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed) // note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed)
void loadUndocumented(void) void uiprivLoadUndocumented(void)
{ {
void *handle; void *handle;
CFStringRef *str; CFStringRef *str;
@ -23,9 +23,9 @@ void loadUndocumented(void)
GET(str, kCTFontPreferredSubFamilyNameKey); GET(str, kCTFontPreferredSubFamilyNameKey);
NSLog(@"get %p", str); NSLog(@"get %p", str);
if (str != NULL) if (str != NULL)
UNDOC_kCTFontPreferredSubFamilyNameKey = *str; uiprivUNDOC_kCTFontPreferredSubFamilyNameKey = *str;
GET(str, kCTFontPreferredFamilyNameKey); GET(str, kCTFontPreferredFamilyNameKey);
if (str != NULL) if (str != NULL)
UNDOC_kCTFontPreferredFamilyNameKey = *str; uiprivUNDOC_kCTFontPreferredFamilyNameKey = *str;
dlclose(handle); dlclose(handle);
} }

View File

@ -52,7 +52,7 @@ void uiprivDoManualMove(NSWindow *w, NSEvent *initialEvent)
// 10.11 gives us a method to handle this for us // 10.11 gives us a method to handle this for us
// use it if available; this lets us use the real OS dragging code, which means we can take advantage of OS features like Spaces // use it if available; this lets us use the real OS dragging code, which means we can take advantage of OS features like Spaces
if (FUTURE_NSWindow_performWindowDragWithEvent(w, initialEvent)) if (uiprivFUTURE_NSWindow_performWindowDragWithEvent(w, initialEvent))
return; return;
mdp.w = w; mdp.w = w;