[gtk+/client-side-decorations: 45/92] hide and show min/max buttons based on GdmWMDecorations value



commit fe8ad4d746efd095737d43c98c4f9ca2d3199fc5
Author: Cody Russell <crussell canonical com>
Date:   Sun Jul 5 23:26:27 2009 +0100

    hide and show min/max buttons based on GdmWMDecorations value

 gtk/gtkwindow.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index db8f4d3..6c7f4ab 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1506,6 +1506,36 @@ close_button_clicked (GtkWidget *widget, gpointer data)
 }
 
 static void
+update_window_buttons (GtkWindow *window)
+{
+  GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
+
+  if (is_client_side_decorated (window))
+    {
+      // XXX: should this be using GdkWMFunction instead?
+      if (priv->client_side_decorations & GDK_DECOR_MINIMIZE)
+        {
+          gtk_widget_show_all (priv->min_button);
+        }
+      else
+        {
+          gtk_widget_hide (priv->min_button);
+        }
+
+      if (priv->client_side_decorations & GDK_DECOR_MAXIMIZE)
+        {
+          gtk_widget_show_all (priv->max_button);
+        }
+      else
+        {
+          gtk_widget_hide (priv->max_button);
+        }
+
+      // close?
+    }
+}
+
+static void
 ensure_title_box (GtkWindow *window)
 {
   GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
@@ -1552,6 +1582,8 @@ ensure_title_box (GtkWindow *window)
       priv->button_box = hbox;
 
       gtk_widget_show_all (priv->button_box);
+
+      update_window_buttons (window);
     }
 }
 
@@ -3250,6 +3282,8 @@ gtk_window_set_client_side_decorations (GtkWindow       *window,
             }
         }
     }
+
+  update_window_buttons (window);
 }
 
 GdkWMDecoration



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]