magnifier: Transform a11y events' coordinates by scale factor

We get those events in logical coordinates, which we have to transform
into actual pixels.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/984
This commit is contained in:
Carlos Garnacho 2020-02-06 10:59:20 +01:00 committed by Florian Müllner
parent c8d02be14a
commit f3b56e0eb1

View File

@ -799,8 +799,9 @@ var ZoomRegion = class ZoomRegion {
return; return;
} }
let [xFocus, yFocus] = [extents.x + (extents.width / 2), let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
extents.y + (extents.height / 2)]; let [xFocus, yFocus] = [(extents.x + (extents.width / 2)) * scaleFactor,
(extents.y + (extents.height / 2)) * scaleFactor];
if (this._xFocus !== xFocus || this._yFocus !== yFocus) { if (this._xFocus !== xFocus || this._yFocus !== yFocus) {
[this._xFocus, this._yFocus] = [xFocus, yFocus]; [this._xFocus, this._yFocus] = [xFocus, yFocus];
@ -820,7 +821,8 @@ var ZoomRegion = class ZoomRegion {
return; return;
} }
let [xCaret, yCaret] = [extents.x, extents.y]; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let [xCaret, yCaret] = [extents.x * scaleFactor, extents.y * scaleFactor];
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];