js/ui: Subscribe touchpad gesture handlers to only touchpad events

The touchpad gesture handlers were receiving all events, all the time.
This meant that even mouse movements were getting translated into
JavaScript calls and then discarded by the handlers, which wasted CPU.

Now we subscribe the touchpad gesture handlers to only touchpad events.

Prequisite: https://gitlab.gnome.org/GNOME/mutter/merge_requests/1000

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/283

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/925
This commit is contained in:
Daniel van Vugt 2020-01-10 15:44:35 +08:00 committed by Jonas Ådahl
parent daff787a62
commit bd197789c1
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ const TouchpadSwipeGesture = GObject.registerClass({
this._orientation = Clutter.Orientation.VERTICAL;
this._enabled = true;
global.stage.connect('captured-event', this._handleEvent.bind(this));
global.stage.connect('captured-event::touchpad', this._handleEvent.bind(this));
}
get enabled() {

View File

@ -44,7 +44,7 @@ function getTermsForSearchString(searchString) {
var TouchpadShowOverviewAction = class {
constructor(actor) {
actor.connect('captured-event', this._handleEvent.bind(this));
actor.connect('captured-event::touchpad', this._handleEvent.bind(this));
}
_handleEvent(actor, event) {