Browse code

xdot: Use theme background on DotWidget.

I use a dark GTK+ theme and the stark white background on xdot's graph
canvas area sometimes hurts my eyes. This change makes the widget use
the current theme's background colour instead.

astian authored on 03/10/2018 03:19:00 • Jose Fonseca committed on 11/10/2018 12:47:55
Showing 1 changed files

... ...
@@ -170,11 +170,11 @@ class DotWidget(Gtk.DrawingArea):
170 170
         return True
171 171
 
172 172
     def on_draw(self, widget, cr):
173
-        cr.set_source_rgba(1.0, 1.0, 1.0, 1.0)
174
-        cr.paint()
173
+        rect = self.get_allocation()
174
+        Gtk.render_background(self.get_style_context(), cr, 0, 0,
175
+                              rect.width, rect.height)
175 176
 
176 177
         cr.save()
177
-        rect = self.get_allocation()
178 178
         cr.translate(0.5*rect.width, 0.5*rect.height)
179 179
         cr.scale(self.zoom_ratio, self.zoom_ratio)
180 180
         cr.translate(-self.x, -self.y)