[gnome-shell/wip/carlosg/magnifier-improvements: 3/5] magnifier: Implement pointer motion tracking differently
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/magnifier-improvements: 3/5] magnifier: Implement pointer motion tracking differently
- Date: Thu, 6 Feb 2020 14:17:26 +0000 (UTC)
commit 2a4527f890c17b3066b85e86eed4343ea0cc1bdd
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Feb 6 13:25:20 2020 +0100
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.
js/ui/magnifier.js | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 5037331a3c..8626799b25 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -1133,6 +1133,13 @@ var ZoomRegion = class ZoomRegion {
return this._screenPosition;
}
+ _clearScrollContentsTimer() {
+ if (this._scrollContentsTimerId != 0) {
+ GLib.source_remove(this._scrollContentsTimerId);
+ this._scrollContentsTimerId = 0;
+ }
+ }
+
/**
* scrollToMousePos:
* Set the region of interest based on the position of the system pointer.
@@ -1146,28 +1153,29 @@ var ZoomRegion = class ZoomRegion {
else
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.
return this._isMouseOverRegion();
}
- _clearScrollContentsTimer() {
- if (this._scrollContentsTimerId != 0) {
- GLib.source_remove(this._scrollContentsTimerId);
- this._scrollContentsTimerId = 0;
- }
- }
-
_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);
- return;
}
-
- this._clearScrollContentsTimer();
- this._scrollContentsTimerId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, POINTER_REST_TIME, () => {
- this._scrollContentsToDelayed(x, y);
- return GLib.SOURCE_REMOVE;
- });
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]