[connections/wip/fullscreen] window, display-view: Handle F11 to fullscreen




commit 3d06313f3cc57b39425570f862e138c90e299c67
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue May 11 16:45:47 2021 +0200

    window, display-view: Handle F11 to fullscreen
    
    This allows for running the app in fullscreen. We still need to
    add a menu entry for this and sort the topbar behavior (allowing
    mouse drag to escape fullscreen mode, like Boxes).
    
    Fixes #5

 src/display-view.vala |  2 --
 src/window.vala       | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/display-view.vala b/src/display-view.vala
index 98ea09c..23fe9a9 100644
--- a/src/display-view.vala
+++ b/src/display-view.vala
@@ -92,8 +92,6 @@ namespace Connections {
 
         private void show_display () {
             stack.set_visible_child (display_widget);
-
-            display.grab_focus ();
         }
 
         [GtkCallback]
diff --git a/src/window.vala b/src/window.vala
index 102f0d5..eb23e03 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -40,6 +40,16 @@ namespace Connections {
         [GtkChild]
         public unowned NotificationsBar notifications_bar;
 
+        public bool fullscreened {
+            get { return Gdk.WindowState.FULLSCREEN in get_window ().get_state (); }
+            set {
+                if (value)
+                    fullscreen ();
+                else
+                    unfullscreen ();
+            }
+        }
+
         public Window (Gtk.Application app) {
             Object (application: app);
 
@@ -103,6 +113,10 @@ namespace Connections {
                 (event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK) {
                 collection_view.search_bar.search_mode_enabled = 
!collection_view.search_bar.search_mode_enabled;
 
+                return true;
+            } else if (event.keyval == Gdk.Key.F11) {
+                fullscreened = !fullscreened;
+
                 return true;
             } else if (event.keyval == Gdk.Key.q &&
                        (event.state & default_modifiers) == Gdk.ModifierType.CONTROL_MASK) {


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