summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2019-03-29 20:39:42 +0100
committerJan Ekström <jeebjp@gmail.com>2019-04-02 02:09:01 +0300
commit90e44d3ff2182749da8d7d255bef15fd99c18eee (patch)
treea20a2aa8bb26e8b9340aecb96cc9085b1475a2f9 /osdep
parent837e5058ff110247229057f7ab182a041d1c98b8 (diff)
downloadmpv-90e44d3ff2182749da8d7d255bef15fd99c18eee.tar.bz2
mpv-90e44d3ff2182749da8d7d255bef15fd99c18eee.tar.xz
cocoa-cb: add support for custom colored title bar
Diffstat (limited to 'osdep')
-rw-r--r--osdep/macOS_mpv_helper.swift1
-rw-r--r--osdep/macOS_swift_extensions.swift13
-rw-r--r--osdep/macosx_application.h2
-rw-r--r--osdep/macosx_application.m2
4 files changed, 18 insertions, 0 deletions
diff --git a/osdep/macOS_mpv_helper.swift b/osdep/macOS_mpv_helper.swift
index b456c8d59e..fe747db08c 100644
--- a/osdep/macOS_mpv_helper.swift
+++ b/osdep/macOS_mpv_helper.swift
@@ -59,6 +59,7 @@ class MPVHelper: NSObject {
mpv_observe_property(mpvHandle, 0, "macos-title-bar-style", MPV_FORMAT_STRING)
mpv_observe_property(mpvHandle, 0, "macos-title-bar-appearance", MPV_FORMAT_STRING)
mpv_observe_property(mpvHandle, 0, "macos-title-bar-material", MPV_FORMAT_STRING)
+ mpv_observe_property(mpvHandle, 0, "macos-title-bar-color", MPV_FORMAT_STRING)
}
func initRender() {
diff --git a/osdep/macOS_swift_extensions.swift b/osdep/macOS_swift_extensions.swift
index 14d217f589..cc7438fd8c 100644
--- a/osdep/macOS_swift_extensions.swift
+++ b/osdep/macOS_swift_extensions.swift
@@ -56,3 +56,16 @@ extension NSScreen {
}
}
}
+
+extension NSColor {
+
+ convenience init(hex: String) {
+ let int = Int(hex.dropFirst(), radix: 16)
+ let alpha = CGFloat((int! >> 24) & 0x000000FF)/255
+ let red = CGFloat((int! >> 16) & 0x000000FF)/255
+ let green = CGFloat((int! >> 8) & 0x000000FF)/255
+ let blue = CGFloat((int!) & 0x000000FF)/255
+
+ self.init(calibratedRed: red, green: green, blue: blue, alpha: alpha)
+ }
+}
diff --git a/osdep/macosx_application.h b/osdep/macosx_application.h
index 5f33a384f2..7c22abaf84 100644
--- a/osdep/macosx_application.h
+++ b/osdep/macosx_application.h
@@ -19,11 +19,13 @@
#define MPV_MACOSX_APPLICATION
#include "osdep/macosx_menubar.h"
+#include "options/m_option.h"
struct macos_opts {
int macos_title_bar_style;
int macos_title_bar_appearance;
int macos_title_bar_material;
+ struct m_color macos_title_bar_color;
int macos_fs_animation_duration;
int cocoa_cb_sw_renderer;
};
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m
index 4653b7177d..08b3fce901 100644
--- a/osdep/macosx_application.m
+++ b/osdep/macosx_application.m
@@ -57,6 +57,7 @@ const struct m_sub_options macos_conf = {
{"underWindowBackground", 12}, {"underPageBackground", 13},
{"dark", 14}, {"light", 15}, {"mediumLight", 16},
{"ultraDark", 17})),
+ OPT_COLOR("macos-title-bar-color", macos_title_bar_color, 0),
OPT_CHOICE_OR_INT("macos-fs-animation-duration",
macos_fs_animation_duration, 0, 0, 1000,
({"default", -1})),
@@ -68,6 +69,7 @@ const struct m_sub_options macos_conf = {
},
.size = sizeof(struct macos_opts),
.defaults = &(const struct macos_opts){
+ .macos_title_bar_color = {0, 0, 0, 0},
.macos_fs_animation_duration = -1,
.cocoa_cb_sw_renderer = -1,
},