[meld] diffmap: 'Fix' Diffmap sizing for some weird DirDiff race condition



commit dc34a3eb6463d8c3809aecdc2b47a63fa20bddc7
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Dec 31 12:00:31 2013 +1000

    diffmap: 'Fix' Diffmap sizing for some weird DirDiff race condition
    
    This isn't a real fix; for some reason even when a resize is queued
    with the correct width, the draw event comes through while there is
    still an old requisition on the widget. This isn't reproducible if
    the allocation is >1, so it looks like it might be some weird
    optimisation edge case?

 meld/diffmap.py |    2 +-
 meld/dirdiff.py |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/meld/diffmap.py b/meld/diffmap.py
index 73b8432..c7e5cad 100644
--- a/meld/diffmap.py
+++ b/meld/diffmap.py
@@ -107,7 +107,7 @@ class DiffMap(Gtk.DrawingArea):
     def on_scrollbar_size_allocate(self, scrollbar, allocation):
         self._scroll_y = allocation.y
         self._scroll_height = allocation.height
-        self._width = allocation.width
+        self._width = max(allocation.width, 10)
         self.queue_resize()
 
     def do_draw(self, context):
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 8dee37e..8ad12c2 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -810,6 +810,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
 
         self.scheduler.add_task(self.on_treeview_cursor_changed)
         self.treeview[0].get_selection().select_path(Gtk.TreePath.new_first())
+        self._update_diffmaps()
 
     def _show_tree_wide_errors(self, invalid_filenames, shadowed_entries):
         header = _("Multiple errors occurred while scanning this folder")
@@ -1452,8 +1453,9 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
         self.recompute_label()
 
     def _update_diffmaps(self):
-        self.diffmap[0].queue_draw()
-        self.diffmap[1].queue_draw()
+        for diffmap in self.diffmap:
+            diffmap.on_diffs_changed()
+            diffmap.queue_draw()
 
     def on_file_changed(self, changed_filename):
         """When a file has changed, try to find it in our tree


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