[gtk+] window: Hide the border when maximized



commit 41aad21693965022288c319841a623d560718791
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 10 03:30:26 2013 -0400

    window: Hide the border when maximized
    
    Dragging windows from the border is not useful when maximized.

 gtk/gtkwindow.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 71bf0af..3a9028d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5925,6 +5925,7 @@ get_decoration_borders (GtkWidget *widget,
 {
   GtkStyleContext *context;
   GtkStateFlags state;
+  GdkWindow *window;
 
   context = gtk_widget_get_style_context (widget);
   state = gtk_style_context_get_state (context);
@@ -5939,10 +5940,19 @@ get_decoration_borders (GtkWidget *widget,
 
   if (window_border != NULL)
     {
-      gtk_style_context_save (context);
-      gtk_style_context_add_class (context, "window-border");
-      gtk_style_context_get_border (context, state, window_border);
-      gtk_style_context_restore (context);
+      window = gtk_widget_get_window (widget);
+      if (window != NULL && (gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED) != 0)
+        {
+           GtkBorder empty = { 0 };
+           *window_border = empty;
+         }
+      else
+        {
+          gtk_style_context_save (context);
+          gtk_style_context_add_class (context, "window-border");
+          gtk_style_context_get_border (context, state, window_border);
+          gtk_style_context_restore (context);
+        }
     }
 }
 
@@ -8815,7 +8825,8 @@ gtk_window_draw (GtkWidget *widget,
 
       if (priv->client_decorated &&
           priv->decorated &&
-          !priv->fullscreen)
+          !priv->fullscreen &&
+          !(gdk_window_get_state (gtk_widget_get_window (widget)) & GDK_WINDOW_STATE_MAXIMIZED))
         {
           gtk_style_context_add_class (context, "window-border");
           gtk_widget_get_allocation (widget, &allocation);


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