[gnome-2048/arnaudb/wip/gtk4: 15/57] Fix size_allocate stuff.




commit 393226e65d70c41164ffb2fbed120b627b1c5f6f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Jul 14 12:46:45 2020 +0200

    Fix size_allocate stuff.

 src/game-window.vala | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index f45df7b..1a96cdd 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -155,7 +155,6 @@ private class GameWindow : ApplicationWindow
 
     private void _init_window_state ()
     {
-        size_allocate.connect (size_allocate_cb);
         map.connect (init_state_watcher);
         set_size_request (WINDOW_MINIMUM_SIZE_HEIGHT, WINDOW_MINIMUM_SIZE_WIDTH);
     }
@@ -185,20 +184,15 @@ 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 static void size_allocate_cb (Widget widget, Allocation allocation)
+    private inline void on_size_changed (Gdk.Surface _surface, int width, int height)
     {
-        GameWindow _this = (GameWindow) widget;
-        if (_this._window_is_maximized || _this._window_is_tiled || _this._window_is_fullscreen)
+        if (_window_is_maximized || _window_is_tiled || _window_is_fullscreen)
             return;
-        int? window_width = null;
-        int? window_height = null;
-        _this.get_size (out window_width, out window_height);
-        if (window_width == null || window_height == null)
-            return;
-        _this._window_width = (!) window_width;
-        _this._window_height = (!) window_height;
+        _window_width  = width;
+        _window_height = height;
     }
 
     private Gdk.Toplevel surface;


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