From 4bcaadac512ede175b6b2063b6b40762c236b613 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 21 Mar 2013 08:46:43 -0400 Subject: [PATCH] window: add a "client-decorated" style class when the window is so The theme might want to apply some specific theming to a client decorated toplevel window, so add a style class for that. --- gtk/gtkwindow.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 94f0f0b5a7..2d047a2d2e 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -5136,6 +5136,22 @@ update_window_buttons (GtkWindow *window) } } +static void +set_client_decorated (GtkWidget *widget, + gboolean value) +{ + GtkStyleContext *context; + GtkWindowPrivate *priv = GTK_WINDOW (widget)->priv; + + context = gtk_widget_get_style_context (widget); + priv->client_decorated = value; + + if (value) + gtk_style_context_add_class (context, "client-decorated"); + else + gtk_style_context_remove_class (context, "client-decorated"); +} + static void create_decoration (GtkWidget *widget) { @@ -5156,7 +5172,7 @@ create_decoration (GtkWidget *widget) #ifdef GDK_WINDOWING_WAYLAND if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget))) - priv->client_decorated = TRUE; + set_client_decorated (widget, TRUE); #endif if (!priv->client_decorated && @@ -5169,7 +5185,7 @@ create_decoration (GtkWidget *widget) if (visual) { gtk_widget_set_visual (widget, visual); - priv->client_decorated = TRUE; + set_client_decorated (widget, TRUE); } }