Comment 15 for bug 49613

Revision history for this message
In , Mozilla-paperetto (mozilla-paperetto) wrote :

Created attachment 104801
Rough patch for implementing windowless support on Unix

The patch does not work in its current state, I have attached it so I don't
lose what I've done. It is also not very polished, e.g. I am sure there is a
better way of doing the GTK specific stuff without #ifdefing it everywhere. The
aim at the moment is to get it working and worry about tidying it up later!

On the plugin side I have implemented HandleEvent as follows:
uint16 nsPluginInstance::HandleEvent(void* aEvent)
{
  NPEvent * event = (NPEvent *)aEvent;
  switch (event->type) {
    case GraphicsExpose:
    {
 XGraphicsExposeEvent* exevent = (XGraphicsExposeEvent*)event;

 //GC gc = XCreateGC(exevent->display, exevent->drawable, 0, NULL);
 //mWindow is stored from the call to SetWindow
 if(!mWindow)
    return 1;
 GC gc = (GC)(mWindow->window);
 if (!gc)
    return 1;
 XDrawRectangle(exevent->display, exevent->drawable, gc, x, y, w, h);

However it crashes inside the call to XDrawRectangle, which I guess means that
there is something wrong with the drawable. I'm not really an expert on Xlib so
if anyone has any suggestions I'll be grateful.