[gnome-2048/arnaudb/wip/gtk4: 7/36] Fix size_allocate stuff.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048/arnaudb/wip/gtk4: 7/36] Fix size_allocate stuff.
- Date: Tue, 14 Jul 2020 10:58:58 +0000 (UTC)
commit 0cc1c656c79ae8c9cebacf66827c4b111a05d001
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..53f1ccb 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]