Wayland GNOME: titlebar color now follows system theme

When GNOME system theme is default, the color matches the background
color. When it is dark it is dark.
This commit is contained in:
Kovid Goyal
2024-04-04 21:49:32 +05:30
parent bdfa57039c
commit 1bffe89b5d
17 changed files with 85 additions and 46 deletions

View File

@@ -1012,13 +1012,11 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)viewDidChangeEffectiveAppearance
{
static int appearance = 0;
if (_glfw.callbacks.system_color_theme_change) {
int new_appearance = glfwGetCurrentSystemColorTheme();
if (new_appearance != appearance) {
appearance = new_appearance;
_glfw.callbacks.system_color_theme_change(appearance);
}
static GLFWColorScheme appearance = GLFW_COLOR_SCHEME_NO_PREFERENCE;
GLFWColorScheme new_appearance = glfwGetCurrentSystemColorTheme();
if (new_appearance != appearance) {
appearance = new_appearance;
_glfwInputColorScheme(appearance);
}
}
@@ -3143,7 +3141,7 @@ GLFWAPI void glfwCocoaSetWindowChrome(GLFWwindow *w, unsigned int color, bool us
[window->ns.object makeFirstResponder:window->ns.view];
}}
GLFWAPI int glfwGetCurrentSystemColorTheme(void) {
GLFWAPI GLFWColorScheme glfwGetCurrentSystemColorTheme(void) {
int theme_type = 0;
NSAppearance *changedAppearance = NSApp.effectiveAppearance;
NSAppearanceName newAppearance = [changedAppearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];