[gnome-games/wip/exalm/display-bin] display-box: Put the game into a DisplayBin



commit 3c5b4f56b60d3e592bbc1c89c96fd8885125e10d
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Wed Aug 14 19:17:45 2019 +0500

    display-box: Put the game into a DisplayBin
    
    And change its offsets when the sidebar slides out. This way the game can
    never change the height and instead overflows off the screen.
    
    Also, this allows to remove the special-casing for narrow window, since
    this behavior works with narrow windows too.

 data/ui/display-box.ui  |  2 +-
 src/ui/display-box.vala | 11 ++++-------
 2 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/data/ui/display-box.ui b/data/ui/display-box.ui
index 80f42dc2..d4b37e72 100644
--- a/data/ui/display-box.ui
+++ b/data/ui/display-box.ui
@@ -28,7 +28,7 @@
               <object class="GtkOverlay" id="display_overlay">
                 <property name="visible">True</property>
                 <child>
-                  <object class="GtkEventBox" id="display_bin">
+                  <object class="GamesDisplayBin" id="display_bin">
                     <property name="visible">True</property>
                     <property name="hexpand">True</property>
                   </object>
diff --git a/src/ui/display-box.vala b/src/ui/display-box.vala
index cac9364c..7451ad83 100644
--- a/src/ui/display-box.vala
+++ b/src/ui/display-box.vala
@@ -59,7 +59,7 @@ private class Games.DisplayBox : Gtk.Bin {
        [GtkChild]
        private Gtk.Overlay display_overlay;
        [GtkChild]
-       private Gtk.EventBox display_bin;
+       private DisplayBin display_bin;
        [GtkChild]
        private DisplayHeaderBar fullscreen_header_bar;
        [GtkChild]
@@ -147,11 +147,8 @@ private class Games.DisplayBox : Gtk.Bin {
        }
 
        private void update_margin () {
-               var width = get_allocated_width ();
-               display_bin.margin_start = 0;
-               if (width > 900)
-                       display_bin.margin_end = savestates_list.get_allocated_width ();
-               else
-                       display_bin.margin_end = 0;
+               var width = savestates_list.get_allocated_width ();
+
+               display_bin.horizontal_offset = -width / 2;
        }
 }


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