Magnifier: Filter caret tracking in gnome magnifier

Add a check to filter out caret tracking events that result in a caret
location of 0,0.

Fixes #4177

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1823>
This commit is contained in:
Lee 2021-04-24 18:03:35 +01:00 committed by Marge Bot
parent 8430aa59da
commit 006d206f98

View File

@ -827,6 +827,12 @@ var ZoomRegion = class ZoomRegion {
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let [xCaret, yCaret] = [extents.x * scaleFactor, extents.y * scaleFactor]; let [xCaret, yCaret] = [extents.x * scaleFactor, extents.y * scaleFactor];
// Ignore event(s) if the caret size is none (0x0). This happens a lot if
// the cursor offset can't be translated into a location. This is a work
// around.
if (extents.width === 0 && extents.height === 0)
return;
if (this._xCaret !== xCaret || this._yCaret !== yCaret) { if (this._xCaret !== xCaret || this._yCaret !== yCaret) {
[this._xCaret, this._yCaret] = [xCaret, yCaret]; [this._xCaret, this._yCaret] = [xCaret, yCaret];
this._centerFromCaretPosition(); this._centerFromCaretPosition();