magnifier: Implement pointer motion tracking differently

The use of the core idle monitor means that focus change events
are also delayed by keyboard interaction. Since the magnifier is
already in the business of pointer tracking, it's easy enough to
fire the pointer rest timeout from here, so focus changes are
accumulated and delayed.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/984
This commit is contained in:
Carlos Garnacho 2020-02-06 13:25:20 +01:00 committed by Florian Müllner
parent b1ea4f6c35
commit 83d083f189

View File

@ -1133,6 +1133,13 @@ var ZoomRegion = class ZoomRegion {
return this._screenPosition; return this._screenPosition;
} }
_clearScrollContentsTimer() {
if (this._scrollContentsTimerId !== 0) {
GLib.source_remove(this._scrollContentsTimerId);
this._scrollContentsTimerId = 0;
}
}
/** /**
* scrollToMousePos: * scrollToMousePos:
* Set the region of interest based on the position of the system pointer. * Set the region of interest based on the position of the system pointer.
@ -1146,28 +1153,29 @@ var ZoomRegion = class ZoomRegion {
else else
this._updateMousePosition(); this._updateMousePosition();
this._clearScrollContentsTimer();
this._scrollContentsTimerId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, POINTER_REST_TIME, () => {
this._followingCursor = false;
if (this._xDelayed !== null && this._yDelayed !== null) {
this._scrollContentsToDelayed(this._xDelayed, this._yDelayed);
this._xDelayed = null;
this._yDelayed = null;
}
return GLib.SOURCE_REMOVE;
});
// Determine whether the system mouse pointer is over this zoom region. // Determine whether the system mouse pointer is over this zoom region.
return this._isMouseOverRegion(); return this._isMouseOverRegion();
} }
_clearScrollContentsTimer() {
if (this._scrollContentsTimerId != 0) {
GLib.source_remove(this._scrollContentsTimerId);
this._scrollContentsTimerId = 0;
}
}
_scrollContentsToDelayed(x, y) { _scrollContentsToDelayed(x, y) {
if (this._pointerIdleMonitor.get_idletime() >= POINTER_REST_TIME) { if (this._followingCursor) {
this._xDelayed = x;
this._yDelayed = y;
} else {
this.scrollContentsTo(x, y); this.scrollContentsTo(x, y);
return;
} }
this._clearScrollContentsTimer();
this._scrollContentsTimerId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, POINTER_REST_TIME, () => {
this._scrollContentsToDelayed(x, y);
return GLib.SOURCE_REMOVE;
});
} }
/** /**