[gnome-shell] workspaceThumbnail: Enable activation of thumbnails in the WorkspaceBox



commit c0b50cbdf2a73ef963c8e0e36447eedc78b51008
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 16 18:27:09 2015 +0200

    workspaceThumbnail: Enable activation of thumbnails in the WorkspaceBox
    
    We need a separate handler for TOUCH_BEGIN/END events.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756748

 js/ui/workspaceThumbnail.js |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 3b650ba..2fa66ea 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -653,6 +653,7 @@ const ThumbnailsBox = new Lang.Class({
 
         this.actor.connect('button-press-event', function() { return Clutter.EVENT_STOP; });
         this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease));
+        this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent));
 
         Main.overview.connect('showing',
                               Lang.bind(this, this._createThumbnails));
@@ -683,18 +684,31 @@ const ThumbnailsBox = new Lang.Class({
                 global.screen.n_workspaces > 1;
     },
 
-    _onButtonRelease: function(actor, event) {
-        let [stageX, stageY] = event.get_coords();
+    _activateThumbnailAtPoint: function (stageX, stageY, time) {
         let [r, x, y] = this.actor.transform_stage_point(stageX, stageY);
 
         for (let i = 0; i < this._thumbnails.length; i++) {
             let thumbnail = this._thumbnails[i]
             let [w, h] = thumbnail.actor.get_transformed_size();
             if (y >= thumbnail.actor.y && y <= thumbnail.actor.y + h) {
-                thumbnail.activate(event.get_time());
+                thumbnail.activate(time);
                 break;
             }
         }
+    },
+
+    _onButtonRelease: function(actor, event) {
+        let [stageX, stageY] = event.get_coords();
+        this._activateThumbnailAtPoint(stageX, stageY, event.get_time());
+        return Clutter.EVENT_STOP;
+    },
+
+    _onTouchEvent: function (actor, event) {
+        if (event.type() == Clutter.EventType.TOUCH_END &&
+            global.display.is_pointer_emulating_sequence(event.get_event_sequence())) {
+            let [stageX, stageY] = event.get_coords();
+            this._activateThumbnailAtPoint(stageX, stageY, event.get_time());
+        }
 
         return Clutter.EVENT_STOP;
     },


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