[libgnome-games-support/andy128k-gtk4] update size_allocate of GridFrame



commit 5e4fb14cfa645b278d944c2c855982cb252b72a4
Author: Andrey Kutejko <andy128k gmail com>
Date:   Sun Sep 12 13:43:04 2021 +0200

    update size_allocate of GridFrame

 games/gridframe.vala | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/games/gridframe.vala b/games/gridframe.vala
index 6662e15..5d5b743 100644
--- a/games/gridframe.vala
+++ b/games/gridframe.vala
@@ -135,19 +135,19 @@ public class GridFrame : Gtk.Widget
         this.yalign = yalign;
     }
 
-    public override void size_allocate (Gtk.Allocation allocation)
+    public override void size_allocate (int width, int height, int baseline)
     {
-        base.size_allocate (allocation);
+        base.size_allocate (width, height, baseline);
 
-        int xsize = int.max (1, (allocation.width - _xpadding) / _xmult);
-        int ysize = int.max (1, (allocation.height - _ypadding) / _ymult);
+        int xsize = int.max (1, (width - _xpadding) / _xmult);
+        int ysize = int.max (1, (height - _ypadding) / _ymult);
         int size = int.min (xsize, ysize);
 
         Gtk.Allocation child_allocation = { 0, 0, 0, 0 };
         child_allocation.width = size * _xmult + _xpadding;
         child_allocation.height = size * _ymult + _ypadding;
-        child_allocation.x = (int) ((allocation.width - child_allocation.width) * _xalign + allocation.x);
-        child_allocation.y = (int) ((allocation.height - child_allocation.height) * _yalign + allocation.y);
+        child_allocation.x = (int) ((width - child_allocation.width) * _xalign);
+        child_allocation.y = (int) ((height - child_allocation.height) * _yalign);
 
         if (get_mapped () &&
             (child_allocation.x != old_allocation.x ||
@@ -155,12 +155,12 @@ public class GridFrame : Gtk.Widget
              child_allocation.width != old_allocation.width ||
              child_allocation.height != old_allocation.height))
         {
-            get_window ().invalidate_rect (allocation, false);
+//            get_root ().invalidate_rect (allocation, false);
         }
 
         Gtk.Widget child = get_first_child ();
         if (child != null && child.get_visible ())
-            child.size_allocate (child_allocation);
+            child.allocate_size (child_allocation, -1);
 
         old_allocation = child_allocation;
     }


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