[gnome-klotski/arnaudb/wip/gtk4: 25/38] Fix size-allocate.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-klotski/arnaudb/wip/gtk4: 25/38] Fix size-allocate.
- Date: Fri, 31 Jul 2020 16:14:18 +0000 (UTC)
commit 4e808bf394381bac0aff1703f37d7833ea2a8111
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Jul 31 17:38:07 2020 +0200
Fix size-allocate.
data/ui/klotski.ui | 1 -
src/klotski-window.vala | 18 ++++--------------
2 files changed, 4 insertions(+), 15 deletions(-)
---
diff --git a/data/ui/klotski.ui b/data/ui/klotski.ui
index 91b34af..27f6752 100644
--- a/data/ui/klotski.ui
+++ b/data/ui/klotski.ui
@@ -314,7 +314,6 @@
<!-- <initial-focus name=""/> -->
<property name="width-request">600</property>
<property name="height-request">400</property>
- <signal name="size-allocate" handler="on_size_allocate"/>
<signal name="map" handler="init_state_watcher"/>
<signal name="destroy" handler="on_destroy"/>
<child type="titlebar">
diff --git a/src/klotski-window.vala b/src/klotski-window.vala
index 4fdefee..086330b 100644
--- a/src/klotski-window.vala
+++ b/src/klotski-window.vala
@@ -633,12 +633,6 @@ private class KlotskiWindow : ApplicationWindow
* * Window management callbacks
\*/
- [GtkCallback]
- private void on_size_allocate (Allocation allocation)
- {
- update_window_state ();
- }
-
[GtkCallback]
private inline void init_state_watcher ()
{
@@ -647,6 +641,7 @@ private class KlotskiWindow : 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 Gdk.Toplevel surface;
@@ -694,17 +689,12 @@ private class KlotskiWindow : ApplicationWindow
* * manage window state
\*/
- private void update_window_state () // called on size-allocate
+ private inline void on_size_changed (Gdk.Surface _surface, int width, int height)
{
if (window_is_maximized || window_is_tiled || window_is_fullscreen)
return;
- int? _window_width = null;
- int? _window_height = null;
- get_size (out _window_width, out _window_height);
- if (_window_width == null || _window_height == null)
- return;
- window_width = (!) _window_width;
- window_height = (!) _window_height;
+ window_width = width;
+ window_height = height;
}
private void save_window_state () // called on destroy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]