We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1198

Summary: X11_CreateWindowFrom: bad cast of pointer
Product: SDL Reporter: gregory.hainaut
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Linux   

Description gregory.hainaut 2011-05-02 11:20:23 UTC
Hello,

I try to use the SDL_CreateWindowFrom function on X11 system.

As wiki said: http://wiki.libsdl.org/moin.cgi/SDL_CreateWindowFrom you need to send a void pointer to the window.

/* my code */
Window glWindow = ...;
m_window = SDL_CreateWindowFrom((void*)&glWindow);

But SDL does not take the content of the pointer but the pointer itself.
/* SDL code */
X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
 {
     Window w = (Window) data;

/* My proposal to properly get the Window */
Window w = *(Window*) data;


Best regards,
Gregory
Comment 1 Sam Lantinga 2012-01-06 22:41:30 UTC
The documentation is slightly misleading.  What it actually means is that you're supposed to cast your window to a void pointer.
Comment 2 gregory.hainaut 2012-01-07 00:50:16 UTC
Yes I did that. It might worth to add a few line example. Thanks
Comment 3 Sam Lantinga 2012-01-07 11:06:59 UTC
I clarified the documentation a bit.  Would you like to contribute a minimal X11 example?