[gnome-nibbles/arnaudb/wip/gtk4: 6/40] Make size_changed() stuff work.
- From: Arnaud B. <arnaudb src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-nibbles/arnaudb/wip/gtk4: 6/40] Make size_changed() stuff work.
 
- Date: Tue, 16 Jun 2020 16:32:29 +0000 (UTC)
 
commit 82791c11a7d031a7b593c1bf1c9d12abc5af0008
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu May 28 16:53:05 2020 +0200
    Make size_changed() stuff work.
 src/nibbles-window.vala | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/nibbles-window.vala b/src/nibbles-window.vala
index fe4a63c..928ba73 100644
--- a/src/nibbles-window.vala
+++ b/src/nibbles-window.vala
@@ -107,7 +107,6 @@ private class NibblesWindow : ApplicationWindow
             worm_settings[i].changed.connect (worm_settings_changed_cb);
         }
 
-        size_allocate.connect (size_allocate_cb);
         map.connect (init_state_watcher);
         set_default_size (settings.get_int ("window-width"), settings.get_int ("window-height"));
         if (settings.get_boolean ("window-is-maximized"))
@@ -244,13 +243,15 @@ private class NibblesWindow : 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 void size_allocate_cb (Allocation allocation)
+    private inline void on_size_changed (Gdk.Surface _surface, int width, int height)
     {
         if (window_is_maximized || window_is_tiled)
             return;
-        get_size (out window_width, out window_height);
+        window_width  = width;
+        window_height = height;
     }
 
     private const Gdk.SurfaceState tiled_state = Gdk.SurfaceState.TILED
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]