[gnome-shell] magnifier: Don't query pointer unless necessary



commit 1ea4d72fe5316585578913ba329874a444a1d7f4
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 29 21:56:57 2021 +0200

    magnifier: Don't query pointer unless necessary
    
    The PointerWatcher passes the current pointer position to every watch,
    so we don't have to query the pointer again scrollToMousePos() is used
    as watch callback.
    
    While that should be the only use, be conservative and still query the
    pointer when called without arguments.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1932>

 js/ui/magnifier.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 08466b9a09..f170bbed01 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -230,8 +230,8 @@ var Magnifier = class Magnifier {
      * system pointer.
      * @returns {bool} true.
      */
-    scrollToMousePos() {
-        let [xMouse, yMouse] = global.get_pointer();
+    scrollToMousePos(...args) {
+        const [xMouse, yMouse] = args.length ? args : global.get_pointer();
 
         if (xMouse != this.xMouse || yMouse != this.yMouse) {
             this.xMouse = xMouse;


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