Skip to content

Commit

Permalink
Merge pull request #350 from moqmar/master
Browse files Browse the repository at this point in the history
Fix touchscreen behaviour for taskbarAppIcon (#223)
  • Loading branch information
jderose9 committed Mar 14, 2018
2 parents 1c32306 + 3a8d930 commit ab239be
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions appIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ab239be

Please sign in to comment.