[gtk+/wip/csd: 5/9] 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: 5/9] window: Add support for enabling client decorations on non-Wayland
- Date: Fri, 27 Jul 2012 11:04:04 +0000 (UTC)
commit e4bfaa56c57c620aa89a35ea84581fc30c3d554e
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 e701406..0ee8d88 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -3406,7 +3406,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
@@ -4841,21 +4841,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)
{
@@ -5391,7 +5406,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]