diff options
Diffstat (limited to 'src/macos.m')
-rw-r--r-- | src/macos.m | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/macos.m b/src/macos.m index d588fa4a..298db0f8 100644 --- a/src/macos.m +++ b/src/macos.m | |||
@@ -30,6 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
30 | #include "ui/window.h" | 30 | #include "ui/window.h" |
31 | 31 | ||
32 | #include <SDL_timer.h> | 32 | #include <SDL_timer.h> |
33 | #include <SDL_syswm.h> | ||
33 | 34 | ||
34 | #import <AppKit/AppKit.h> | 35 | #import <AppKit/AppKit.h> |
35 | 36 | ||
@@ -51,6 +52,16 @@ static iInt2 macVer_(void) { | |||
51 | return init_I2(10, 10); | 52 | return init_I2(10, 10); |
52 | } | 53 | } |
53 | 54 | ||
55 | static NSWindow *nsWindow_(SDL_Window *window) { | ||
56 | SDL_SysWMinfo wm; | ||
57 | SDL_VERSION(&wm.version); | ||
58 | if (SDL_GetWindowWMInfo(window, &wm)) { | ||
59 | return wm.info.cocoa.window; | ||
60 | } | ||
61 | iAssert(false); | ||
62 | return nil; | ||
63 | } | ||
64 | |||
54 | static NSString *currentSystemAppearance_(void) { | 65 | static NSString *currentSystemAppearance_(void) { |
55 | /* This API does not exist on 10.13. */ | 66 | /* This API does not exist on 10.13. */ |
56 | if ([NSApp respondsToSelector:@selector(effectiveAppearance)]) { | 67 | if ([NSApp respondsToSelector:@selector(effectiveAppearance)]) { |
@@ -370,6 +381,11 @@ void setupApplication_MacOS(void) { | |||
370 | windowCloseItem.action = @selector(closeTab); | 381 | windowCloseItem.action = @selector(closeTab); |
371 | } | 382 | } |
372 | 383 | ||
384 | void hideTitleBar_MacOS(iWindow *window) { | ||
385 | NSWindow *w = nsWindow_(window->win); | ||
386 | w.styleMask = 0; /* borderless */ | ||
387 | } | ||
388 | |||
373 | void enableMenu_MacOS(const char *menuLabel, iBool enable) { | 389 | void enableMenu_MacOS(const char *menuLabel, iBool enable) { |
374 | menuLabel = translateCStr_Lang(menuLabel); | 390 | menuLabel = translateCStr_Lang(menuLabel); |
375 | NSApplication *app = [NSApplication sharedApplication]; | 391 | NSApplication *app = [NSApplication sharedApplication]; |
@@ -377,7 +393,6 @@ void enableMenu_MacOS(const char *menuLabel, iBool enable) { | |||
377 | NSString *label = [NSString stringWithUTF8String:menuLabel]; | 393 | NSString *label = [NSString stringWithUTF8String:menuLabel]; |
378 | NSMenuItem *menuItem = [appMenu itemAtIndex:[appMenu indexOfItemWithTitle:label]]; | 394 | NSMenuItem *menuItem = [appMenu itemAtIndex:[appMenu indexOfItemWithTitle:label]]; |
379 | [menuItem setEnabled:enable]; | 395 | [menuItem setEnabled:enable]; |
380 | [label release]; | ||
381 | } | 396 | } |
382 | 397 | ||
383 | void enableMenuItem_MacOS(const char *menuItemCommand, iBool enable) { | 398 | void enableMenuItem_MacOS(const char *menuItemCommand, iBool enable) { |