Commit a70e6e5d authored by Kai Willadsen's avatar Kai Willadsen

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.
parent fff6ef47
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment