[gtk/wip/muktupavels/info-bar-reftest] infobar: fix initial window position



commit 840ef37bfdacf0978592c7032fb7de63f6830d31
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Feb 13 16:32:14 2020 +0200

    infobar: fix initial window position
    
    Call gtk_widget_set_allocation after chaining up to parent class
    to ensure that GtkInfoBar has correct allocation. Otherwise x and y
    is set to zero causing wrong window position in gtk_info_bar_realize.
    
    This fixes info-bar-message-types.ui reftest.
    
    https://gitlab.gnome.org/GNOME/gtk/merge_requests/1428

 gtk/gtkinfobar.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c
index 232e8b35f0..6760f8d15b 100644
--- a/gtk/gtkinfobar.c
+++ b/gtk/gtkinfobar.c
@@ -375,8 +375,16 @@ static void
 gtk_info_bar_size_allocate (GtkWidget     *widget,
                             GtkAllocation *allocation)
 {
+  GtkAllocation tmp_allocation;
   GdkWindow *window;
 
+  tmp_allocation = *allocation;
+  tmp_allocation.x = 0;
+  tmp_allocation.y = 0;
+
+  GTK_WIDGET_CLASS (gtk_info_bar_parent_class)->size_allocate (widget,
+                                                               &tmp_allocation);
+
   gtk_widget_set_allocation (widget, allocation);
 
   window = gtk_widget_get_window (widget);
@@ -384,11 +392,6 @@ gtk_info_bar_size_allocate (GtkWidget     *widget,
     gdk_window_move_resize (window,
                             allocation->x, allocation->y,
                             allocation->width, allocation->height);
-
-  allocation->x = 0;
-  allocation->y = 0;
-
-  GTK_WIDGET_CLASS (gtk_info_bar_parent_class)->size_allocate (widget, allocation);
 }
 
 static void


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