[gtk+] gtkwindow: css offset for toplevel only



commit f2b373add81d5d1528a71c5eab90b6354b547465
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Tue Nov 10 12:00:48 2015 +0100

    gtkwindow: css offset for toplevel only
    
    At the time gtk_window_move() or gtk_window_resize() get called, there
    is no way to predict if a popup window will actually draw its shadow, so
    applying an offset in this case may end up with a wrong size or
    positioning for such windows.
    
    Changing the logic in gtk_window_should_use_csd() as previously done to
    address that issue will cause some other breakage as popup windows may
    not draw a shadow but still need CSD.
    
    So best is to actually apply client side decorations offset for regular,
    top level windows only. This is actually a lot simpler and safer and
    less likely to cause additional breakage.
    
    Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=756618

 gtk/gtkwindow.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index a76ea04..b52a2fa 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5243,6 +5243,9 @@ gtk_window_update_csd_size (GtkWindow *window,
   GtkWindowPrivate *priv = window->priv;
   GtkBorder window_border = { 0 };
 
+  if (priv->type != GTK_WINDOW_TOPLEVEL)
+    return;
+
   if (priv->decorated &&
       !priv->fullscreen)
     {
@@ -5453,7 +5456,11 @@ gtk_window_translate_csd_pos (GtkWindow *window,
 {
   GtkWindowPrivate *priv = window->priv;
 
-  if (priv->decorated)
+  if (priv->type != GTK_WINDOW_TOPLEVEL)
+    return;
+
+  if (priv->decorated &&
+      !priv->fullscreen)
     {
       GtkBorder window_border = { 0 };
       gint title_height = 0;
@@ -6000,18 +6007,15 @@ gtk_window_should_use_csd (GtkWindow *window)
   GtkWindowPrivate *priv = window->priv;
   const gchar *csd_env;
 
+  if (priv->csd_requested)
+    return TRUE;
+
   if (!priv->decorated)
     return FALSE;
 
   if (priv->type == GTK_WINDOW_POPUP)
     return FALSE;
 
-  if (priv->csd_requested)
-    return TRUE;
-
-  if (priv->use_client_shadow)
-    return TRUE;
-
 #ifdef GDK_WINDOWING_BROADWAY
   if (GDK_IS_BROADWAY_DISPLAY (gtk_widget_get_display (GTK_WIDGET (window))))
     return TRUE;


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