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;
// 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;
CFRange range;
color = mkcolor(r, g, b, a);
range.location = start;
range.length = end - start;
CFAttributedStringSetAttribute(p->mas, range, *FUTURE_kCTBackgroundColorAttributeName, color);
CFAttributedStringSetAttribute(p->mas, range, *uiprivFUTURE_kCTBackgroundColorAttributeName, color);
CFRelease(color);
return;
}

View File

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

View File

@ -246,7 +246,7 @@
FONTNAME(preferredSubFamilyName,
self->didPreferredSubFamilyName,
self->preferredSubFamilyName,
UNDOC_kCTFontPreferredSubFamilyNameKey)
uiprivUNDOC_kCTFontPreferredSubFamilyNameKey)
FONTNAME(subFamilyName,
self->didSubFamilyName,
self->subFamilyName,
@ -258,7 +258,7 @@ FONTNAME(fullName,
FONTNAME(preferredFamilyName,
self->didPreferredFamilyName,
self->preferredFamilyName,
UNDOC_kCTFontPreferredFamilyNameKey)
uiprivUNDOC_kCTFontPreferredFamilyNameKey)
FONTNAME(familyName,
self->didFamilyName,
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
// added in OS X 10.10; we need 10.8
CFStringRef *FUTURE_kCTFontOpenTypeFeatureTag = NULL;
CFStringRef *FUTURE_kCTFontOpenTypeFeatureValue = NULL;
CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureTag = NULL;
CFStringRef *uiprivFUTURE_kCTFontOpenTypeFeatureValue = NULL;
// 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)
void loadFutures(void)
void uiprivLoadFutures(void)
{
void *handle;
@ -21,9 +21,9 @@ void loadFutures(void)
if (handle == NULL)
return;
#define GET(var, fn) *((void **) (&var)) = dlsym(handle, #fn)
GET(FUTURE_kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureTag);
GET(FUTURE_kCTFontOpenTypeFeatureValue, kCTFontOpenTypeFeatureValue);
GET(FUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName);
GET(uiprivFUTURE_kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureTag);
GET(uiprivFUTURE_kCTFontOpenTypeFeatureValue, kCTFontOpenTypeFeatureValue);
GET(uiprivFUTURE_kCTBackgroundColorAttributeName, kCTBackgroundColorAttributeName);
dlclose(handle);
}
@ -31,7 +31,7 @@ void loadFutures(void)
// keep them in one place for convenience
// 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;
@ -41,7 +41,7 @@ void FUTURE_NSLayoutConstraint_setIdentifier(NSLayoutConstraint *constraint, NSS
// added in 10.11; we need 10.8
// 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;

View File

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

View File

@ -120,8 +120,8 @@ const char *uiInit(uiInitOptions *o)
[uiprivNSApp() setDelegate:delegate];
uiprivInitAlloc();
loadFutures();
loadUndocumented();
uiprivLoadFutures();
uiprivLoadUndocumented();
// always do this so we always have an application menu
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.tagKey = *FUTURE_kCTFontOpenTypeFeatureTag;
p.tagKey = *uiprivFUTURE_kCTFontOpenTypeFeatureTag;
p.tagIsNumber = NO;
tagcstr[0] = a;
tagcstr[1] = b;
@ -87,7 +87,7 @@ static uiForEach otfArrayForEachOT(const uiOpenTypeFeatures *otf, char a, char b
}
p.tagValue = tagstr;
p.valueKey = *FUTURE_kCTFontOpenTypeFeatureValue;
p.valueKey = *uiprivFUTURE_kCTFontOpenTypeFeatureValue;
p.valueType = kCFNumberSInt32Type;
p.valueValue = (const SInt32 *) (&value);
addCTFeatureEntry(&p);
@ -106,7 +106,7 @@ CFArrayRef uiprivOpenTypeFeaturesToCTFeatures(const uiOpenTypeFeatures *otf)
// TODO
}
f = otfArrayForEachAAT;
if (FUTURE_kCTFontOpenTypeFeatureTag != NULL && FUTURE_kCTFontOpenTypeFeatureValue != NULL)
if (uiprivFUTURE_kCTFontOpenTypeFeatureTag != NULL && uiprivFUTURE_kCTFontOpenTypeFeatureValue != NULL)
f = otfArrayForEachOT;
uiOpenTypeFeaturesForEach(otf, f, array);
return array;

View File

@ -151,4 +151,15 @@ extern NSImage *uiprivImageNSImage(uiImage *);
extern void uiprivDoManualMove(NSWindow *w, NSEvent *initialEvent);
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
// these values come from 10.12.6
CFStringRef UNDOC_kCTFontPreferredSubFamilyNameKey = CFSTR("CTFontPreferredSubFamilyName");
CFStringRef UNDOC_kCTFontPreferredFamilyNameKey = CFSTR("CTFontPreferredFamilyName");
CFStringRef uiprivUNDOC_kCTFontPreferredSubFamilyNameKey = CFSTR("CTFontPreferredSubFamilyName");
CFStringRef uiprivUNDOC_kCTFontPreferredFamilyNameKey = CFSTR("CTFontPreferredFamilyName");
// 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;
CFStringRef *str;
@ -23,9 +23,9 @@ void loadUndocumented(void)
GET(str, kCTFontPreferredSubFamilyNameKey);
NSLog(@"get %p", str);
if (str != NULL)
UNDOC_kCTFontPreferredSubFamilyNameKey = *str;
uiprivUNDOC_kCTFontPreferredSubFamilyNameKey = *str;
GET(str, kCTFontPreferredFamilyNameKey);
if (str != NULL)
UNDOC_kCTFontPreferredFamilyNameKey = *str;
uiprivUNDOC_kCTFontPreferredFamilyNameKey = *str;
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
// 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;
mdp.w = w;