[gnome-2048] Bump Gtk required version.



commit cfff45e10907e9dde5687cf0dc2bdf9b556fb3df
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Feb 14 16:33:02 2019 +0100

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

 meson.build          |  2 +-
 src/game-window.vala | 12 +++++++++---
 src/game.vala        | 14 +++++++-------
 3 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/meson.build b/meson.build
index f8532d3..b875d93 100644
--- a/meson.build
+++ b/meson.build
@@ -28,7 +28,7 @@ posix_dependency = valac.find_library('posix')
 libm_dependency = cc.find_library('m', required: false) # some platforms do not have libm separated from libc
 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.12.0')
+gtk_dependency = dependency('gtk+-3.0', version: '>= 3.22.23')
 clutter_dependency = dependency('clutter-1.0', version: '>= 1.12.0')
 clutter_gtk_dependency = dependency('clutter-gtk-1.0', version: '>= 1.6.0')
 gee_dependency = dependency('gee-0.8', version: '>= 0.14.0')
diff --git a/src/game-window.vala b/src/game-window.vala
index 9d951ea..699f79c 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -127,8 +127,8 @@ private class GameWindow : ApplicationWindow
 
     private static void _init_window_state (GameWindow _this)
     {
-        _this.size_allocate.connect (size_allocate_cb);
         _this.window_state_event.connect (state_event_cb);
+        _this.size_allocate.connect (size_allocate_cb);
 
         Gdk.Geometry geom = Gdk.Geometry ();
         geom.min_height = WINDOW_MINIMUM_SIZE_HEIGHT;
@@ -173,9 +173,15 @@ private class GameWindow : ApplicationWindow
         GameWindow _this = (GameWindow) widget;
         if ((event.changed_mask & Gdk.WindowState.MAXIMIZED) != 0)
             _this._window_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)
-            _this._window_is_tiled = (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)
+            _this._window_is_tiled = (event.new_window_state & tiled_state) != 0;
 
         return false;
     }
diff --git a/src/game.vala b/src/game.vala
index 3e9e93b..c75582f 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -227,13 +227,13 @@ private class Game : Object
         _foreground_cur = new TileView? [rows, cols];
         _foreground_nxt = new TileView? [rows, cols];
 
-        float canvas_width = _view.width;
+        float canvas_width  = _view.width;
         float canvas_height = _view.height;
 
-        canvas_width -= (cols + 1) * BLANK_COL_WIDTH;
+        canvas_width  -= (cols + 1) * BLANK_COL_WIDTH;
         canvas_height -= (rows + 1) * BLANK_ROW_HEIGHT;
 
-        float tile_width = canvas_width / cols;
+        float tile_width  = canvas_width  / cols;
         float tile_height = canvas_height / rows;
 
         for (int i = 0; i < rows; i++)
@@ -261,20 +261,20 @@ private class Game : Object
     {
         int rows = _grid.rows;
         int cols = _grid.cols;
-        float canvas_width = _view.width;
+        float canvas_width  = _view.width;
         float canvas_height = _view.height;
 
-        canvas_width -= (cols + 1) * BLANK_COL_WIDTH;
+        canvas_width  -= (cols + 1) * BLANK_COL_WIDTH;
         canvas_height -= (rows + 1) * BLANK_ROW_HEIGHT;
 
-        float tile_width = canvas_width / cols;
+        float tile_width  = canvas_width  / cols;
         float tile_height = canvas_height / rows;
 
         for (int i = 0; i < rows; i++)
         {
             for (int j = 0; j < cols; j++)
             {
-                float x = j * tile_width + (j + 1) * BLANK_COL_WIDTH;
+                float x = j * tile_width  + (j + 1) * BLANK_COL_WIDTH;
                 float y = i * tile_height + (i + 1) * BLANK_ROW_HEIGHT;
 
                 _background [i, j].resize (x, y, tile_width, tile_height);


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