[five-or-more/arnaudb/wip/gtk4: 31/37] Adapt size_allocate stuff.




commit c98e08304494b39d2bb31740af623f80be999a2e
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon May 11 11:58:46 2020 +0200

    Adapt size_allocate stuff.

 src/window.vala | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/window.vala b/src/window.vala
index b7c30ec..ae95186 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -74,6 +74,7 @@ private class GameWindow : ApplicationWindow
     {
         add_action_entries (win_actions, this);
 
+//        size_allocate.connect (on_size_allocate);
         map.connect (init_state_watcher);
 
         SimpleAction theme_action = (SimpleAction) lookup_action ("change-theme");
@@ -129,6 +130,7 @@ private class GameWindow : ApplicationWindow
             assert_not_reached ();
         surface = (Gdk.Toplevel) (!) nullable_surface;
         surface.notify ["state"].connect (on_window_state_event);
+        surface.size_changed.connect (on_size_changed);
     }
 
     private Gdk.Toplevel surface;
@@ -145,15 +147,12 @@ private class GameWindow : ApplicationWindow
         window_tiled =      (state & tiled_state)                != 0;
     }
 
-    protected override void size_allocate (Allocation allocation)
+    private inline void on_size_changed (int width, int height)
     {
-        base.size_allocate (allocation);
-
         if (window_maximized || window_tiled)
             return;
-
-        window_width = allocation.width;
-        window_height = allocation.height;
+        window_width  = width;
+        window_height = height;
     }
 
     internal inline void on_shutdown ()


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