[gnome-2048] Be fullscreen aware.



commit 1c2ec5a5250892aacb23f541efc20c04ae5a10a4
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Feb 21 16:31:55 2019 +0100

    Be fullscreen aware.

 src/game-window.vala | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index 699f79c..ac33207 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -123,6 +123,7 @@ private class GameWindow : ApplicationWindow
     private int _window_width;
     private int _window_height;
     private bool _window_maximized;
+    private bool _window_fullscreen;
     private bool _window_is_tiled;
 
     private static void _init_window_state (GameWindow _this)
@@ -150,14 +151,14 @@ private class GameWindow : ApplicationWindow
         _settings.delay ();
         _settings.set_int       ("window-width",        _this._window_width);
         _settings.set_int       ("window-height",       _this._window_height);
-        _settings.set_boolean   ("window-maximized",    _this._window_maximized);
+        _settings.set_boolean   ("window-maximized",    _this._window_maximized || _this._window_fullscreen);
         _settings.apply ();
     }
 
     private static void size_allocate_cb (Widget widget, Allocation allocation)
     {
         GameWindow _this = (GameWindow) widget;
-        if (_this._window_maximized || _this._window_is_tiled)
+        if (_this._window_maximized || _this._window_is_tiled || _this._window_fullscreen)
             return;
         int? window_width = null;
         int? window_height = null;
@@ -174,7 +175,11 @@ private class GameWindow : ApplicationWindow
         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 */
+        /* fullscreen: saved as maximized */
+        if ((event.changed_mask & Gdk.WindowState.FULLSCREEN) != 0)
+            _this._window_fullscreen = (event.new_window_state & Gdk.WindowState.FULLSCREEN) != 0;
+
+        /* tiled: not saved, but should not change saved window size */
         Gdk.WindowState tiled_state = Gdk.WindowState.TILED
                                     | Gdk.WindowState.TOP_TILED
                                     | Gdk.WindowState.BOTTOM_TILED


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