[meld] filediff: Skip unnecessary textview drawing and remove vestigal code
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Skip unnecessary textview drawing and remove vestigal code
- Date: Sun, 23 Nov 2014 04:23:34 +0000 (UTC)
commit 000a5c9f79775120ede462f018637cbdcacc7aff
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Nov 23 14:13:50 2014 +1000
filediff: Skip unnecessary textview drawing and remove vestigal code
This is only a partial fix for unnecessary drawing, but should skip a
small amount of pointless work. Doing this better isn't actually worth
it because the pixel cache and draw-layer changes in GTK+ 3.14 just
make this so much faster it's not even funny.
Also, the hack in the commented-out code isn't necessary any more, so
remove it. How did it even escape detection?!
meld/filediff.py | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 9165503..daa3166 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -167,6 +167,12 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
# Identifiers for MsgArea messages
(MSG_SAME, MSG_SLOW_HIGHLIGHT, MSG_SYNCPOINTS) = list(range(3))
+ text_windows = {
+ Gtk.TextWindowType.TEXT,
+ Gtk.TextWindowType.LEFT,
+ Gtk.TextWindowType.RIGHT,
+ }
+
__gsignals__ = {
'next-conflict-changed': (GObject.SignalFlags.RUN_FIRST, None, (bool, bool)),
'action-mode-changed': (GObject.SignalFlags.RUN_FIRST, None, (int,)),
@@ -1504,17 +1510,14 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
if self.num_panes == 1:
return
- # FIXME: Update to use gtk_cairo_should_draw_window()
-
- # if event.window != textview.get_window(Gtk.TextWindowType.TEXT) \
- # and event.window != textview.get_window(Gtk.TextWindowType.LEFT):
- # return
+ def should_draw(textwindow):
+ window = textview.get_window(textwindow)
+ if not window:
+ return False
+ return Gtk.cairo_should_draw_window(context, window)
- # # Hack to redraw the line number gutter used by post-2.10 GtkSourceView
- # if event.window == textview.get_window(Gtk.TextWindowType.LEFT) and \
- # self.in_nested_textview_gutter_expose:
- # self.in_nested_textview_gutter_expose = False
- # return
+ if not any(should_draw(w) for w in self.text_windows):
+ return
visible = textview.get_visible_rect()
pane = self.textview.index(textview)
@@ -1601,10 +1604,6 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
GLib.source_remove(self.anim_source_id[pane])
self.anim_source_id[pane] = None
- # if event.window == textview.get_window(Gtk.TextWindowType.LEFT):
- # self.in_nested_textview_gutter_expose = True
- # textview.emit("expose-event", event)
-
def _get_filename_for_saving(self, title ):
dialog = Gtk.FileChooserDialog(title,
parent=self.widget.get_toplevel(),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]