gtkwindow: Update shadow size on state change
authorOlivier Fourdan <ofourdan@redhat.com>
Mon, 19 Sep 2016 14:11:54 +0000 (16:11 +0200)
committerOlivier Fourdan <ofourdan@redhat.com>
Mon, 19 Sep 2016 17:35:50 +0000 (19:35 +0200)
Otherwise, with CSD, we could have a discrepancy where gtk uses the
right values for the shadows whereas the gdk backend still uses the old
values, leading in some cases to invalid or negative min size being
computed (which, in Wayland, leads a protocol error).

https://bugzilla.gnome.org/show_bug.cgi?id=771561

gtk/gtkwindow.c

index fc1e050f77f0d07ec8f718cf9faad92d2fd947a0..9808475f73f5be588da8bb665ebddf940f1b342c 100644 (file)
@@ -7528,6 +7528,19 @@ update_window_style_classes (GtkWindow *window)
     gtk_style_context_remove_class (context, "fullscreen");
 }
 
+static void
+update_window_borders (GtkWindow *window)
+{
+  GtkWindowPrivate *priv = window->priv;
+  GtkBorder window_border = { 0 };
+
+  if (priv->client_decorated && priv->use_client_shadow)
+    {
+      get_shadow_width (window, &window_border);
+      update_shadow_width (window, &window_border);
+    }
+}
+
 static void
 popover_size_allocate (GtkWidget        *widget,
                        GtkWindowPopover *popover,
@@ -7798,6 +7811,7 @@ gtk_window_state_event (GtkWidget           *widget,
     {
       update_window_style_classes (window);
       update_window_buttons (window);
+      update_window_borders (window);
       gtk_widget_queue_resize (widget);
     }