diff options
author | Stuart Langridge <sil@kryogenix.org> | 2019-05-25 16:22:23 +0100 |
---|---|---|
committer | Stuart Langridge <sil@kryogenix.org> | 2019-05-25 16:22:23 +0100 |
commit | a05ff581618a2063128c834812fbb0b107d59be8 (patch) | |
tree | a76c789924b0db244ca2907bc7a584ec5f6f8b96 | |
parent | Restore the zoom level on startup and set the dropdown to reflect that (diff) | |
download | magnus-a05ff581618a2063128c834812fbb0b107d59be8.tar.gz magnus-a05ff581618a2063128c834812fbb0b107d59be8.tar.bz2 magnus-a05ff581618a2063128c834812fbb0b107d59be8.zip |
Don't bother generating the magnified image if the mouse position hasn't changed
-rw-r--r-- | magnus/__main__.py | 7 |
1 files changed, 7 insertions, 0 deletions
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 |