Commit f34b9155 authored by Arnaud B.'s avatar Arnaud B.

Handle fullscreen as maximization.

parent c1f2bc18
Pipeline #169782 passed with stage
in 1 minute and 59 seconds
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment