Skip to content

Commit 5b020fb

Browse files
committed
Squashed commit of the following:
commit 5651d5cbf1c0ec6f6276d70d2f0000238ce9af10 Author: Amy <[email protected]> Date: Tue Jul 22 12:55:59 2025 -0400 note why we have fileTextSettings i forgot why i put that commit 224f4376047db5f2d211a06edd1a863143a04a4c Author: Amy <[email protected]> Date: Tue Jul 22 12:31:18 2025 -0400 fix focusing on tahoe test on monterey and hs before merging commit 83f045e01b2b72b0db11fa8262264f8e7930ba57 Author: Amy <[email protected]> Date: Tue Jul 22 12:27:51 2025 -0400 hide CGBitmapContextCreate warning on tahoe
1 parent 4ee44be commit 5b020fb

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

Utils.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CGImageRef createAppIcon(CGColorRef background,CGColorRef stroke,CGColorRef fill
88
CGRect rect=CGRectMake(0,0,1024,1024);
99

1010
CGColorSpaceRef space=CGColorSpaceCreateDeviceRGB();
11-
CGContextRef context=CGBitmapContextCreate(NULL,1024,1024,8,1024*4,space,kCGImageAlphaPremultipliedFirst);
11+
CGContextRef context=CGBitmapContextCreate(NULL,1024,1024,8,1024*4,space,(CGBitmapInfo)kCGImageAlphaPremultipliedFirst);
1212
CFRelease(space);
1313

1414
// TODO: doesn't precisely match Apple's template, but neither does NSIconGenericApplication, so..

WindowController.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#define ScratchWidth 600
22
#define ScratchHeight 500
33

4-
CGImageRef createThemeAppIcon()
5-
{
6-
return createAppIcon(getXcodeTheme().sourceTextBackgroundColor.CGColor,getXcodeTheme().sourcePlainTextColor.CGColor,getXcodeTheme().sourceTextCurrentLineHighlightColor.CGColor);
7-
}
8-
94
dispatch_once_t windowControllerInitializeOnce;
105

116
@implementation WindowController
@@ -88,6 +83,10 @@ -(void)replaceDocument:(Document*)document
8883
self.xcodeViewController=getXcodeViewController(document.xcodeDocument);
8984
self.window.contentView=self.xcodeViewController.view;
9085

86+
// TODO: hack to load content immediately
87+
88+
self.window.display;
89+
9190
focusXcodeViewController(self.xcodeViewController,oldSelection);
9291
}
9392

Xcode.m

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ -(instancetype)initWithNibName:(NSString*)nib bundle:(NSBundle*)bundle document:
4545
-(void)selectDocumentLocations:(NSArray<XcodeDocumentLocation*>*)locations;
4646
-(NSArray<XcodeDocumentLocation*>*)currentSelectedDocumentLocations;
4747
-(void)invalidate;
48+
-(void)takeFocus;
4849

4950
@end
5051

@@ -106,8 +107,11 @@ @interface XcodeThemeManager:NSObject
106107
XcodeViewController* getXcodeViewController(XcodeDocument* document)
107108
{
108109
XcodeViewController* controller=[(XcodeViewController*)[SoftViewController alloc] initWithNibName:nil bundle:nil document:document].autorelease;
110+
111+
// TODO: needed for trimming whitespace to work?
112+
109113
controller.fileTextSettings=((NSObject*)[SoftSettings2 alloc]).init.autorelease;
110-
controller.view.clipsToBounds=true;
114+
111115
return controller;
112116
}
113117

@@ -123,20 +127,7 @@ void focusXcodeViewController(XcodeViewController* controller,NSRange selection)
123127
XcodeDocumentLocation* location=[(XcodeDocumentLocation*)[SoftDocumentLocation alloc] initWithDocumentURL:fakeURL timestamp:nil characterRange:selection].autorelease;
124128
[controller selectDocumentLocations:@[location]];
125129

126-
// TODO: confusing. make a general "recurse views with block" function
127-
128-
NSMutableArray<NSView*>* views=NSMutableArray.alloc.init.autorelease;
129-
[views addObject:controller.view];
130-
for(int index=0;index<views.count;index++)
131-
{
132-
if(views[index].acceptsFirstResponder)
133-
{
134-
[views[index].window makeFirstResponder:views[index]];
135-
break;
136-
}
137-
138-
[views addObjectsFromArray:views[index].subviews];
139-
}
130+
controller.takeFocus;
140131
}
141132

142133
XcodeSettings* getXcodeSettings()

main.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int main(int argc,char** argv)
3333
#ifdef iconMode
3434
Settings.reset;
3535

36-
CGImageRef image=createThemeAppIcon();
36+
CGImageRef image=createAppIcon(getXcodeTheme().sourceTextBackgroundColor.CGColor,getXcodeTheme().sourcePlainTextColor.CGColor,getXcodeTheme().sourceTextCurrentLineHighlightColor.CGColor);
3737
NSURL* url=[NSURL fileURLWithPath:@"icon.png"];
3838
CGImageDestinationRef destination=CGImageDestinationCreateWithURL((CFURLRef)url,kUTTypePNG,1,NULL);
3939
CGImageDestinationAddImage(destination,image,NULL);

0 commit comments

Comments
 (0)