[gnome-shell] magnifier: Update screen position on activation



commit a298943fac0beb5825c12ae59f682af1d417e346
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Mar 27 22:16:26 2019 +0100

    magnifier: Update screen position on activation
    
    The default ZoomRegion is created at startup and only updated if it is active
    when the monitor setup changes. Thus when reactivating the magnifier after a
    display change, the viewport used is still the one that been computed with the
    old screen geometry values.
    
    Move screen update code inside a function and call it both when activating
    the zoom region and when the monitor changes during a zoom session.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1120

 js/ui/magnifier.js | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 546ab1d98..a059ee98f 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -763,6 +763,18 @@ var ZoomRegion = class ZoomRegion {
                                     this._updateFocus.bind(this));
     }
 
+    _updateScreenPosition() {
+        if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE)
+            this._setViewPort({
+                x: this._viewPortX,
+                y: this._viewPortY,
+                width: this._viewPortWidth,
+                height: this._viewPortHeight
+            });
+        else
+            this.setScreenPosition(this._screenPosition);
+    }
+
     _updateFocus(caller, event) {
         let component = event.source.get_component_iface();
         if (!component || event.detail1 != 1)
@@ -808,6 +820,7 @@ var ZoomRegion = class ZoomRegion {
             this._createActors();
             if (this._isMouseOverRegion())
                 this._magnifier.hideSystemCursor();
+            this._updateScreenPosition();
             this._updateMagViewGeometry();
             this._updateCloneGeometry();
             this._updateMousePosition();
@@ -1565,14 +1578,7 @@ var ZoomRegion = class ZoomRegion {
             return;
 
         this._background.set_size(global.screen_width, global.screen_height);
-
-        if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE)
-            this._setViewPort({ x: this._viewPortX,
-                                y: this._viewPortY,
-                                width: this._viewPortWidth,
-                                height: this._viewPortHeight });
-        else
-            this.setScreenPosition(this._screenPosition);
+        this._updateScreenPosition();
     }
 };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]