[meld] diffmap: Don't invalidate our cached diffmap on spurious allocations



commit a70e6e5df358bf0acc0775b20f3467909435741c
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Nov 18 05:30:11 2017 +1000

    diffmap: Don't invalidate our cached diffmap on spurious allocations
    
    Unfortunately, we get allocation change signals from scrollbars every
    time the user even hovers a mouse over one, so instead of just trusting
    the widgets not to be insane here, we'll check the new allocation.

 meld/diffmap.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/meld/diffmap.py b/meld/diffmap.py
index 16ae720..fac4276 100644
--- a/meld/diffmap.py
+++ b/meld/diffmap.py
@@ -32,6 +32,7 @@ class DiffMap(Gtk.DrawingArea):
     def __init__(self):
         Gtk.DrawingArea.__init__(self)
         self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
+        self._last_allocation = None
         self._scrolladj = None
         self._difffunc = lambda: None
         self._handlers = []
@@ -103,6 +104,10 @@ class DiffMap(Gtk.DrawingArea):
         self.queue_draw()
 
     def on_scrollbar_size_allocate(self, scrollbar, allocation):
+        if self._last_allocation and self._last_allocation.equal(allocation):
+            return
+
+        self._last_allocation = allocation
         translation = scrollbar.translate_coordinates(self, 0, 0)
         _scroll_y = translation[1] if translation else 0
         self._y_start = _scroll_y + self._y_offset + 1


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