[gtk+/wip/csd: 422/429] window: Add support for enabling client decorations on non-Wayland
- From: Rob Bradford <rbradford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/csd: 422/429] window: Add support for enabling client decorations on non-Wayland
- Date: Tue, 22 Jan 2013 18:05:09 +0000 (UTC)
commit bc0d01ba6ed28090773a1d92da7885164bb2e3d1
Author: Rob Bradford <rob linux intel com>
Date: Fri Apr 13 15:06:55 2012 +0100
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.
gtk/gtkwindow.c | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 49b0be8..0efca6d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -3417,7 +3417,7 @@ gtk_window_set_decorated (GtkWindow *window,
gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
if (gdk_window)
{
- if (priv->decorated)
+ if (priv->decorated && !priv->client_decorated)
gdk_window_set_decorations (gdk_window,
GDK_DECOR_ALL);
else
@@ -4858,21 +4858,36 @@ create_decoration (GtkWidget *widget)
GtkStyleContext *context;
const char *title = "GtkWindow";
- /* Decorations already created */
+ /* Client decorations already created */
if (priv->client_decorated)
return;
-#ifdef GDK_WINDOWING_WAYLAND
- if (!GDK_IS_WAYLAND_DISPLAY_MANAGER (gdk_display_manager_get ()))
+ /* No decorations at all */
+ if (!priv->decorated)
return;
-#else
- return;
+
+#ifdef GDK_WINDOWING_WAYLAND
+ if (GDK_IS_WAYLAND_DISPLAY_MANAGER (gdk_display_manager_get ()))
+ priv->client_decorated = TRUE;
#endif
- if (!priv->decorated)
- return;
+ if (!priv->client_decorated &&
+ g_getenv ("GTK_CSD") &&
+ g_str_equal (g_getenv ("GTK_CSD"), "1"))
+ {
+ 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;
if (priv->type != GTK_WINDOW_POPUP)
{
@@ -5412,7 +5427,7 @@ gtk_window_realize (GtkWidget *widget)
if (priv->wm_role)
gdk_window_set_role (gdk_window, priv->wm_role);
- if (!priv->decorated)
+ if (!priv->decorated || priv->client_decorated)
gdk_window_set_decorations (gdk_window, 0);
if (!priv->deletable)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]