Qt + SDL with SDL_WINDOWID hack in win32

Hi,

I am developing a cross platform Qt app, and wish to embed a SDL window
in a Qt widget. I can do this under linux using the SDL_WINDOWID
environment variable hack (setting the value to the return of
QWidget::winId() and from searching the archives of this list, it seems
this should be possible in windows too. However, I am unable to get it
to work. I am using SDL 1.2.5. If I do not create the environment
variable in win32, the app works, and I get a non-qt-managed SDL window,
but if I create the env variable, I get a segfault.

The archives seem to suggest that SDL_RegisterApp() should be called
instead of linking to sdlmain.lib (although the header file suggests
SDL_SetModuleHandle() is better). I have tried both of these without
success. I have also seen reference to putenv(“SDL_VIDEODRIVER=windib”)
being useful, and have tried this, but this doesn’t help either. Has
anyone actually managed to get SDL in a Qt widget on win32 working?

Owen

Hi,

There is a little demo on the libsdl demos page

sdl_win32_demo - an example of using the SDL_WINDOWID hack on Windows (requires SDL 1.2.3 or newer)
http://www.maccormack.net/~djm/sdl_win32_demo/

which works for me quite well. However it is using plain windows API not MFC or Qt. But I think it should be possible to translate them to the Qt code. I’m also interested in the Qt + SDL combination because I develop using both these tools. Till now I have not had time to focus on embedding SDL window in the Qt widget but I would be very happy to hear that you have succeded. If yes it would be very kind of you to place a little demo app in the demos section of the SDL web page. From my side I’m very willing to assist in solving problems that may arise.

Jacek Dylak> ----- Original Message -----

From: owen.brydon@st.com (Owen Brydon)
To:
Sent: Wednesday, September 03, 2003 6:15 PM
Subject: [SDL] Qt + SDL with SDL_WINDOWID hack in win32

Hi,

I am developing a cross platform Qt app, and wish to embed a SDL window
in a Qt widget. I can do this under linux using the SDL_WINDOWID
environment variable hack (setting the value to the return of
QWidget::winId() and from searching the archives of this list, it seems
this should be possible in windows too. However, I am unable to get it
to work. I am using SDL 1.2.5. If I do not create the environment
variable in win32, the app works, and I get a non-qt-managed SDL window,
but if I create the env variable, I get a segfault.

The archives seem to suggest that SDL_RegisterApp() should be called
instead of linking to sdlmain.lib (although the header file suggests
SDL_SetModuleHandle() is better). I have tried both of these without
success. I have also seen reference to putenv(“SDL_VIDEODRIVER=windib”)
being useful, and have tried this, but this doesn’t help either. Has
anyone actually managed to get SDL in a Qt widget on win32 working?

Owen


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

dylak at poczta.onet.pl wrote:

Hi,

There is a little demo on the libsdl demos page

sdl_win32_demo - an example of using the SDL_WINDOWID hack on Windows (requires SDL 1.2.3 or newer)
http://www.maccormack.net/~djm/sdl_win32_demo/

which works for me quite well. However it is using plain windows API not MFC or Qt. But I think it should be possible to translate them to the Qt code. I’m also interested in the Qt + SDL combination because I develop using both these tools. Till now I have not had time to focus on embedding SDL window in the Qt widget but I would be very happy to hear that you have succeded. If yes it would be very kind of you to place a little demo app in the demos section of the SDL web page. From my side I’m very willing to assist in solving problems that may arise.

Jacek Dylak

Hi,

I saw this, but am unable to get it to work for its Qt equivalent :(.
Has anyone been able to do this?

Owen

I will give it a try in a free while :slight_smile:
Could you tell me about your results (or where is the problem).

Jacek> ----- Original Message -----

From: owen.brydon@st.com (Owen Brydon)
To:
Sent: Thursday, September 04, 2003 11:22 AM
Subject: Re: [SDL] Qt + SDL with SDL_WINDOWID hack in win32

dylak at poczta.onet.pl wrote:

Hi,

There is a little demo on the libsdl demos page

sdl_win32_demo - an example of using the SDL_WINDOWID hack on Windows (requires SDL 1.2.3 or newer)
http://www.maccormack.net/~djm/sdl_win32_demo/

which works for me quite well. However it is using plain windows API not MFC or Qt. But I think it should be possible to translate them to the Qt code. I’m also interested in the Qt + SDL combination because I develop using both these tools. Till now I have not had time to focus on embedding SDL window in the Qt widget but I would be very happy to hear that you have succeded. If yes it would be very kind of you to place a little demo app in the demos section of the SDL web page. From my side I’m very willing to assist in solving problems that may arise.

Jacek Dylak

Hi,

I saw this, but am unable to get it to work for its Qt equivalent :(.
Has anyone been able to do this?

Owen


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

No joy yet. I am trying to set the value of the SDL_WINDOWID variable to
winId() of the widget I want it to appear in. However as soon as I do
the SDL_Init, it crashes the app. If you get this worked out, I’d love
to hear the results!

Owen

dylak at poczta.onet.pl wrote:> I will give it a try in a free while :slight_smile:

Could you tell me about your results (or where is the problem).

Jacek

----- Original Message -----
From: “Owen Brydon” <@Owen_Brydon>
To:
Sent: Thursday, September 04, 2003 11:22 AM
Subject: Re: [SDL] Qt + SDL with SDL_WINDOWID hack in win32

dylak at poczta.onet.pl wrote:

Hi,

There is a little demo on the libsdl demos page

sdl_win32_demo - an example of using the SDL_WINDOWID hack on Windows (requires SDL 1.2.3 or newer)
http://www.maccormack.net/~djm/sdl_win32_demo/

which works for me quite well. However it is using plain windows API not MFC or Qt. But I think it should be possible to translate them to the Qt code. I’m also interested in the Qt + SDL combination because I develop using both these tools. Till now I have not had time to focus on embedding SDL window in the Qt widget but I would be very happy to hear that you have succeded. If yes it would be very kind of you to place a little demo app in the demos section of the SDL web page. From my side I’m very willing to assist in solving problems that may arise.

Jacek Dylak

Hi,

I saw this, but am unable to get it to work for its Qt equivalent :(.
Has anyone been able to do this?

Owen