[gtk+] GtkWindow: draw the frame and shadow even for app-paintable windows



commit 1571d2872feb7a2bca03d22b615550e2a5d7a23c
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Tue Oct 20 16:43:06 2015 -0400

    GtkWindow: draw the frame and shadow even for app-paintable windows
    
    If a window is decorated, we need to draw the frame and shadow, even if
    it is app-paintable - it's just nonsense to have a frame that we handle
    events on, but expect the app to paint it. (We paint the titlebar in
    any case.) If a client wants to handle all painting, it should use an
    undecorated window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756886

 gtk/gtkwindow.c |   38 ++++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 855706d..15076db 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -9783,8 +9783,7 @@ gtk_window_draw (GtkWidget *widget,
   get_shadow_width (GTK_WINDOW (widget), &window_border);
   _gtk_widget_get_allocation (widget, &allocation);
 
-  if (!gtk_widget_get_app_paintable (widget) &&
-      gtk_cairo_should_draw_window (cr, _gtk_widget_get_window (widget)))
+  if (gtk_cairo_should_draw_window (cr, _gtk_widget_get_window (widget)))
     {
       if (priv->client_decorated &&
           priv->decorated &&
@@ -9822,14 +9821,24 @@ gtk_window_draw (GtkWidget *widget,
           gtk_style_context_restore (context);
         }
 
-      if (priv->title_box &&
-          gtk_widget_get_visible (priv->title_box) &&
-          gtk_widget_get_child_visible (priv->title_box))
-        title_height = priv->title_height;
-      else
-        title_height = 0;
-
-      gtk_render_background (context, cr,
+      if (!gtk_widget_get_app_paintable (widget))
+        {
+           if (priv->title_box &&
+               gtk_widget_get_visible (priv->title_box) &&
+               gtk_widget_get_child_visible (priv->title_box))
+             title_height = priv->title_height;
+           else
+             title_height = 0;
+
+           gtk_render_background (context, cr,
+                                  window_border.left,
+                                  window_border.top + title_height,
+                                  allocation.width -
+                                  (window_border.left + window_border.right),
+                                  allocation.height -
+                                  (window_border.top + window_border.bottom +
+                                   title_height));
+           gtk_render_frame (context, cr,
                              window_border.left,
                              window_border.top + title_height,
                              allocation.width -
@@ -9837,14 +9846,7 @@ gtk_window_draw (GtkWidget *widget,
                              allocation.height -
                              (window_border.top + window_border.bottom +
                               title_height));
-      gtk_render_frame (context, cr,
-                        window_border.left,
-                        window_border.top + title_height,
-                        allocation.width -
-                        (window_border.left + window_border.right),
-                        allocation.height -
-                        (window_border.top + window_border.bottom +
-                         title_height));
+        }
     }
 
   if (GTK_WIDGET_CLASS (gtk_window_parent_class)->draw)


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