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
This commit is contained in:
parent
da4486b833
commit
4f3b03e13b
@ -99,6 +99,7 @@ struct _MetaWindow
|
|||||||
char *wm_client_machine;
|
char *wm_client_machine;
|
||||||
char *startup_id;
|
char *startup_id;
|
||||||
char *mutter_hints;
|
char *mutter_hints;
|
||||||
|
char *gtk_theme_variant;
|
||||||
|
|
||||||
int net_wm_pid;
|
int net_wm_pid;
|
||||||
|
|
||||||
|
@ -1517,6 +1517,32 @@ reload_transient_for (MetaWindow *window,
|
|||||||
meta_window_propagate_focus_appearance (window, TRUE);
|
meta_window_propagate_focus_appearance (window, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
g_free (current_variant);
|
||||||
|
|
||||||
|
if (requested_variant)
|
||||||
|
window->gtk_theme_variant = g_strdup (requested_variant);
|
||||||
|
else
|
||||||
|
window->gtk_theme_variant = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the property hooks system. Each row in the table named "hooks"
|
* 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
|
* represents an action to take when a property is found on a newly-created
|
||||||
@ -1569,6 +1595,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
|
|||||||
{ display->atom__NET_WM_STATE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_state, TRUE, FALSE },
|
{ display->atom__NET_WM_STATE, META_PROP_VALUE_ATOM_LIST, reload_net_wm_state, TRUE, FALSE },
|
||||||
{ display->atom__MOTIF_WM_HINTS, META_PROP_VALUE_MOTIF_HINTS, reload_mwm_hints, TRUE, FALSE },
|
{ display->atom__MOTIF_WM_HINTS, META_PROP_VALUE_MOTIF_HINTS, reload_mwm_hints, TRUE, FALSE },
|
||||||
{ XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for, TRUE, FALSE },
|
{ XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for, TRUE, FALSE },
|
||||||
|
{ display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, TRUE, FALSE },
|
||||||
{ display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window, TRUE, FALSE },
|
{ display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window, TRUE, FALSE },
|
||||||
{ display->atom_WM_STATE, META_PROP_VALUE_INVALID, NULL, FALSE, FALSE },
|
{ display->atom_WM_STATE, META_PROP_VALUE_INVALID, NULL, FALSE, FALSE },
|
||||||
{ display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, FALSE, FALSE },
|
{ display->atom__NET_WM_ICON, META_PROP_VALUE_INVALID, reload_net_wm_icon, FALSE, FALSE },
|
||||||
|
@ -195,6 +195,7 @@ meta_window_finalize (GObject *object)
|
|||||||
g_free (window->title);
|
g_free (window->title);
|
||||||
g_free (window->icon_name);
|
g_free (window->icon_name);
|
||||||
g_free (window->desc);
|
g_free (window->desc);
|
||||||
|
g_free (window->gtk_theme_variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -58,6 +58,7 @@ item(_MUTTER_RELOAD_THEME_MESSAGE)
|
|||||||
item(_MUTTER_SET_KEYBINDINGS_MESSAGE)
|
item(_MUTTER_SET_KEYBINDINGS_MESSAGE)
|
||||||
item(_MUTTER_TOGGLE_VERBOSE)
|
item(_MUTTER_TOGGLE_VERBOSE)
|
||||||
item(_MUTTER_HINTS)
|
item(_MUTTER_HINTS)
|
||||||
|
item(_GTK_THEME_VARIANT)
|
||||||
item(_GNOME_WM_KEYBINDINGS)
|
item(_GNOME_WM_KEYBINDINGS)
|
||||||
item(_GNOME_PANEL_ACTION)
|
item(_GNOME_PANEL_ACTION)
|
||||||
item(_GNOME_PANEL_ACTION_MAIN_MENU)
|
item(_GNOME_PANEL_ACTION_MAIN_MENU)
|
||||||
|
Loading…
Reference in New Issue
Block a user