[meld] diffmap: Fix scrollbar-alignment code for new GTK+ allocation behaviour



commit 6c121362e2b425e56090c771ef7fa29980f031a6
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Oct 3 12:11:05 2015 +1000

    diffmap: Fix scrollbar-alignment code for new GTK+ allocation behaviour
    
    There's still a few areas of somewhat-internal hackery here in handling
    the scrollbar's style properties and allocations, but this works for
    now at least.

 meld/diffmap.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/meld/diffmap.py b/meld/diffmap.py
index 7a3a8d7..15717e6 100644
--- a/meld/diffmap.py
+++ b/meld/diffmap.py
@@ -107,7 +107,8 @@ class DiffMap(Gtk.DrawingArea):
         self.queue_draw()
 
     def on_scrollbar_size_allocate(self, scrollbar, allocation):
-        self._scroll_y = allocation.y
+        translation = scrollbar.translate_coordinates(self, 0, 0)
+        self._scroll_y = translation[1] if translation else 0
         self._scroll_height = allocation.height
         self._width = max(allocation.width, 10)
         self._cached_map = None
@@ -117,7 +118,7 @@ class DiffMap(Gtk.DrawingArea):
         if not self._setup:
             return
         height = self._scroll_height - self._h_offset - 1
-        y_start = self._scroll_y - self.get_allocation().y - self._y_offset + 1
+        y_start = self._scroll_y + self._y_offset + 1
         width = self.get_allocated_width()
         xpad = 2.5
         x0 = xpad


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