Sdl_windowid

I’m trying to compile the /sdl_win32_demo/ with VC7. That demo shows how
to use SDL with my own window. I get no error, no warnings, nothing. And
the code just don’t work. I ran the code step by step to make sure the
enviroment var is being set, and thats fine. Apparently, SDL is just
ignoring it. I searched

Anyone has a clue?

Regards, Henrique Bastos

Henrique Bastos wrote:

I’m trying to compile the /sdl_win32_demo/ with VC7. That demo shows
how to use SDL with my own window. I get no error, no warnings,
nothing. And the code just don’t work. I ran the code

step by step to make sure the enviroment var is being set, and thats
fine. Apparently, SDL is just ignoring it. I searched

I have the same problem and still have no answer.
Also nobody cares to answer me in this list.
Maybe nobody know?

PS. Only difference is that I have linux.

Sincerely,

Denis Frolov

Henrique Bastos wrote:

I’m trying to compile the /sdl_win32_demo/ with VC7. That demo shows
how to use SDL with my own window. I get no error, no warnings,
nothing. And the code just don’t work. I ran the code

step by step to make sure the enviroment var is being set, and thats
fine. Apparently, SDL is just ignoring it. I searched

Saying that is don’t work is like going to a mechanic and telling them your
car don’t work, with no other details and expecting them to know what the
problem is.

You say you ran it step by step, okay at what part did it not work?

hhmmm I think I need more coffee as my mind reading powers seem to be offline
at the moment. :POn May 27, 2004 08:54 am, Denis Frolov wrote:

I have the same problem and still have no answer.
Also nobody cares to answer me in this list.
Maybe nobody know?

PS. Only difference is that I have linux.

Sincerely,

Denis Frolov


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

Hi again,

Doesn’t anybody know the answer?
I ask you: please help or say if it is not possible to implement.
I can provide additional details if needed.

Hope for your understanding,

Denis Frolov

Jr. Software Developer
SOT Finnish Software Engineering OU----------------------------------------
Denis Frolov wrote:

Hello,

I have looked through almost all the site libsdl.org and at the
documentation project, but still have the question unresolved.
I am writing a new screensaver for xscreensaver and xscreensaver
passes 2 parameters for my proggy:
Window win and Display *dpy
I am setting SDL_WINDOWID environment variable with the value of
window variable, but after initializing SDL,
it creates another window and works with it, rather than with window
which was passed as an environment variable.

My code is looking about this way:
—cut—
//…
XOpenDisplay(…);
//…
screenhack(display, window);
///…

screenhack(Display *dpy, Window win)
{
//…
char SDL_vidvar[256];
snprintf(SDL_vidvar, 256, “SDL_WINDOWID=%ld”, win);
putenv(SDL_vidvar);
flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
if (SDL_Init(flags))
{
fprintf(stderr, “Could not init SDL\n”);
exit(1);
}
//…
screen = SDL_SetVideoMode(width, height, 0, other_flags);
// … more code showing video stream …
}
—cut—

So SDL_Init does not fail and SDL_SetVideoMode does not fail.
But my video stream does not appear in win window but in newly created
one.

What could be wrong with setting SDL_WINDOWID?

which video-driver gets selected?

Denis Frolov wrote:> Hi again,

Doesn’t anybody know the answer?
I ask you: please help or say if it is not possible to implement.
I can provide additional details if needed.

Hope for your understanding,

Denis Frolov

Jr. Software Developer
SOT Finnish Software Engineering OU


Denis Frolov wrote:

Hello,

I have looked through almost all the site libsdl.org and at the
documentation project, but still have the question unresolved.
I am writing a new screensaver for xscreensaver and xscreensaver
passes 2 parameters for my proggy:
Window win and Display *dpy
I am setting SDL_WINDOWID environment variable with the value of
window variable, but after initializing SDL,
it creates another window and works with it, rather than with window
which was passed as an environment variable.

My code is looking about this way:
—cut—
//…
XOpenDisplay(…);
//…
screenhack(display, window);
///…

screenhack(Display *dpy, Window win)
{
//…
char SDL_vidvar[256];
snprintf(SDL_vidvar, 256, “SDL_WINDOWID=%ld”, win);
putenv(SDL_vidvar);
flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
if (SDL_Init(flags))
{
fprintf(stderr, “Could not init SDL\n”);
exit(1);
}
//…
screen = SDL_SetVideoMode(width, height, 0, other_flags);
// … more code showing video stream …
}
—cut—

So SDL_Init does not fail and SDL_SetVideoMode does not fail.
But my video stream does not appear in win window but in newly created
one.

What could be wrong with setting SDL_WINDOWID?

SDL_VideoDriverName returns “x11” string.

Guido Draheim wrote:

which video-driver gets selected?

Denis Frolov wrote:

Hi again,

Doesn’t anybody know the answer?
I ask you: please help or say if it is not possible to implement.
I can provide additional details if needed.

Hope for your understanding,

Denis Frolov

Jr. Software Developer
SOT Finnish Software Engineering OU


Denis Frolov wrote:

Hello,

I have looked through almost all the site libsdl.org and at the
documentation project, but still have the question unresolved.
I am writing a new screensaver for xscreensaver and xscreensaver
passes 2 parameters for my proggy:
Window win and Display *dpy
I am setting SDL_WINDOWID environment variable with the value of
window variable, but after initializing SDL,
it creates another window and works with it, rather than with window
which was passed as an environment variable.

My code is looking about this way:
—cut—
//…
XOpenDisplay(…);
//…
screenhack(display, window);
///…

screenhack(Display *dpy, Window win)
{
//…
char SDL_vidvar[256];
snprintf(SDL_vidvar, 256, “SDL_WINDOWID=%ld”, win);
putenv(SDL_vidvar);
flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
if (SDL_Init(flags))
{
fprintf(stderr, “Could not init SDL\n”);
exit(1);
}
//…
screen = SDL_SetVideoMode(width, height, 0, other_flags);
// … more code showing video stream …
}
—cut—

So SDL_Init does not fail and SDL_SetVideoMode does not fail.
But my video stream does not appear in win window but in newly
created one.

What could be wrong with setting SDL_WINDOWID?

—cut—

Just a test, please try to use SDL_getenv and SDL_putenv instead.

“Denis Frolov” <denis.frolov at sot.com> ???> SDL_VideoDriverName returns “x11” string.

Guido Draheim wrote:

which video-driver gets selected?
Denis Frolov wrote:

Hi again,
Doesn’t anybody know the answer?
I ask you: please help or say if it is not possible to implement.
I can provide additional details if needed.
Hope for your understanding,
Denis Frolov
Jr. Software Developer
SOT Finnish Software Engineering OU

Denis Frolov wrote:

I have looked through almost all the site libsdl.org and at the
documentation project, but still have the question unresolved.
I am writing a new screensaver for xscreensaver and xscreensaver
passes 2 parameters for my proggy:
Window win and Display *dpy
I am setting SDL_WINDOWID environment variable with the value of
window variable, but after initializing SDL,
it creates another window and works with it, rather than with window
which was passed as an environment variable.

Hi,

Linker claims, that both of them are undefined references, so I continue
using putenv.

RocWood wrote:>Just a test, please try to use SDL_getenv and SDL_putenv instead.

“Denis Frolov” <@Denis_Frolov> ???

SDL_VideoDriverName returns “x11” string.

Guido Draheim wrote:

which video-driver gets selected?
Denis Frolov wrote:

Hi again,
Doesn’t anybody know the answer?
I ask you: please help or say if it is not possible to implement.
I can provide additional details if needed.
Hope for your understanding,
Denis Frolov
Jr. Software Developer
SOT Finnish Software Engineering OU

Denis Frolov wrote:

I have looked through almost all the site libsdl.org and at the
documentation project, but still have the question unresolved.
I am writing a new screensaver for xscreensaver and xscreensaver
passes 2 parameters for my proggy:
Window win and Display *dpy
I am setting SDL_WINDOWID environment variable with the value of
window variable, but after initializing SDL,
it creates another window and works with it, rather than with window
which was passed as an environment variable.


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

So SDL_Init does not fail and SDL_SetVideoMode does not fail.
But my video stream does not appear in win window but in newly created one.

What could be wrong with setting SDL_WINDOWID?

I just happened upon your message on an SDL mailing list archive. If you haven’t
solve the issue in the year since you posted it, here is what I do in my own
SDL xscreensaver module:

/* Lets get the root window ID!
NEED to include ‘vroot.h’ for this to work */
char SDL_windowhack[32];

xdisplay = XOpenDisplay("");
sprintf(SDL_windowhack,“SDL_WINDOWID=%d”, DefaultRootWindow(xdisplay));
/* Tell SDL to use (virtual) root window */
putenv(SDL_windowhack);

/* Figure out how big we are */
full_rect.w = DisplayWidth(xdisplay, DefaultScreen(xdisplay));
full_rect.h = DisplayHeight(xdisplay, DefaultScreen(xdisplay));

If you want to see the rest of my GPL’d screensaver for some more solutions
to dealing with the stuff you need to deal with for an xscreensaver module,
you can download “They’r Coming to Get You Barbara” at:

http://www.psnw.com/~smokeserpent/code/--
@Benjamin_Moos

Dear all,

I read a lot about the SDL_WINDOWID hack, but I did not get it to
work yet. My setup is SDL 1.2 (taken from the SDL homepage), Windows
XP Pro SP2, Visual C++ 7.1. Does someone have some working code
which uses SDL to render into a separate window? I tried with the
standard Win32 application VS generates, and a wxWidgets window,
and failed with both. Is this SDL_WINDOWID stuff working at all? The
interesting thing is that there’s some code available for download
at http://www.maccormack.net/~djm/sdl_win32_demo/ , but it’s rather
old, so I guess this got messed up in the recent version?

Kind regards,
Matt

Dear all,

I was just messing things up myself by using different CRTs. Had no
idea that they don’t share the same environment.

Sorry for bothering you,
Matt

Matthias Gall wrote on Friday, 20th May 2005 at 11:40 pm:

MG> Dear all,

MG> I read a lot about the SDL_WINDOWID hack, but I did not get it to
MG> work yet. My setup is SDL 1.2 (taken from the SDL homepage), Windows
MG> XP Pro SP2, Visual C++ 7.1. Does someone have some working code
MG> which uses SDL to render into a separate window? I tried with the
MG> standard Win32 application VS generates, and a wxWidgets window,
MG> and failed with both. Is this SDL_WINDOWID stuff working at all? The
MG> interesting thing is that there’s some code available for download
MG> at http://www.maccormack.net/~djm/sdl_win32_demo/ , but it’s rather
MG> old, so I guess this got messed up in the recent version?

MG> Kind regards,
MG> Matt