[meld] Fix linkmap click detection when scrollbar is offset (closes bgo#609800)



commit 3aabcd7291a64a9373bfb6b49fad1afa9ae7790a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Feb 14 06:42:44 2010 +1000

    Fix linkmap click detection when scrollbar is offset (closes bgo#609800)
    
    When the linkmap doesn't start at the same vertical position as the
    scrollbar (i.e., when there is an InfoBar) we correctly offset the drawing
    of merge arrows, but not the click detection. This commit adds an offset
    to the click processing.

 meld/filediff.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index c4ff340..d0ab679 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1263,12 +1263,14 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
     def _linkmap_process_event(self, event, which, side, htotal, rect_x, pix_width, pix_height):
         src = which + side
         dst = which + 1 - side
+        yoffset = self.linkmap[which].allocation.y
+        rel_offset = self.textview[src].allocation.y - yoffset
         adj = self.scrolledwindow[src].get_vadjustment()
 
         for c in self.linediffer.pair_changes(src, dst):
             if c[0] == "insert":
                 continue
-            h = self._line_to_pixel(src, c[1]) - adj.value
+            h = self._line_to_pixel(src, c[1]) - adj.value + rel_offset
             if h < 0: # find first visible chunk
                 continue
             elif h > htotal: # we've gone past last visible



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