mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
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.
This commit is contained in:
parent
f17b7136dd
commit
b141121ef6
@ -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;
|
||||
|
||||
priv->client_decorated = TRUE;
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!priv->client_decorated)
|
||||
return;
|
||||
|
||||
priv->title_box = gtk_header_bar_new ();
|
||||
g_object_set (priv->title_box,
|
||||
|
Loading…
Reference in New Issue
Block a user