[gnome-shell/wip/message-tray] Rough prototype of screen-bottom dwell to open tray



commit d995d23839e332aea6b2e452ee509251336cbd5b
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Fri Aug 17 16:07:42 2012 -0400

    Rough prototype of screen-bottom dwell to open tray

 js/ui/messageTray.js |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index a861c4c..50d3dac 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1421,6 +1421,30 @@ const MessageTray = new Lang.Class({
 
         this._summaryItems = [];
         this._chatSummaryItemsCount = 0;
+
+        this._openTrayTimeoutId = Mainloop.timeout_add(100, Lang.bind(this, this._checkOpenTray));
+        this._openTrayStart = null;
+    },
+
+    _checkOpenTray: function() {
+        const OPEN_TRAY_DWELL_TIME = 1000; // ms
+
+        let [x, y, mods] = global.get_pointer();
+        if (y == global.screen_height - 1) {
+            if (this._openTrayStart == null) {
+                this._openTrayStart = GLib.get_monotonic_time() / 1000.0;
+            } else {
+                let delta = (GLib.get_monotonic_time() / 1000.0 - this._openTrayStart);
+                if (delta > OPEN_TRAY_DWELL_TIME) {
+                    this._traySummoned = true;
+                    this._updateState();
+                }
+            }
+        } else {
+            this._openTrayStart = null;
+        }
+
+        return true;
     },
 
     _onCornerEnter: function(actor, event) {



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