summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-05-21 13:37:01 -0400
committerVictor Kareh <[email protected]>2019-06-05 10:49:37 -0400
commitb57ab969c03612a0aaa1d9d8b6c0d67d13d9281f (patch)
treed450e9ac536b65a9355f7547504318b6929359aa /src
parentd05c1f4677ab3dda3ad2b5964a554aec8611fdcc (diff)
downloadmarco-b57ab969c03612a0aaa1d9d8b6c0d67d13d9281f.tar.bz2
marco-b57ab969c03612a0aaa1d9d8b6c0d67d13d9281f.tar.xz
window: Parse _GTK_THEME_VARIANT property
Since version 3.0, GTK+ has support for style variants. At the moment, themes may provide a dark variant, which can be requested by applications via GtkSettings. The requested variant is exported to X11 via the _GTK_THEME_VARIANT property - support this property, in order to pick up the correct style variant in the future. https://bugzilla.gnome.org/show_bug.cgi?id=645355 NOTE: Patch is adapted for marco. upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/341d0945
Diffstat (limited to 'src')
-rw-r--r--src/core/atomnames.h1
-rw-r--r--src/core/window-private.h1
-rw-r--r--src/core/window-props.c23
-rw-r--r--src/core/window.c2
4 files changed, 27 insertions, 0 deletions
diff --git a/src/core/atomnames.h b/src/core/atomnames.h
index 8e149060..3744f428 100644
--- a/src/core/atomnames.h
+++ b/src/core/atomnames.h
@@ -58,6 +58,7 @@ item(_MARCO_RESTART_MESSAGE)
item(_MARCO_RELOAD_THEME_MESSAGE)
item(_MARCO_SET_KEYBINDINGS_MESSAGE)
item(_MARCO_TOGGLE_VERBOSE)
+item(_GTK_THEME_VARIANT)
item(_GTK_FRAME_EXTENTS)
item(_GTK_SHOW_WINDOW_MENU)
item(_MATE_PANEL_ACTION)
diff --git a/src/core/window-private.h b/src/core/window-private.h
index a6b6418c..38184231 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -117,6 +117,7 @@ struct _MetaWindow
char *sm_client_id;
char *wm_client_machine;
char *startup_id;
+ char *gtk_theme_variant;
int net_wm_pid;
diff --git a/src/core/window-props.c b/src/core/window-props.c
index c3200290..0f492a5e 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -1530,6 +1530,28 @@ reload_transient_for (MetaWindow *window,
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}
+static void
+reload_gtk_theme_variant (MetaWindow *window,
+ MetaPropValue *value,
+ gboolean initial)
+{
+ char *requested_variant = NULL;
+ char *current_variant = window->gtk_theme_variant;
+
+ if (value->type != META_PROP_VALUE_INVALID)
+ {
+ requested_variant = value->v.str;
+ meta_verbose ("Requested \"%s\" theme variant for window %s.\n",
+ requested_variant, window->desc);
+ }
+
+ if (g_strcmp0 (requested_variant, current_variant) != 0)
+ {
+ g_free (current_variant);
+
+ window->gtk_theme_variant = g_strdup (requested_variant);
+ }
+}
/**
* Initialises the property hooks system. Each row in the table named "hooks"
* represents an action to take when a property is found on a newly-created
@@ -1576,6 +1598,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ XA_WM_HINTS, META_PROP_VALUE_WM_HINTS, reload_wm_hints },
{ XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for },
{ display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window },
+ { display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, },
{ display->atom__GTK_FRAME_EXTENTS, META_PROP_VALUE_CARDINAL_LIST, reload_gtk_frame_extents },
{ 0 },
};
diff --git a/src/core/window.c b/src/core/window.c
index 7c8a19a9..1c4b5cc6 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -561,6 +561,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->sm_client_id = NULL;
window->wm_client_machine = NULL;
window->startup_id = NULL;
+ window->gtk_theme_variant = NULL;
window->net_wm_pid = -1;
@@ -1229,6 +1230,7 @@ meta_window_free (MetaWindow *window,
g_free (window->title);
g_free (window->icon_name);
g_free (window->desc);
+ g_free (window->gtk_theme_variant);
g_free (window);
}