Commit 08a6444e authored by Andrei Lisita's avatar Andrei Lisita 🎮

display-box: Add a margin to the savestates list in fullscreen

The margin is added so the fullscreen header bar doesn't obstruct the
savestates list
parent 741bf348
Pipeline #103436 failed with stages
in 9 minutes and 1 second
......@@ -4,7 +4,17 @@
private class Games.DisplayBox : Gtk.Bin {
public signal void back ();
public bool is_fullscreen { get; set; }
private bool _is_fullscreen;
public bool is_fullscreen {
get { return _is_fullscreen; }
set {
_is_fullscreen = value;
// A top margin is added to the savestates list in fullscreen mode such that
// the fullscreen header bar doesn't cover the savestates menu
savestates_list.set_margin (value ? fullscreen_header_bar_height : 0);
}
}
public DisplayHeaderBar header_bar {
get { return fullscreen_header_bar; }
......@@ -56,6 +66,7 @@ private class Games.DisplayBox : Gtk.Bin {
private SavestatesList savestates_list;
private Binding fullscreen_binding;
private int fullscreen_header_bar_height;
private long timeout_id;
construct {
......@@ -63,6 +74,8 @@ private class Games.DisplayBox : Gtk.Bin {
"is-fullscreen",
BindingFlags.BIDIRECTIONAL);
timeout_id = -1;
fullscreen_header_bar.size_allocate.connect (on_fullscreen_header_bar_size_allocated);
}
public DisplayBox (SavestatesListState savestates_list_state) {
......@@ -118,4 +131,8 @@ private class Games.DisplayBox : Gtk.Bin {
public void on_savestates_list_revealed_changed () {
fullscreen_box.autohide = !savestates_list.state.is_revealed;
}
private void on_fullscreen_header_bar_size_allocated (Gtk.Allocation allocation) {
fullscreen_header_bar_height = allocation.height;
}
}
......@@ -8,6 +8,8 @@ private class Games.SavestatesList : Gtk.Box {
private Gtk.ListBox list_box;
[GtkChild]
private Gtk.ListBoxRow new_savestate_row;
[GtkChild]
private Gtk.ScrolledWindow scrolled_window;
public bool is_revealed {
get { return revealer.reveal_child; }
......@@ -61,6 +63,10 @@ private class Games.SavestatesList : Gtk.Box {
list_box.set_header_func (update_header);
}
public void set_fullscreen_margin (int margin) {
scrolled_window.margin_top = margin;
}
[GtkCallback]
private void on_row_activated (Gtk.ListBoxRow activated_row) {
if (activated_row == new_savestate_row) {
......
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