[gnome-2048/arnaudb/wip/gtk4: 9/48] Fix size_allocate stuff.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048/arnaudb/wip/gtk4: 9/48] Fix size_allocate stuff.
- Date: Wed, 29 Jul 2020 15:38:29 +0000 (UTC)
commit b9e8a121e27039fbe8a4e9faf7fb8473f0f8190f
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 a1c9341..2494f4e 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]