How to use SDL within a firefox plugin?

Create child window and work only
with it…

I’m trying to create a child window using XCreateSimpleWindow() but I’m getting a compilation error as mention below.

NPError
NPP_SetWindow(NPP instance, NPWindow* npwindow)
{
Window childWID;
NPSetWindowCallbackStruct* ws_info;
Window *wp;
Display *dpy;

ws_info = (NPSetWindowCallbackStruct*) npwindow->ws_info;

dpy = (Display *) ws_info->display;

sprintf(buf, “host:display: %s\n”, (char *) dpy->display_name);
sprintf(buf, “Release of the server: %d\n”, (int) dpy->release);

}

It says “error: dereferencing pointer to incomplete type” for sprintf lines. Any idea why?


http://xwindow.angelfire.com/page28.html

Unga— On Sun, 8/14/11, Oleg wrote:

From: Oleg
Subject: Re: [SDL] How to use SDL within a firefox plugin?
To: “SDL Development List”
Date: Sunday, August 14, 2011, 3:12 AM

plugin?

Create child window and work only
with it…

I’m trying to create a child window using
XCreateSimpleWindow() but I’m getting a compilation error as
mention below.

NPError
NPP_SetWindow(NPP instance, NPWindow* npwindow)
{
? Window childWID;
? NPSetWindowCallbackStruct* ws_info;
? Window *wp;
? Display *dpy;

ws_info = (NPSetWindowCallbackStruct*)
npwindow->ws_info;

dpy = (Display *) ws_info->display;

sprintf(buf, “host:display: %s\n”, (char *)
dpy->display_name);
sprintf(buf, “Release of the server: %d\n”, (int)
dpy->release);

}

It says "error: dereferencing pointer to incomplete type"
for sprintf lines. Any idea why?

https://developer.mozilla.org/en/NPWindow
http://xwindow.angelfire.com/page28.html

Unga

Ok found the problem, following includes were missing.

#include <X11/Xlibint.h>
#include <X11/Xlib.h>

Unga— On Sun, 8/14/11, Unga <@Unga> wrote:

From: Unga <@Unga>
Subject: Re: [SDL] How to use SDL within a firefox plugin?
To: “SDL Development List”
Date: Sunday, August 14, 2011, 8:21 PM
— On Sun, 8/14/11, Oleg wrote:

From: Oleg
Subject: Re: [SDL] How to use SDL within a firefox
To: “SDL Development List”
Date: Sunday, August 14, 2011, 3:12 AM

Create child window and work only
with it…

Firefox crashes when executing XCreateSimpleWindow().

NPP_SetWindow() defined as follows:

NPError
NPP_SetWindow(NPP instance, NPWindow* npwindow)
{
Window childWID;
NPSetWindowCallbackStruct* ws_info;
Window *wp;
Display *dpy;

ws_info = (NPSetWindowCallbackStruct*) npwindow->ws_info;

dpy = (Display *) ws_info->display;

wp = (Window*) npwindow->window;

childWID = XCreateSimpleWindow(dpy, (*wp), npwindow->x, npwindow->y,
npwindow->width, npwindow->height, 0, 0, 0);

}

The npwindow, ws_info, dpy, and wp are not NULL.

Any idea why XCreateSimpleWindow() crashes (signal 11
(core dumped))?

Unga— On Sun, 8/14/11, Oleg wrote:

From: Oleg
Subject: Re: [SDL] How to use SDL within a firefox plugin?
To: “SDL Development List”
Date: Sunday, August 14, 2011, 3:12 AM