Initial commit.

This commit is contained in:
2025-08-23 20:28:46 -07:00
commit 675f42df38
20 changed files with 1356 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import "MenulessWindow.h"
#include "Helpers.h"
/* TODO: Either change name or move some of the configuration out of the
* init, decide whether this is a generic menuless window or not. */
@implementation MenulessWindow
- (instancetype)initWithContentViewController:(NSViewController *)contentViewController {
self = [super initWithContentRect:NSMakeRect(0, 0, 100, 100)
styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable
backing:NSBackingStoreBuffered
defer:false];
if(self) {
[super setContentViewController:contentViewController];
[self setTitle:@""];
[self setTitlebarAppearsTransparent:YES];
[self setCollectionBehavior:NSWindowCollectionBehaviorManaged];
[self setReleasedWhenClosed:NO];
[self setHidesOnDeactivate:NO];
}
return self;
}
- (BOOL)performKeyEquivalent:(NSEvent *)event {
NSEventModifierFlags modifiers = [event modifierFlags];
unsigned short key = [event keyCode];
if([event type] == NSEventTypeKeyDown) {
if(modsContains(NSEventModifierFlagCommand, modifiers) &&
key == kVK_ANSI_W)
{
[self performClose:nil];
return YES;
}
}
return NO;
}
/* - (instancetype)init { */
/* self = [super init]; */
/* if(self) { */
/* } */
/* return self; */
/* } */
@end