[meld/meld-3-12] filediff: Repaint TextView background for modified CSS (bgo#741287)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/meld-3-12] filediff: Repaint TextView background for modified CSS (bgo#741287)
- Date: Fri, 12 Dec 2014 22:39:25 +0000 (UTC)
commit 281583a05117b9d05acb010c98adfebfeb27f70c
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Dec 13 08:34:04 2014 +1000
filediff: Repaint TextView background for modified CSS (bgo#741287)
In cases when we've messed with our TextView's CSS to fix GTK+ 3.14
regressions, we need to also repaint the background because some themes
don't otherwise do so. Specifically, this breaks oxygen-gtk3 such that
diff regions have a background colour, but the rest of the text view
is unpainted, which is pretty terrible.
bin/meld | 6 +++++-
meld/filediff.py | 8 ++++++++
2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index f8e4118..888de37 100755
--- a/bin/meld
+++ b/bin/meld
@@ -196,12 +196,16 @@ def setup_resources():
style.set_path(widget_path)
# This is basically indefensible internal GTK+ ABI, but... whatever.
style.add_class(Gtk.STYLE_CLASS_VIEW)
+ old_bg_color = style.get_background_color(
+ Gtk.StateFlags.NORMAL).to_string()
color = style.get_background_color(Gtk.StateFlags.SELECTED).to_string()
fixes_provider = Gtk.CssProvider()
fixes_provider.load_from_data(
+ "@define-color override-background-color %s; "
"MeldSourceView { background-color: rgba(0.0, 0.0, 0.0, 0.0); } "
- "MeldSourceView:selected { background-color: %s; } " % color)
+ "MeldSourceView:selected { background-color: %s; } " %
+ (old_bg_color, color))
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(), fixes_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
diff --git a/meld/filediff.py b/meld/filediff.py
index 724456e..2c9f027 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -419,6 +419,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
tag = buf.get_tag_table().lookup("inline")
tag.props.background_rgba = lookup("inline-bg", "LightSteelBlue2")
+ override_bg = style.lookup_color("override-background-color")
+ self.override_bg = override_bg[1] if override_bg[0] else None
+
self.fill_colors = {"insert" : lookup("insert-bg", "DarkSeaGreen1"),
"delete" : lookup("insert-bg", "DarkSeaGreen1"),
"conflict": lookup("conflict-bg", "Pink"),
@@ -1529,6 +1532,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
width, height = view_allocation.width, view_allocation.height
context.set_line_width(1.0)
+ if self.override_bg:
+ context.set_source_rgba(*self.override_bg)
+ context.rectangle(0, 0, width, height)
+ context.fill()
+
for change in self.linediffer.single_changes(pane, bounds):
ypos0 = textview.get_y_for_line_num(change[1]) - visible.y
ypos1 = textview.get_y_for_line_num(change[2]) - visible.y
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]