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.
This commit is contained in:
Cosimo Cecchi 2013-03-21 08:46:43 -04:00
parent 2d13802f62
commit 4bcaadac51

View File

@ -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 static void
create_decoration (GtkWidget *widget) create_decoration (GtkWidget *widget)
{ {
@ -5156,7 +5172,7 @@ create_decoration (GtkWidget *widget)
#ifdef GDK_WINDOWING_WAYLAND #ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget))) if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
priv->client_decorated = TRUE; set_client_decorated (widget, TRUE);
#endif #endif
if (!priv->client_decorated && if (!priv->client_decorated &&
@ -5169,7 +5185,7 @@ create_decoration (GtkWidget *widget)
if (visual) if (visual)
{ {
gtk_widget_set_visual (widget, visual); gtk_widget_set_visual (widget, visual);
priv->client_decorated = TRUE; set_client_decorated (widget, TRUE);
} }
} }