Commit b141121e authored by Matthias Clasen's avatar Matthias Clasen
Browse files

window: Add support for enabling client decorations on non-Wayland

Client side decorations can be enabled on non-Wayland platforms by
setting the GTK_CSD="1" environment variable.

We must ensure we have a GdkVisual that has an alpha channel since
the decorations rely on transparency. If we cannot get a visual with
an alpha channel then we do not enable client side decorations.
parent f17b7136
......@@ -4855,16 +4855,26 @@ create_decoration (GtkWidget *widget)
return;
#ifdef GDK_WINDOWING_WAYLAND
if (!GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
return;
#else
return;
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
priv->client_decorated = TRUE;
#endif
if (!priv->decorated)
return;
if (!priv->client_decorated &&
g_strcmp0 (g_getenv ("GTK_CSD"),"1") == 0)
{
GdkVisual *visual;
/* We need a visual with alpha */
visual = gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget));
if (visual)
{
gtk_widget_set_visual (widget, visual);
priv->client_decorated = TRUE;
}
}
priv->client_decorated = TRUE;
if (!priv->client_decorated)
return;
priv->title_box = gtk_header_bar_new ();
g_object_set (priv->title_box,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment