[gnome-boxes] display: make it harder to hit the auto-hide toolbar



commit 9274714038573f28e9086827dcfc03fffff339c8
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Fri Aug 31 15:44:29 2012 +0200

    display: make it harder to hit the auto-hide toolbar
    
    Use a timer of App.app.duration before showing the toolbar.
    This makes it easier to use GNOME3 hot corner with Boxes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683104

 src/display-page.vala |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/display-page.vala b/src/display-page.vala
index 2d1c980..27b734b 100644
--- a/src/display-page.vala
+++ b/src/display-page.vala
@@ -26,6 +26,7 @@ private class Boxes.DisplayPage: GLib.Object {
     private DisplayToolbar overlay_toolbar;
     private DisplayToolbar toolbar;
     private uint toolbar_hide_id;
+    private uint toolbar_show_id;
     private ulong cursor_id;
 
     private Boxes.Display display;
@@ -42,7 +43,7 @@ private class Boxes.DisplayPage: GLib.Object {
         event_box.event.connect ((event) => {
             if (App.app.fullscreen && event.type == EventType.MOTION_NOTIFY) {
                 var y = event.motion.y;
-                if (y <= 0) {
+                if (y <= 0 && toolbar_show_id == 0) {
                     toolbar_event_stop ();
                     if ((event.motion.state &
                          (ModifierType.SHIFT_MASK | ModifierType.CONTROL_MASK |
@@ -50,8 +51,13 @@ private class Boxes.DisplayPage: GLib.Object {
                           ModifierType.HYPER_MASK | ModifierType.META_MASK |
                           ModifierType.BUTTON1_MASK | ModifierType.BUTTON2_MASK |
                           ModifierType.BUTTON3_MASK | ModifierType.BUTTON4_MASK |
-                          ModifierType.BUTTON5_MASK)) == 0)
-                        set_overlay_toolbar_visible (true);
+                          ModifierType.BUTTON5_MASK)) == 0) {
+                        toolbar_show_id = Timeout.add (App.app.duration, () => {
+                            set_overlay_toolbar_visible (true);
+                            toolbar_show_id = 0;
+                            return false;
+                        });
+                    }
                 } else if (y > 5 && toolbar_hide_id == 0) {
                     toolbar_event_stop ();
                     toolbar_hide_id = Timeout.add (App.app.duration, () => {
@@ -131,6 +137,9 @@ private class Boxes.DisplayPage: GLib.Object {
         if (toolbar_hide_id != 0)
             GLib.Source.remove (toolbar_hide_id);
         toolbar_hide_id = 0;
+        if (toolbar_show_id != 0)
+            GLib.Source.remove (toolbar_show_id);
+        toolbar_show_id = 0;
     }
 
     public void show () {



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