From fdff9b2dbbb6ee8edb22d33366d31ad73552ba6b Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 5 May 2018 22:02:25 -0400 Subject: [PATCH] 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). --- darwin/OLD_uipriv_darwin.h | 13 ------------- darwin/attrstr.m | 4 ++-- darwin/autolayout.m | 2 +- darwin/fontmatch.m | 4 ++-- darwin/future.m | 18 +++++++++--------- darwin/label.m | 2 +- darwin/main.m | 4 ++-- darwin/opentype.m | 6 +++--- darwin/uipriv_darwin.h | 13 ++++++++++++- darwin/undocumented.m | 10 +++++----- darwin/winmoveresize.m | 2 +- 11 files changed, 38 insertions(+), 40 deletions(-) delete mode 100644 darwin/OLD_uipriv_darwin.h diff --git a/darwin/OLD_uipriv_darwin.h b/darwin/OLD_uipriv_darwin.h deleted file mode 100644 index 5a9ef4ce..00000000 --- a/darwin/OLD_uipriv_darwin.h +++ /dev/null @@ -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); diff --git a/darwin/attrstr.m b/darwin/attrstr.m index 7d62bcfe..36a180be 100644 --- a/darwin/attrstr.m +++ b/darwin/attrstr.m @@ -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; } diff --git a/darwin/autolayout.m b/darwin/autolayout.m index a4e4395e..6bc5ce84 100644 --- a/darwin/autolayout.m +++ b/darwin/autolayout.m @@ -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; } diff --git a/darwin/fontmatch.m b/darwin/fontmatch.m index 2c240b95..6daa1e8d 100644 --- a/darwin/fontmatch.m +++ b/darwin/fontmatch.m @@ -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, diff --git a/darwin/future.m b/darwin/future.m index a262d009..e6d05ef4 100644 --- a/darwin/future.m +++ b/darwin/future.m @@ -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; diff --git a/darwin/label.m b/darwin/label.m index 2e2772dc..942b153c 100644 --- a/darwin/label.m +++ b/darwin/label.m @@ -37,7 +37,7 @@ uiLabel *uiNewLabel(const char *text) uiDarwinNewControl(uiLabel, l); - l->textfield = newLabel(uiprivToNSString(text)); + l->textfield = uiprivNewLabel(uiprivToNSString(text)); return l; } diff --git a/darwin/main.m b/darwin/main.m index bf40e61e..f7790b01 100644 --- a/darwin/main.m +++ b/darwin/main.m @@ -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]; diff --git a/darwin/opentype.m b/darwin/opentype.m index 84dbde36..be12917f 100644 --- a/darwin/opentype.m +++ b/darwin/opentype.m @@ -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; diff --git a/darwin/uipriv_darwin.h b/darwin/uipriv_darwin.h index 363f22c7..bc8b1837 100644 --- a/darwin/uipriv_darwin.h +++ b/darwin/uipriv_darwin.h @@ -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); diff --git a/darwin/undocumented.m b/darwin/undocumented.m index 0e016dd6..a3984aa8 100644 --- a/darwin/undocumented.m +++ b/darwin/undocumented.m @@ -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); } diff --git a/darwin/winmoveresize.m b/darwin/winmoveresize.m index 4ea98dca..efb61eae 100644 --- a/darwin/winmoveresize.m +++ b/darwin/winmoveresize.m @@ -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;