Merge pull request #350 from moqmar/master

Fix touchscreen behaviour for taskbarAppIcon (#223)
This commit is contained in:
Jason DeRose
2018-03-14 12:05:57 -04:00
committed by GitHub

View File

@@ -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);