From 813b3ba1ea3851d8b7031e8e0780c07a793cdeea Mon Sep 17 00:00:00 2001 From: Moritz Marquardt Date: Mon, 5 Mar 2018 19:25:36 +0100 Subject: [PATCH 1/2] Fix touchscreen behaviour for taskbarAppIcon (#223) --- appIcons.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/appIcons.js b/appIcons.js index 37834d35..12ca15e5 100644 --- a/appIcons.js +++ b/appIcons.js @@ -103,6 +103,22 @@ var taskbarAppIcon = new Lang.Class({ this.window = appInfo.window; this.isLauncher = appInfo.isLauncher; + // Fix touchscreen issues before the listener is added by the parent constructor. + this._onTouchEvent = function(actor, event) { + if (event.type() == Clutter.EventType.TOUCH_BEGIN) { + // Activate/launch the application, on touch start because touch end doesn't work sometimes. + this.activate(1); + + // Open the popup menu on long press. + this._setPopupTimeout(); + } else if (this._menuTimeoutId != 0 && (event.type() == Clutter.EventType.TOUCH_END || event.type() == Clutter.EventType.TOUCH_CANCEL)) { + this._removeMenuTimeout(); + } + // Disable dragging via touch screen as it's buggy as hell. Not perfect for tablet users, but the alternative is way worse. + // Also, EVENT_PROPAGATE launches applications twice with this solution, so this.activate(1) above must only be called if there's already a window. + return Clutter.EVENT_STOP; + }; + this.parent(appInfo.app, iconParams, onActivateOverride); this._dot.set_width(0); From 3a8d93068e27cbd98d619f17204da6ecbcf4457e Mon Sep 17 00:00:00 2001 From: Moritz Marquardt Date: Mon, 5 Mar 2018 20:28:30 +0100 Subject: [PATCH 2/2] Add workaround for missing TOUCH_END event --- appIcons.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/appIcons.js b/appIcons.js index 12ca15e5..4dd43631 100644 --- a/appIcons.js +++ b/appIcons.js @@ -106,18 +106,23 @@ var taskbarAppIcon = new Lang.Class({ // Fix touchscreen issues before the listener is added by the parent constructor. this._onTouchEvent = function(actor, event) { if (event.type() == Clutter.EventType.TOUCH_BEGIN) { - // Activate/launch the application, on touch start because touch end doesn't work sometimes. - this.activate(1); - // Open the popup menu on long press. - this._setPopupTimeout(); - } else if (this._menuTimeoutId != 0 && (event.type() == Clutter.EventType.TOUCH_END || event.type() == Clutter.EventType.TOUCH_CANCEL)) { - this._removeMenuTimeout(); + this._setPopupTimeout(); + } else if (this._menuTimeoutId != 0 && (event.type() == Clutter.EventType.TOUCH_END || event.type() == Clutter.EventType.TOUCH_CANCEL)) { + // Activate/launch the application. + this.activate(1); + this._removeMenuTimeout(); } // Disable dragging via touch screen as it's buggy as hell. Not perfect for tablet users, but the alternative is way worse. // Also, EVENT_PROPAGATE launches applications twice with this solution, so this.activate(1) above must only be called if there's already a window. return Clutter.EVENT_STOP; }; + // Hack for missing TOUCH_END event. + this._onLeaveEvent = function(actor, event) { + this.actor.fake_release(); + if (this._menuTimeoutId != 0) this.activate(1); // Activate/launch the application if TOUCH_END didn't fire. + this._removeMenuTimeout(); + }; this.parent(appInfo.app, iconParams, onActivateOverride);