diff options
author | James Cowgill <jcowgill@debian.org> | 2018-10-03 09:34:22 +0100 |
---|---|---|
committer | James Cowgill <jcowgill@debian.org> | 2018-10-03 09:34:22 +0100 |
commit | 53c5af1f24eb774765dc0ec81c6457a6a2f84076 (patch) | |
tree | b3b785d0d7f8e1bbc050acd6f0c85868d333c8f3 /osdep | |
parent | 7fb3e8f1e88579eff44672d7fa3103f4b078303e (diff) | |
parent | a6680ec06c4f17bb7b60c18ebd611ef40c5c6d68 (diff) |
Update upstream source from tag 'upstream/0.29.1'
Update to upstream version '0.29.1'
with Debian dir 31f7cc19e4c61d2b1ab2b256ef78d996fe64b422
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/macOS_mpv_helper.swift | 6 | ||||
-rw-r--r-- | osdep/macosx_application.h | 1 | ||||
-rw-r--r-- | osdep/macosx_application.m | 6 | ||||
-rw-r--r-- | osdep/macosx_events.m | 21 | ||||
-rw-r--r-- | osdep/macosx_menubar.m | 4 |
5 files changed, 26 insertions, 12 deletions
diff --git a/osdep/macOS_mpv_helper.swift b/osdep/macOS_mpv_helper.swift index e1fb3cf..a1bb03f 100644 --- a/osdep/macOS_mpv_helper.swift +++ b/osdep/macOS_mpv_helper.swift @@ -45,6 +45,12 @@ class MPVHelper: NSObject { mpctx = UnsafeMutablePointer<MPContext>(mp_client_get_core(mpvHandle)) inputContext = mpctx!.pointee.input + if let app = NSApp as? Application { + let ptr = mp_get_config_group(mpctx!, mp_client_get_global(mpvHandle), + app.getMacOSConf()) + macOpts = UnsafeMutablePointer<macos_opts>(OpaquePointer(ptr))!.pointee + } + mpv_observe_property(mpvHandle, 0, "ontop", MPV_FORMAT_FLAG) mpv_observe_property(mpvHandle, 0, "border", MPV_FORMAT_FLAG) mpv_observe_property(mpvHandle, 0, "keepaspect-window", MPV_FORMAT_FLAG) diff --git a/osdep/macosx_application.h b/osdep/macosx_application.h index c04f479..0301e49 100644 --- a/osdep/macosx_application.h +++ b/osdep/macosx_application.h @@ -23,6 +23,7 @@ struct macos_opts { int macos_title_bar_style; int macos_fs_animation_duration; + int cocoa_cb_sw_renderer; }; // multithreaded wrapper for mpv_main diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 66daa45..086d51f 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -49,11 +49,14 @@ const struct m_sub_options macos_conf = { OPT_CHOICE_OR_INT("macos-fs-animation-duration", macos_fs_animation_duration, 0, 0, 1000, ({"default", -1})), + OPT_CHOICE("cocoa-cb-sw-renderer", cocoa_cb_sw_renderer, 0, + ({"auto", -1}, {"no", 0}, {"yes", 1})), {0} }, .size = sizeof(struct macos_opts), .defaults = &(const struct macos_opts){ .macos_fs_animation_duration = -1, + .cocoa_cb_sw_renderer = -1, }, }; @@ -124,8 +127,9 @@ static const char macosx_icon[] = - (NSImage *)getMPVIcon { + // The C string contains a trailing null, so we strip it away NSData *icon_data = [NSData dataWithBytesNoCopy:(void *)macosx_icon - length:sizeof(macosx_icon) + length:sizeof(macosx_icon) - 1 freeWhenDone:NO]; return [[NSImage alloc] initWithData:icon_data]; } diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index 0d46c0e..a354378 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -375,7 +375,8 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx) - (void)restartMediaKeys { - CGEventTapEnable(self->_mk_tap_port, true); + if (self->_mk_tap_port) + CGEventTapEnable(self->_mk_tap_port, true); } - (void)setHighestPriotityMediaKeysTap @@ -410,10 +411,10 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx) tap_event_callback, self); - assert(self->_mk_tap_port != nil); - - NSMachPort *port = (NSMachPort *)self->_mk_tap_port; - [[NSRunLoop mainRunLoop] addPort:port forMode:NSRunLoopCommonModes]; + if (self->_mk_tap_port) { + NSMachPort *port = (NSMachPort *)self->_mk_tap_port; + [[NSRunLoop mainRunLoop] addPort:port forMode:NSRunLoopCommonModes]; + } }); } @@ -421,10 +422,12 @@ void cocoa_set_mpv_handle(struct mpv_handle *ctx) { dispatch_async(dispatch_get_main_queue(), ^{ NSMachPort *port = (NSMachPort *)self->_mk_tap_port; - CGEventTapEnable(self->_mk_tap_port, false); - [[NSRunLoop mainRunLoop] removePort:port forMode:NSRunLoopCommonModes]; - CFRelease(self->_mk_tap_port); - self->_mk_tap_port = nil; + if (port) { + CGEventTapEnable(self->_mk_tap_port, false); + [[NSRunLoop mainRunLoop] removePort:port forMode:NSRunLoopCommonModes]; + CFRelease(self->_mk_tap_port); + self->_mk_tap_port = nil; + } }); } diff --git a/osdep/macosx_menubar.m b/osdep/macosx_menubar.m index 931079a..558a33a 100644 --- a/osdep/macosx_menubar.m +++ b/osdep/macosx_menubar.m @@ -602,7 +602,7 @@ - (NSMenu *)mainMenu { NSMenu *mainMenu = [[NSMenu alloc] initWithTitle:@"MainMenu"]; - NSApp.servicesMenu = [NSMenu alloc]; + [NSApp setServicesMenu:[[NSMenu alloc] init]]; for(id mMenu in menuTree) { NSMenu *menu = [[NSMenu alloc] initWithTitle:mMenu[@"name"]]; @@ -633,7 +633,7 @@ } if ([subMenu[@"name"] isEqual:@"Services"]) { - iItem.submenu = NSApp.servicesMenu; + iItem.submenu = [NSApp servicesMenu]; } } } |