Skip to content

Commit 2cad11d

Browse files
committed
master: minimal exit menu added for Mac build
1 parent 3bfb527 commit 2cad11d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

window/window_darwin.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@ int Run(void) {
1818
return 0;
1919
}
2020
21+
void MinimalMenu(void) {
22+
23+
id menubar = [[NSMenu new] autorelease];
24+
id appMenuItem = [[NSMenuItem new] autorelease];
25+
[menubar addItem:appMenuItem];
26+
[NSApp setMainMenu:menubar];
27+
id appMenu = [[NSMenu new] autorelease];
28+
id appName = [[NSProcessInfo processInfo] processName];
29+
id quitTitle = [@"Quit " stringByAppendingString:appName];
30+
id quitMenuItem = [[[NSMenuItem alloc] initWithTitle:quitTitle
31+
action:@selector(terminate:) keyEquivalent:@"q"]
32+
autorelease];
33+
34+
[appMenu addItem:quitMenuItem];
35+
[appMenuItem setSubmenu:appMenu];
36+
}
37+
2138
void SetWindowTitle(void * w, char * title) {
2239
[[(NSView*)w window] setTitle:[NSString stringWithUTF8String:title]];
2340
}
@@ -64,5 +81,6 @@ func (s *Window) Show() {
6481

6582
func (s *Window) Run() {
6683
s.run()
84+
C.MinimalMenu()
6785
C.Run()
6886
}

0 commit comments

Comments
 (0)