Hi. I'm writing an xfce panel plugin in vala to embed the famous gnome DockBarX applet. Since it provides a desktop-agnostic gtk widget, I figured that it should be doable. Except that it's in python. I couldn't just write the entire plugin in python, because the python bindings for xfce are out of date. Since I don't know of any way to do interoperability between vala and python, I decided to use plugs and sockets to get it in there. The vala plugin provides the socket, and a little python program makes the plug. It worked! Except that it had a gray background, which was jarring considering the rest of the panel has a nice fading translucent gradient. I couldn't find any way to gracefully get rid of that, so I looked around and decided to fake it with an expose event. That worked! ...almost. When I started selecting different windows, the effect for the selected window stayed on the old one, and started cropping up as I went back and forth, resulting in this:

This behavior doesn't occur when I don't have the custom expose (in other words, with the gray background). I've been googling for entirely too long, and I am out of energy. I feel like I have scoured every corner of the internet for advice on what to do about this. I have no idea what to do to make this go away. Here's the python code for the plug, which does most of the work. Can anyone tell me what to do to fix this?
Code:
from dockbarx.log import *
import sys
log_to_file()
sys.stderr = StdErrWrapper()
sys.stdout = StdOutWrapper()
import pygtk
pygtk.require("2.0")
import gtk
import dockbarx.dockbar
import cairo
class DockBarXPlug(gtk.Plug):
__gsignals__ = {"expose-event": "override"}
def __init__(self, socket=0, panel_bg=""):
gtk.Plug.__init__(self, socket)
self.panel_bg = panel_bg
self.connect("destroy",self.__destroy)
self.set_app_paintable(1);
gtk_screen = gtk.gdk.screen_get_default()
colormap = gtk_screen.get_rgba_colormap()
if colormap is None:
colormap = gtk_screen.get_rgb_colormap()
self.set_colormap(colormap)
self.dockbar = dockbarx.dockbar.DockBar(parent_window=self)
self.add(self.dockbar.container)
self.show_all()
def do_expose_event(self, event):
self.window.set_back_pixmap(None, False)
self.ctx = self.window.cairo_create()
if self.is_composited():
self.ctx.set_source_rgba(1, 1, 1, 0)
else:
self.ctx.set_source_rgb(0.8, 0.8, 0.8)
self.ctx.set_operator(cairo.OPERATOR_SOURCE)
self.ctx.paint()
self.ctx.rectangle(event.area.x, event.area.y,
event.area.width, event.area.height)
self.ctx.clip()
self.ctx.set_operator(cairo.OPERATOR_OVER)
surface = cairo.ImageSurface.create_from_png(self.panel_bg)
pattern = cairo.SurfacePattern(surface)
pattern.set_extend(cairo.EXTEND_REPEAT)
self.ctx.set_source(pattern)
self.ctx.paint()
gtk.Plug.do_expose_event(self, event)
if self.get_child():
self.propagate_expose(self.get_child(), event)
def __destroy (self,widget,data=None):
gtk.main_quit()
def main(self):
gtk.main()
socket = 0
panel_bg = ""
if "--socket" in sys.argv:
i = sys.argv.index("--socket") + 1
try:
socket = int(sys.argv[i])
except:
raise
if "--bg" in sys.argv:
i = sys.argv.index("--bg") + 1
try:
panel_bg = sys.argv[i]
except:
raise
dockbarxplug = DockBarXPlug(socket, panel_bg)
dockbarxplug.main()