Skip to content

Commit

Permalink
fix: corrected some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
iWas-Coder committed Dec 10, 2024
1 parent fc890df commit 4f0fd4a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/carbon_win_macos.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,27 @@ void carbon_win_open(u16 width, u16 height, const char *title) {
[carbon_win__app setActivationPolicy:NSApplicationActivationPolicyRegular];
// Create the window
NSRect frame = NSMakeRect(0, 0, width, height);
carbon_win__window = [[NSWindow alloc] initWithContentRect:frame
styleMask:(NSWindowStyleMaskTitled |
NSWindowStyleMaskClosable |
NSWindowStyleMaskResizable)
backing:NSBackingStoreBuffered
defer:NO];
NSString *title = [NSString stringWithUTF8String:title];
[carbon_win__window setTitle:title];
carbon_win__window = [[NSWindow alloc]
initWithContentRect:frame
styleMask:(NSWindowStyleMaskTitled |
NSWindowStyleMaskClosable |
NSWindowStyleMaskResizable)
backing:NSBackingStoreBuffered
defer:NO];
NSString *win_title = [NSString stringWithUTF8String:title];
[carbon_win__window setTitle:win_title];
[carbon_win__window makeKeyAndOrderFront:nil];
// Add a custom view for drawing
carbon_win__view = [[NSView alloc] initWithFrame:frame];
[carbon_win__window setContentView:carbon_win__view];
// Track if the window is requested to close
carbon_win__should_close = NO;
// Setup window close notification
[[NSNotificationCenter defaultCenter] addObserverForName:NSWindowWillCloseNotification
object:carbon_win__window
queue:nil
usingBlock:^(NSNotification *note) { carbon_win__should_close = YES; }];
[[NSNotificationCenter defaultCenter]
addObserverForName:NSWindowWillCloseNotification
object:carbon_win__window
queue:nil
usingBlock:^(__unused NSNotification *note) { carbon_win__should_close = YES; }];
[carbon_win__app finishLaunching];
}
}
Expand Down

0 comments on commit 4f0fd4a

Please sign in to comment.