[gnome-sudoku/arnaudb/improve-code: 5/5] Handle fullscreen as maximization.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sudoku/arnaudb/improve-code: 5/5] Handle fullscreen as maximization.
- Date: Mon, 13 Apr 2020 13:35:59 +0000 (UTC)
commit f34b91556876a881399301ce62ba6a06ad400bd9
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Apr 13 14:49:09 2020 +0200
Handle fullscreen as maximization.
src/gnome-sudoku.vala | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index 5969881..0c13ecd 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -24,8 +24,9 @@ using Gtk;
public class Sudoku : Gtk.Application
{
private GLib.Settings settings;
- private bool is_maximized;
- private bool is_tiled;
+ private bool window_is_maximized;
+ private bool window_is_fullscreen;
+ private bool window_is_tiled;
private int window_width;
private int window_height;
private Button play_custom_game_button;
@@ -224,7 +225,7 @@ public class Sudoku : Gtk.Application
settings.delay ();
settings.set_int ("window-width", window_width);
settings.set_int ("window-height", window_height);
- settings.set_boolean ("window-is-maximized", is_maximized);
+ settings.set_boolean ("window-is-maximized", window_is_maximized || window_is_fullscreen);
settings.apply ();
base.shutdown ();
@@ -232,18 +233,29 @@ public class Sudoku : Gtk.Application
private void size_allocate_cb (Allocation allocation)
{
- if (is_maximized || is_tiled)
+ if (window_is_maximized || window_is_fullscreen || window_is_tiled)
return;
window.get_size (out window_width, out window_height);
}
+ private const Gdk.WindowState tiled_state = Gdk.WindowState.TILED
+ | Gdk.WindowState.TOP_TILED
+ | Gdk.WindowState.BOTTOM_TILED
+ | Gdk.WindowState.LEFT_TILED
+ | Gdk.WindowState.RIGHT_TILED;
private bool window_state_event_cb (Gdk.EventWindowState event)
{
if ((event.changed_mask & Gdk.WindowState.MAXIMIZED) != 0)
- is_maximized = (event.new_window_state & Gdk.WindowState.MAXIMIZED) != 0;
+ window_is_maximized = (event.new_window_state & Gdk.WindowState.MAXIMIZED) != 0;
+
+ /* fullscreen: saved as maximized */
+ if ((event.changed_mask & Gdk.WindowState.FULLSCREEN) != 0)
+ window_is_fullscreen = (event.new_window_state & Gdk.WindowState.FULLSCREEN) != 0;
+
/* We don’t save this state, but track it for saving size allocation */
- if ((event.changed_mask & Gdk.WindowState.TILED) != 0)
- is_tiled = (event.new_window_state & Gdk.WindowState.TILED) != 0;
+ if ((event.changed_mask & tiled_state) != 0)
+ window_is_tiled = (event.new_window_state & tiled_state) != 0;
+
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]