diff --git a/appIcons.js b/appIcons.js index 8898669a..03f321e0 100644 --- a/appIcons.js +++ b/appIcons.js @@ -103,6 +103,27 @@ 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) { + // 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)) { + // 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); this._dot.set_width(0);