[gnome-mahjongg/arnaudb/wip/gtk4: 17/29] Adapt to size_allocate.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mahjongg/arnaudb/wip/gtk4: 17/29] Adapt to size_allocate.
- Date: Fri, 9 Oct 2020 15:35:06 +0000 (UTC)
commit c5a6fa8a531da589ae58e4581f1bc59431c2db58
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Mar 27 19:45:05 2020 +0100
Adapt to size_allocate.
src/gnome-mahjongg.vala | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/gnome-mahjongg.vala b/src/gnome-mahjongg.vala
index af1702f..88434c4 100644
--- a/src/gnome-mahjongg.vala
+++ b/src/gnome-mahjongg.vala
@@ -83,7 +83,6 @@ public class Mahjongg : Gtk.Application
history.load ();
window = new Gtk.ApplicationWindow (this);
- window.size_allocate.connect (size_allocate_cb);
window.map.connect (init_state_watcher);
window.set_default_size (settings.get_int ("window-width"), settings.get_int ("window-height"));
if (settings.get_boolean ("window-is-maximized"))
@@ -189,13 +188,6 @@ public class Mahjongg : Gtk.Application
tick_cb ();
}
- private void size_allocate_cb (Gtk.Allocation allocation)
- {
- if (is_maximized || is_tiled)
- return;
- window.get_size (out window_width, out window_height);
- }
-
private void init_state_watcher ()
{
Gdk.Surface? nullable_surface = window.get_surface (); // TODO report bug, get_surface()
returns a nullable Surface
@@ -203,6 +195,14 @@ public class Mahjongg : Gtk.Application
assert_not_reached ();
surface = (Gdk.Toplevel) (!) nullable_surface;
surface.notify ["state"].connect (on_window_state_event);
+ surface.size_changed.connect (on_size_changed);
+ }
+
+ private inline void on_size_changed (Gdk.Surface _surface, int width, int height)
+ {
+ if (is_maximized || is_tiled)
+ return;
+ window.get_size (out window_width, out window_height);
}
private Gdk.Toplevel surface;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]