[gtk+/wip/csd] window: Hide the decorations on fullscreen



commit 116196f827244b87d2add971ad483456cb2190b0
Author: Rob Bradford <rob linux intel com>
Date:   Thu Jan 31 17:24:31 2013 +0000

    window: Hide the decorations on fullscreen

 gtk/gtkwindow.c |   39 ++++++++++++++++++++++++++++++---------
 1 files changed, 30 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 0ca584f..2d1f54a 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -201,6 +201,7 @@ struct _GtkWindowPrivate
                                             */
   guint    gravity                   : 5; /* GdkGravity */
   guint    client_decorated          : 1; /* Decorations drawn client-side */
+  guint    fullscreen                : 1;
 
 };
 
@@ -5731,7 +5732,8 @@ _gtk_window_set_allocation (GtkWindow     *window,
 
   if (priv->client_decorated && priv->decorated &&
       priv->title_box &&
-      gtk_widget_get_visual(priv->title_box))
+      gtk_widget_get_visual(priv->title_box) &&
+      !priv->fullscreen)
     {
       GtkAllocation title_allocation;
 
@@ -5748,7 +5750,7 @@ _gtk_window_set_allocation (GtkWindow     *window,
       gtk_widget_size_allocate (priv->title_box, &title_allocation);
     }
 
-  if (priv->client_decorated && priv->decorated)
+  if (priv->client_decorated && priv->decorated && !priv->fullscreen)
     {
       child_allocation.x += priv->window_border.left;
 
@@ -5876,11 +5878,22 @@ static gboolean
 gtk_window_state_event (GtkWidget           *widget,
                         GdkEventWindowState *event)
 {
+  GtkWindow *window = GTK_WINDOW (widget);
+  GtkWindowPrivate *priv = window->priv;
+
   update_grip_visibility (GTK_WINDOW (widget));
 
   if (event->changed_mask & GDK_WINDOW_STATE_FOCUSED)
     ensure_state_flag_backdrop (widget);
 
+  if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
+    {
+      priv->fullscreen =
+        (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) ? 1 : 0;
+      if (priv->title_box)
+        gtk_widget_set_visible (priv->title_box, !priv->fullscreen);
+    }
+
   return FALSE;
 }
 
@@ -6325,7 +6338,10 @@ gtk_window_button_press_event (GtkWidget *widget,
 
       return TRUE;
     }
-  else if (priv->client_decorated && priv->decorated && priv->title_box)
+  else if (priv->client_decorated &&
+           priv->decorated &&
+           priv->title_box &&
+           !priv->fullscreen)
     {
       GtkAllocation allocation;
       int border_width;
@@ -6756,7 +6772,8 @@ gtk_window_get_preferred_width (GtkWidget *widget,
 
   if (priv->client_decorated &&
       priv->decorated &&
-      priv->type == GTK_WINDOW_TOPLEVEL)
+      priv->type == GTK_WINDOW_TOPLEVEL &&
+      !priv->fullscreen)
     {
       context = gtk_widget_get_style_context (widget);
       state = gtk_style_context_get_state (context);
@@ -6823,7 +6840,8 @@ gtk_window_get_preferred_width_for_height (GtkWidget *widget,
 
   if (priv->client_decorated &&
       priv->decorated &&
-      priv->type == GTK_WINDOW_TOPLEVEL)
+      priv->type == GTK_WINDOW_TOPLEVEL &&
+      !priv->fullscreen)
     {
       context = gtk_widget_get_style_context (widget);
       state = gtk_style_context_get_state (context);
@@ -6891,7 +6909,8 @@ gtk_window_get_preferred_height (GtkWidget *widget,
 
   if (priv->client_decorated &&
       priv->decorated &&
-      priv->type == GTK_WINDOW_TOPLEVEL)
+      priv->type == GTK_WINDOW_TOPLEVEL &&
+      !priv->fullscreen)
     {
       context = gtk_widget_get_style_context (widget);
       state = gtk_style_context_get_state (context);
@@ -6957,7 +6976,8 @@ gtk_window_get_preferred_height_for_width (GtkWidget *widget,
 
   if (priv->client_decorated &&
       priv->decorated &&
-      priv->type == GTK_WINDOW_TOPLEVEL)
+      priv->type == GTK_WINDOW_TOPLEVEL &&
+      !priv->fullscreen)
     {
       context = gtk_widget_get_style_context (widget);
       state = gtk_style_context_get_state (context);
@@ -8144,7 +8164,8 @@ gtk_window_draw (GtkWidget *widget,
 
       if (priv->client_decorated &&
           priv->decorated &&
-          priv->type == GTK_WINDOW_TOPLEVEL)
+          priv->type == GTK_WINDOW_TOPLEVEL &&
+          !priv->fullscreen)
         {
           gtk_style_context_add_class (context, "window-border");
           gtk_widget_get_allocation (widget, &allocation);
@@ -8170,7 +8191,7 @@ gtk_window_draw (GtkWidget *widget,
       gtk_style_context_restore (context);
     }
 
-  if (priv->title_box)
+  if (priv->title_box && !priv->fullscreen)
     {
       gtk_style_context_save (context);
       gtk_style_context_add_class (context, "titlebar");



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