[SDL] window id hack...

Dominique Louis Dominique at SavageSoftware.com.au
Fri Aug 10 02:31:02 PDT 2001


Hi David,
   Sam has sent me the Latest CVS compilation of SDL.dll which is 
supposed to include the changes you have suggested and I am still having 
problems with this window id hack.. here is the Pascal code I am using...

   {$IFDEF WIN32}
     EnvVal := inttostr(Panel1.Handle);
     SetEnvironmentVariable('SDL_WINDOWID', PChar( EnvVal ) );
   {$ENDIF}
   if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) then
   begin
     exit;
   end
   else
   begin
     // Set the window manager title bar
     SDL_WM_SetCaption('JEDI-SDL Test Window', nil);
     screen_ := SDL_SetVideoMode( seWidth.Value, seHeight.Value,
                eBPP.Value, video_flags );
     if ( screen_ = nil ) then
     begin
       exit;
     end;
   end;

It seems fairly straight forward to me. Can you or anyone see what maybe 
causing the problem? Am I supposed to include a call SDL_RegisterApp or 
is that taken care of?

The reason why I being so tenacious about this window id hack is that a 
fellow Delphi developer is thinking of using SDL and my Pascal bindings 
to port his OpenGL project, GLScene ( http://glscene.org ) over to Linux 
and using the same code base for both Windows and Linux development. I 
think GLScene would be a great application to have under Linux, hence 
the reason why I am helping with this aspect.

Thanks for your patience.


Dominique

David MacCormack wrote:

>> I stand corrected.  It seems that the selection of "Multithreaded DLL"
>> tells the application (and SDL) to link with msvcrt.lib -- so same effect,
>> different means.
>> 
>> Dave
>> 
>> 
> 
> 
> But the SDL_WINDOWID hack is still busted (at least on win32).
> SDL_RegisterApp is being called before the user's main(...).  And because
> SDL_RegisterApp is the one checking for SDL_WINDOWID, the user never has a
> chance to set it.
> 
> Of course I may be missing something, but I don't think it needs to be
> called from WinMain.  On win32, all SDL_RegisterApp does is register the
> window class and setup the trackmouse stuff, but
> (DIB|DX5)_CreateWindow(...) calls SDL_RegisterApp before it tries to
> create the window, so the same stuff is done later anyway.  So simply
> commenting out the call to SDL_RegisterApp in WinMain (plus the few other
> changes included in the patch) does the trick (as can be seen the the
> demo apps I sent).
> 
> Dave




More information about the SDL mailing list