From a05ff581618a2063128c834812fbb0b107d59be8 Mon Sep 17 00:00:00 2001 From: Stuart Langridge Date: Sat, 25 May 2019 16:22:23 +0100 Subject: Don't bother generating the magnified image if the mouse position hasn't changed --- magnus/__main__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/magnus/__main__.py b/magnus/__main__.py index 1ae5d77..d7521dd 100644 --- a/magnus/__main__.py +++ b/magnus/__main__.py @@ -19,6 +19,8 @@ class Main(object): self.window_metrics_restored = False self.decorations_height = 0 self.decorations_width = 0 + self.last_x = -1 + self.last_y = -1 def handle_commandline(self, app, cmdline): if hasattr(self, "w"): @@ -143,6 +145,11 @@ class Main(object): def poll(self): display = Gdk.Display.get_default() (screen, x, y, modifier) = display.get_pointer() + if x == self.last_x and y == self.last_y: + # bail if nothing would be different + return True + self.last_x = x + self.last_y = y if (x > self.window_x and x <= (self.window_x + self.width + self.decorations_width) and y > self.window_y and y <= (self.window_y + self.height + self.decorations_height)): # pointer is over our window, so make it an empty pixbuf -- cgit