mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
frames/window-tracker: Reinstate dark titlebar support
Merge request !2541 [1] introduced support for integrating Mutter frames with the dark style. This was lost after moving frames into a separate client. Bring that back. Don't depend on gdesktop-enums as it brings GTK3 into the header chain. [1] https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2541 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2739>
This commit is contained in:
parent
2fb3c5a4f5
commit
b3d4dbdbf1
@ -9,6 +9,7 @@ x11_frames_sources = [
|
|||||||
x11_frames = executable('mutter-x11-frames',
|
x11_frames = executable('mutter-x11-frames',
|
||||||
sources: x11_frames_sources,
|
sources: x11_frames_sources,
|
||||||
dependencies: [
|
dependencies: [
|
||||||
|
gsettings_desktop_schemas_dep,
|
||||||
gtk4_dep,
|
gtk4_dep,
|
||||||
x11_dep,
|
x11_dep,
|
||||||
xext_dep,
|
xext_dep,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "meta-frame.h"
|
#include "meta-frame.h"
|
||||||
|
|
||||||
|
#include <gdesktop-enums.h>
|
||||||
#include <gdk/x11/gdkx.h>
|
#include <gdk/x11/gdkx.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/extensions/XInput2.h>
|
#include <X11/extensions/XInput2.h>
|
||||||
@ -30,6 +31,9 @@
|
|||||||
struct _MetaWindowTracker
|
struct _MetaWindowTracker
|
||||||
{
|
{
|
||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
|
||||||
|
GSettings *interface_settings;
|
||||||
|
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
GHashTable *frames;
|
GHashTable *frames;
|
||||||
GHashTable *client_windows;
|
GHashTable *client_windows;
|
||||||
@ -84,6 +88,23 @@ meta_window_tracker_get_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_color_scheme_changed_cb (GSettings *interface_settings,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
MetaWindowTracker *window_tracker)
|
||||||
|
{
|
||||||
|
GDesktopColorScheme color_scheme;
|
||||||
|
gboolean is_dark;
|
||||||
|
|
||||||
|
color_scheme = g_settings_get_enum (window_tracker->interface_settings,
|
||||||
|
"color-scheme");
|
||||||
|
is_dark = color_scheme == G_DESKTOP_COLOR_SCHEME_PREFER_DARK;
|
||||||
|
|
||||||
|
g_object_set (gtk_settings_get_default (),
|
||||||
|
"gtk-application-prefer-dark-theme", is_dark,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_up_frame (MetaWindowTracker *window_tracker,
|
set_up_frame (MetaWindowTracker *window_tracker,
|
||||||
Window xwindow)
|
Window xwindow)
|
||||||
@ -346,6 +367,7 @@ meta_window_tracker_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
MetaWindowTracker *window_tracker = META_WINDOW_TRACKER (object);
|
MetaWindowTracker *window_tracker = META_WINDOW_TRACKER (object);
|
||||||
|
|
||||||
|
g_clear_object (&window_tracker->interface_settings);
|
||||||
g_clear_pointer (&window_tracker->frames,
|
g_clear_pointer (&window_tracker->frames,
|
||||||
g_hash_table_unref);
|
g_hash_table_unref);
|
||||||
g_clear_pointer (&window_tracker->client_windows,
|
g_clear_pointer (&window_tracker->client_windows,
|
||||||
@ -382,6 +404,12 @@ meta_window_tracker_class_init (MetaWindowTrackerClass *klass)
|
|||||||
static void
|
static void
|
||||||
meta_window_tracker_init (MetaWindowTracker *window_tracker)
|
meta_window_tracker_init (MetaWindowTracker *window_tracker)
|
||||||
{
|
{
|
||||||
|
window_tracker->interface_settings = g_settings_new ("org.gnome.desktop.interface");
|
||||||
|
g_signal_connect (window_tracker->interface_settings,
|
||||||
|
"changed::color-scheme",
|
||||||
|
G_CALLBACK (on_color_scheme_changed_cb),
|
||||||
|
window_tracker);
|
||||||
|
|
||||||
window_tracker->frames =
|
window_tracker->frames =
|
||||||
g_hash_table_new_full (NULL, NULL, NULL,
|
g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
(GDestroyNotify) gtk_window_destroy);
|
(GDestroyNotify) gtk_window_destroy);
|
||||||
|
Loading…
Reference in New Issue
Block a user