[gnome-shell] overview: Keep open when a Control key is held



commit df0f03d831ec52feefd407cd63172cdb3720de68
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 21 15:57:00 2013 +0100

    overview: Keep open when a Control key is held
    
    It is useful at times to perform several actions that would usually
    close the overview (for instance launching an application) at once.
    Currently we allow this by dragging items to a workspace rather than
    just clicking it, but it's an odd metaphor with its own set of
    problems.
    Introduce an alternative approach (inspired by file selection in
    file managers) by keeping the overview open if a Control key is
    held down.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686984

 js/ui/overview.js |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 4d8dce7..6d487f6 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -92,7 +92,9 @@ const Overview = new Lang.Class({
     _init: function() {
         this._overviewCreated = false;
         this._initCalled = false;
+        this._controlPressed = false;
 
+        global.stage.connect('captured-event', Lang.bind(this, this._capturedEvent));
         Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
         this._sessionUpdated();
     },
@@ -224,6 +226,20 @@ const Overview = new Lang.Class({
         }
     },
 
+    _capturedEvent: function(actor, event) {
+        let type = event.type();
+        if (type != Clutter.EventType.KEY_PRESS &&
+            type != Clutter.EventType.KEY_RELEASE)
+            return false;
+
+        let symbol = event.get_key_symbol();
+        if (symbol == Clutter.KEY_Control_L ||
+            symbol == Clutter.KEY_Control_R)
+            this._controlPressed = type == Clutter.EventType.KEY_PRESS;
+
+        return false;
+    },
+
     _sessionUpdated: function() {
         this.isDummy = !Main.sessionMode.hasOverview;
         this._createOverview();
@@ -565,6 +581,9 @@ const Overview = new Lang.Class({
         if (!this._shown)
             return;
 
+        if (this._controlPressed)
+            return;
+
         if (!this._shownTemporarily)
             this._animateNotVisible();
 


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