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 - X11_CreateWindowFrom: bad cast of pointer
Summary: X11_CreateWindowFrom: bad cast of pointer
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86_64 Linux
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-02 11:20 UTC by gregory.hainaut
Modified: 2013-05-21 02:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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?