Have you checked what the xid call returns? Probably 0, right? You need to 
flush the event queue until the window is actually mapped:

while (!window.visible()) fltk::flush();

Apart from that, I have no idea what SDL does, and I find the way of using an 
environment variable to pass the address (or ID) of an X-window more than 
suspicious.


On 15.11.2010, at 16:27, Armin Steinhoff wrote:

Hi All,

I have tried to share a X window between FLTK and SDL.

Below is a subset of the used code:

-----------------------------------------------

int main(int argc, char **argv)
{
        int w = 640; // must be > 104 
        int h = 480; 
        char winhack[64]; 
        SDL_Rect rect; 
        Window window(w, h); 
        window.begin(); 
                Button* b = new Button(0, 0, 40, 20, "Print");
                b->callback(more_cb); 
        window.end(); 
        window.show(argc,argv);

        temp_1 = SDL_LoadBMP ("logo.bmp"); 
        memset(winhack, 0x00, 64); 
        int wid = xid(&window); 
        sprintf( winhack, "SDL_WINDOWID=0x%X", wid); 
        putenv(winhack); // set the environment variable SDL_WINDOWID SDL_Init 
(SDL_INIT_VIDEO); 
        screen = SDL_SetVideoMode (640, 480, 0, 0); 
------------------------------------------------------------------------------------------
 

The call SDL_SetVideoMode prints the following out on the shell: 
X_GetWindowAttributes: BadWindow (invalid Window parameter) 0x3800002 
X_CreateColormap: BadMatch (invalid parameter attributes) 0x32840 X_CreateGC: 
BadDrawable (invalid Pixmap or Window parameter) 0x3800002 
X_ChangeWindowAttributes: BadWindow (invalid Window parameter) 0x3800002 
XRequest.145: BadDrawable (invalid Pixmap or Window parameter) 0x3800002 
X_ChangeWindowAttributes: BadWindow (invalid Window parameter) 0x3800002 
X_QueryPointer: BadWindow (invalid Window parameter) 0x3800002 XRequest.145: 
BadDrawable (invalid Pixmap or Window parameter) 0x3800002 Nothing is working 
... what could be the problem ? --Armin
___________________________________________________________
GRATIS! Movie-FLAT mit über 300 Videos. 
Jetzt freischalten unter http://movieflat.web.de

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to