[gnome-games] fullscreen-box: Add autohide property



commit d9fb6bbf69680b2c78ad3ff8fe421b0d4b6193c6
Author: Yetizone <andreii lisita gmail com>
Date:   Wed Aug 7 10:31:03 2019 +0300

    fullscreen-box: Add autohide property

 src/ui/fullscreen-box.vala | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
---
diff --git a/src/ui/fullscreen-box.vala b/src/ui/fullscreen-box.vala
index 17553d82..dcb767df 100644
--- a/src/ui/fullscreen-box.vala
+++ b/src/ui/fullscreen-box.vala
@@ -7,6 +7,33 @@ private class Games.FullscreenBox : Gtk.EventBox, Gtk.Buildable {
 
        public bool is_fullscreen { get; set; }
 
+       private bool _autohide;
+       public bool autohide {
+               get { return _autohide; }
+               set {
+                       _autohide = value;
+
+                       if (value) {
+                               show_ui ();
+                               on_cursor_moved ();
+                       }
+                       else {
+                               // Disable timers
+                               if (ui_timeout_id != -1) {
+                                       Source.remove (ui_timeout_id);
+                                       ui_timeout_id = -1;
+                               }
+
+                               if (cursor_timeout_id != -1) {
+                                       Source.remove (cursor_timeout_id);
+                                       cursor_timeout_id = -1;
+                               }
+
+                               show_cursor (true);
+                       }
+               }
+       }
+
        private Gtk.Widget _header_bar;
        public Gtk.Widget header_bar {
                get { return _header_bar; }
@@ -73,6 +100,9 @@ private class Games.FullscreenBox : Gtk.EventBox, Gtk.Buildable {
 
        [GtkCallback]
        private bool on_motion_event (Gdk.EventMotion event) {
+               if (!autohide)
+                       return false;
+
                if (event.y_root <= SHOW_HEADERBAR_DISTANCE)
                        show_ui ();
 


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