[iagno] Bump Gtk required version.



commit 1277fc21221c08330e38378f509d98fd12b8afd7
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Feb 15 12:17:34 2019 +0100

    Bump Gtk required version.
    
    Gdk.WindowState.TILED is deprecated.

 meson.build          |  2 +-
 src/game-window.vala | 21 ++++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/meson.build b/meson.build
index 29e8578..2dd6121 100644
--- a/meson.build
+++ b/meson.build
@@ -14,7 +14,7 @@ canberra_dependency = dependency('libcanberra')
 canberra_gtk3_dependency = dependency('libcanberra-gtk3', version: '>= 0.26')
 gio_dependency = dependency('gio-2.0', version: '>= 2.40.0')
 glib_dependency = dependency('glib-2.0', version: '>= 2.40.0')
-gtk_dependency = dependency('gtk+-3.0', version: '>= 3.20.0')
+gtk_dependency = dependency('gtk+-3.0', version: '>= 3.22.23')
 posix_dependency = meson.get_compiler('vala').find_library('posix')
 rsvg_dependency = dependency('librsvg-2.0', version: '>= 2.32.0')
 
diff --git a/src/game-window.vala b/src/game-window.vala
index a071db2..e959be0 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -32,8 +32,8 @@ private enum GameWindowFlags {
 private class GameWindow : ApplicationWindow
 {
     /* settings */
-    private bool tiled_state;
-    private bool maximized_state;
+    private bool window_is_tiled;
+    private bool window_is_maximized;
     private int window_width;
     private int window_height;
 
@@ -193,7 +193,7 @@ private class GameWindow : ApplicationWindow
 
     private void size_allocate_cb ()
     {
-        if (maximized_state || tiled_state)
+        if (window_is_maximized || window_is_tiled)
             return;
         get_size (out window_width, out window_height);
     }
@@ -201,10 +201,17 @@ private class GameWindow : ApplicationWindow
     private bool window_state_event_cb (Gdk.EventWindowState event)
     {
         if ((event.changed_mask & Gdk.WindowState.MAXIMIZED) != 0)
-            maximized_state = (event.new_window_state & Gdk.WindowState.MAXIMIZED) != 0;
+            window_is_maximized = (event.new_window_state & Gdk.WindowState.MAXIMIZED) != 0;
+
         /* We don’t save this state, but track it for saving size allocation */
-        if ((event.changed_mask & Gdk.WindowState.TILED) != 0)
-            tiled_state = (event.new_window_state & Gdk.WindowState.TILED) != 0;
+        Gdk.WindowState tiled_state = Gdk.WindowState.TILED
+                                    | Gdk.WindowState.TOP_TILED
+                                    | Gdk.WindowState.BOTTOM_TILED
+                                    | Gdk.WindowState.LEFT_TILED
+                                    | Gdk.WindowState.RIGHT_TILED;
+        if ((event.changed_mask & tiled_state) != 0)
+            window_is_tiled = (event.new_window_state & tiled_state) != 0;
+
         return false;
     }
 
@@ -213,7 +220,7 @@ private class GameWindow : ApplicationWindow
         settings.delay ();
         settings.set_int ("window-width", window_width);
         settings.set_int ("window-height", window_height);
-        settings.set_boolean ("window-is-maximized", maximized_state);
+        settings.set_boolean ("window-is-maximized", window_is_maximized);
         settings.apply ();
         destroy ();
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]