osdep/mac: make mac naming of files, folders and function consistent

rename all macOS namings (osx, macosx, macOS, macos, apple) to mac, to
make naming consistent.
This commit is contained in:
der richter 2024-02-27 16:55:29 +01:00
parent 661f45377a
commit 86fa9b18a3
35 changed files with 72 additions and 72 deletions

View File

@ -27,7 +27,7 @@
#include "common/msg.h"
#include "audio/out/ao.h"
#include "internal.h"
#include "osdep/apple_utils.h"
#include "osdep/utils-mac.h"
bool check_ca_st(struct ao *ao, int level, OSStatus code, const char *message);

View File

@ -50,7 +50,7 @@
#include "common/common.h"
#if HAVE_COCOA
#include "osdep/macosx_events.h"
#include "osdep/mac/events.h"
#endif
#define input_lock(ictx) mp_mutex_lock(&ictx->mutex)

View File

@ -249,7 +249,7 @@ sources = files(
## osdep
'osdep/io.c',
'osdep/semaphore_osx.c',
'osdep/semaphore-mac.c',
'osdep/subprocess.c',
'osdep/timer.c',
@ -391,13 +391,13 @@ cocoa = dependency('appleframeworks', modules: ['Cocoa', 'IOKit', 'QuartzCore'],
features += {'cocoa': cocoa.found()}
if features['cocoa']
dependencies += cocoa
sources += files('osdep/apple_utils.c',
'osdep/language-apple.c',
'osdep/macosx_application.m',
'osdep/macosx_events.m',
'osdep/macosx_menubar.m',
'osdep/main-fn-cocoa.c',
'osdep/path-macosx.m')
sources += files('osdep/language-mac.c',
'osdep/main-fn-mac.c',
'osdep/path-mac.m',
'osdep/utils-mac.c',
'osdep/mac/application.m',
'osdep/mac/events.m',
'osdep/mac/menubar.m')
endif
if posix
@ -530,16 +530,16 @@ features += {'vt.h': cc.has_header_symbol('sys/vt.h', 'VT_GETMODE')}
features += {'consio.h': not features['vt.h'] and cc.has_header_symbol('sys/consio.h', 'VT_GETMODE')}
# macOS's pthread_setname_np is a special snowflake and differs from literally every other platform.
features += {'osx-thread-name': darwin}
features += {'mac-thread-name': darwin}
features += {'glibc-thread-name': false}
if not features['osx-thread-name']
if not features['mac-thread-name']
features += {'glibc-thread-name': posix and cc.has_function('pthread_setname_np', args: '-D_GNU_SOURCE',
dependencies: pthreads, prefix: '#include <pthread.h>')}
endif
features += {'bsd-thread-name': false}
if not features['osx-thread-name'] and not features['glibc-thread-name']
if not features['mac-thread-name'] and not features['glibc-thread-name']
features += {'bsd-thread-name': posix and cc.has_function('pthread_set_name_np', dependencies: pthreads,
prefix: '#include <pthread.h>\n#include <pthread_np.h>')}
endif
@ -1513,12 +1513,12 @@ features += {'swift': swift.allowed()}
swift_sources = []
if features['cocoa'] and features['swift']
swift_sources += files('osdep/macos/libmpv_helper.swift',
'osdep/macos/log_helper.swift',
'osdep/macos/mpv_helper.swift',
'osdep/macos/precise_timer.swift',
'osdep/macos/swift_compat.swift',
'osdep/macos/swift_extensions.swift',
swift_sources += files('osdep/mac/libmpv_helper.swift',
'osdep/mac/log_helper.swift',
'osdep/mac/mpv_helper.swift',
'osdep/mac/precise_timer.swift',
'osdep/mac/swift_compat.swift',
'osdep/mac/swift_extensions.swift',
'video/out/mac/common.swift',
'video/out/mac/title_bar.swift',
'video/out/mac/view.swift',
@ -1546,11 +1546,11 @@ macos_media_player = get_option('macos-media-player').require(
)
features += {'macos-media-player': macos_media_player.allowed()}
if features['macos-media-player']
swift_sources += files('osdep/macos/remote_command_center.swift')
swift_sources += files('osdep/mac/remote_command_center.swift')
endif
if features['swift'] and swift_sources.length() > 0
subdir('osdep')
subdir('osdep/mac')
endif
macos_touchbar = get_option('macos-touchbar').require(
@ -1559,7 +1559,7 @@ macos_touchbar = get_option('macos-touchbar').require(
)
features += {'macos-touchbar': macos_touchbar.allowed()}
if features['macos-touchbar']
sources += files('osdep/macosx_touchbar.m')
sources += files('osdep/mac/touchbar.m')
endif

View File

@ -43,7 +43,7 @@
// In order of decreasing priority: the first has highest priority.
static const mp_get_platform_path_cb path_resolvers[] = {
#if HAVE_COCOA
mp_get_platform_path_osx,
mp_get_platform_path_mac,
#endif
#if HAVE_DARWIN
mp_get_platform_path_darwin,

View File

@ -19,7 +19,7 @@
#include "misc/language.h"
#include "apple_utils.h"
#include "utils-mac.h"
#include "mpv_talloc.h"
char **mp_get_user_langs(void)

View File

@ -15,10 +15,10 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPV_MACOSX_APPLICATION
#define MPV_MACOSX_APPLICATION
#ifndef MAC_APPLICATION
#define MAC_APPLICATION
#include "osdep/macosx_menubar.h"
#include "osdep/mac/menubar.h"
#include "options/m_option.h"
enum {
@ -51,4 +51,4 @@ void cocoa_register_menu_item_action(MPMenuKey key, void* action);
extern const struct m_sub_options macos_conf;
#endif /* MPV_MACOSX_APPLICATION */
#endif /* MAC_APPLICATION */

View File

@ -25,16 +25,16 @@
#include "options/m_config.h"
#include "options/options.h"
#import "osdep/macosx_application_objc.h"
#import "osdep/macosx_events_objc.h"
#import "osdep/mac/application_objc.h"
#import "osdep/mac/events_objc.h"
#include "osdep/threads.h"
#include "osdep/main-fn.h"
#if HAVE_MACOS_TOUCHBAR
#import "osdep/macosx_touchbar.h"
#import "osdep/mac/touchbar.h"
#endif
#if HAVE_SWIFT
#include "osdep/macOS_swift.h"
#include "osdep/mac/swift.h"
#endif
#define MPV_PROTOCOL @"mpv://"
@ -145,15 +145,15 @@ static void terminate_cocoa_application(void)
[super dealloc];
}
static const char macosx_icon[] =
static const char mac_icon[] =
#include "TOOLS/osxbundle/icon.icns.inc"
;
- (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) - 1
NSData *icon_data = [NSData dataWithBytesNoCopy:(void *)mac_icon
length:sizeof(mac_icon) - 1
freeWhenDone:NO];
return [[NSImage alloc] initWithData:icon_data];
}

View File

@ -16,8 +16,8 @@
*/
#import <Cocoa/Cocoa.h>
#include "osdep/macosx_application.h"
#import "osdep/macosx_menubar_objc.h"
#include "osdep/mac/application.h"
#import "osdep/mac/menubar_objc.h"
@class CocoaCB;
struct mpv_event;

View File

@ -17,8 +17,8 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MACOSX_EVENTS_H
#define MACOSX_EVENTS_H
#ifndef MAC_EVENTS
#define MAC_EVENTS
#include "input/keycodes.h"
struct input_ctx;

View File

@ -33,13 +33,13 @@
// doesn't make much sense, but needed to access keymap functionality
#include "video/out/vo.h"
#import "osdep/macosx_events_objc.h"
#import "osdep/macosx_application_objc.h"
#import "osdep/mac/events_objc.h"
#import "osdep/mac/application_objc.h"
#include "config.h"
#if HAVE_SWIFT
#include "osdep/macOS_swift.h"
#include "osdep/mac/swift.h"
#endif
@interface EventsResponder ()

View File

@ -18,7 +18,7 @@
*/
#import <Cocoa/Cocoa.h>
#include "osdep/macosx_events.h"
#include "osdep/mac/events.h"
@class RemoteCommandCenter;
struct input_ctx;

View File

@ -15,8 +15,8 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPV_MACOSX_MENU
#define MPV_MACOSX_MENU
#ifndef MAC_MENUBAR
#define MAC_MENUBAR
// Menu Keys identifying menu items
typedef enum {
@ -27,4 +27,4 @@ typedef enum {
MPM_ZOOM,
} MPMenuKey;
#endif /* MPV_MACOSX_MENU */
#endif /* MAC_MENUBAR */

View File

@ -18,8 +18,8 @@
#include "config.h"
#include "common/common.h"
#import "macosx_menubar_objc.h"
#import "osdep/macosx_application_objc.h"
#import "osdep/mac/menubar_objc.h"
#import "osdep/mac/application_objc.h"
@implementation MenuBar
{

View File

@ -16,7 +16,7 @@
*/
#import <Cocoa/Cocoa.h>
#include "osdep/macosx_menubar.h"
#include "osdep/mac/menubar.h"
@interface MenuBar : NSObject

View File

@ -1,8 +1,8 @@
# custom swift targets
bridge = join_paths(source_root, 'osdep/macOS_swift_bridge.h')
header = join_paths(build_root, 'osdep/macOS_swift.h')
module = join_paths(build_root, 'osdep/macOS_swift.swiftmodule')
target = join_paths(build_root, 'osdep/macOS_swift.o')
bridge = join_paths(source_root, 'osdep/mac/swift_bridge.h')
header = join_paths(build_root, 'osdep/mac/swift.h')
module = join_paths(build_root, 'osdep/mac/swift.swiftmodule')
target = join_paths(build_root, 'osdep/mac/swift.o')
swift_flags = ['-frontend', '-c', '-sdk', macos_sdk_path,
'-enable-objc-interop', '-emit-objc-header', '-parse-as-library']
@ -22,7 +22,7 @@ endif
extra_flags = get_option('swift-flags').split()
swift_flags += extra_flags
swift_compile = [swift_prog, swift_flags, '-module-name', 'macOS_swift',
swift_compile = [swift_prog, swift_flags, '-module-name', 'swift',
'-emit-module-path', '@OUTPUT0@', '-import-objc-header', bridge,
'-emit-objc-header-path', '@OUTPUT1@', '-o', '@OUTPUT2@',
'@INPUT@', '-I.', '-I' + source_root,
@ -31,7 +31,7 @@ swift_compile = [swift_prog, swift_flags, '-module-name', 'macOS_swift',
swift_targets = custom_target('swift_targets',
input: swift_sources,
output: ['macOS_swift.swiftmodule', 'macOS_swift.h', 'macOS_swift.o'],
output: ['swift.swiftmodule', 'swift.h', 'swift.o'],
command: swift_compile,
)
sources += swift_targets

View File

@ -30,8 +30,8 @@
#include "input/event.h"
#include "video/out/win_state.h"
#include "osdep/macosx_application_objc.h"
#include "osdep/macosx_events_objc.h"
#include "osdep/mac/application_objc.h"
#include "osdep/mac/events_objc.h"
// complex macros won't get imported to Swift so we have to reassign them

View File

@ -16,7 +16,7 @@
*/
#import <Cocoa/Cocoa.h>
#import "osdep/macosx_application_objc.h"
#import "osdep/mac/application_objc.h"
#define BASE_ID @"io.mpv.touchbar"
static NSTouchBarCustomizationIdentifier customID = BASE_ID;

View File

@ -16,7 +16,7 @@
*/
#include "player/client.h"
#import "macosx_touchbar.h"
#import "osdep/mac/touchbar.h"
@implementation TouchBar

View File

@ -1,4 +1,4 @@
#include "osdep/macosx_application.h"
#include "osdep/mac/application.h"
// This is needed because Cocoa absolutely requires creating the NSApplication
// singleton and running it in the "main" thread. It is apparently not

View File

@ -19,7 +19,7 @@
#include "options/path.h"
#include "osdep/path.h"
const char *mp_get_platform_path_osx(void *talloc_ctx, const char *type)
const char *mp_get_platform_path_mac(void *talloc_ctx, const char *type)
{
if (strcmp(type, "osxbundle") == 0 && getenv("MPVBUNDLE")) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

View File

@ -26,7 +26,7 @@ typedef const char *(*mp_get_platform_path_cb)(void *talloc_ctx, const char *typ
const char *mp_get_platform_path_darwin(void *talloc_ctx, const char *type);
const char *mp_get_platform_path_uwp(void *talloc_ctx, const char *type);
const char *mp_get_platform_path_win(void *talloc_ctx, const char *type);
const char *mp_get_platform_path_osx(void *talloc_ctx, const char *type);
const char *mp_get_platform_path_mac(void *talloc_ctx, const char *type);
const char *mp_get_platform_path_unix(void *talloc_ctx, const char *type);
#endif

View File

@ -23,7 +23,7 @@
#include "common/common.h"
#include "config.h"
// We make use of NON-POSIX pthreads functions and certain systems
// We make use of NON-POSIX pthreads functions and certain systems
// require this header to build without issues. (ex: OpenBSD)
#if HAVE_BSD_THREAD_NAME
#include <pthread_np.h>
@ -235,7 +235,7 @@ static inline void mp_thread_set_name(const char *name)
}
#elif HAVE_BSD_THREAD_NAME
pthread_set_name_np(pthread_self(), name);
#elif HAVE_OSX_THREAD_NAME
#elif HAVE_MAC_THREAD_NAME
pthread_setname_np(name);
#endif
}

View File

@ -17,7 +17,7 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include "apple_utils.h"
#include "utils-mac.h"
#include "mpv_talloc.h"

View File

@ -17,12 +17,12 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPV_APPLE_UTILS
#define MPV_APPLE_UTILS
#ifndef UTILS_MAC
#define UTILS_MAC
#include <CoreFoundation/CoreFoundation.h>
CFStringRef cfstr_from_cstr(const char *str);
char *cfstr_get_cstr(const CFStringRef cfstr);
#endif /* MPV_APPLE_UTILS */
#endif /* UTILS_MAC */

View File

@ -71,7 +71,7 @@ static const char def_config[] =
;
#if HAVE_COCOA
#include "osdep/macosx_events.h"
#include "osdep/mac/events.h"
#endif
#ifndef FULLCONFIG
@ -389,7 +389,7 @@ int mp_initialize(struct MPContext *mpctx, char **options)
MP_STATS(mpctx, "start init");
#if HAVE_COCOA
mpv_handle *ctx = mp_new_client(mpctx->clients, "osx");
mpv_handle *ctx = mp_new_client(mpctx->clients, "mac");
cocoa_set_mpv_handle(ctx);
#endif

View File

@ -28,7 +28,7 @@
#include "libmpv.h"
#if HAVE_MACOS_COCOA_CB
#include "osdep/macosx_events.h"
#include "osdep/mac/events.h"
#endif
/*

View File

@ -16,7 +16,7 @@
*/
#include "video/out/gpu/context.h"
#include "osdep/macOS_swift.h"
#include "osdep/mac/swift.h"
#include "common.h"
#include "context.h"