[SDL] Re: How to move window with SDL

Rohit Singh rohit.singh at emuzed.com
Mon Jun 13 21:03:47 PDT 2005

I tried to do it on Linux with:

int x = 0, y = 0;

  SDL_SysWMinfo info;

  if (SDL_GetWMInfo(&info) > 0 ) {
    if (info.subsystem == SDL_SYSWM_X11) {
      XMoveWindow(info.info.x11.display, info.info.x11.window, x, y);

But it moved Widget within Windows instead of moving Windows.

I tried to get parent Windows, but was not able to find a suitable 
function to do that.

Rohit Singh.

Tankko Omaskio wrote:
> I tried this with no luck, but it was a quick test, so I might not
> have filled everything out correctly for the struct/flags.
> Tankko
> On 6/13/05, Donny Viszneki <smirk at thebuicksix.com> wrote:
>>On Jun 13, 2005, at 12:55 PM, Tankko Omaskio wrote:
>>>I can only speak from Windows experience, but there is no easy way to
>>>move or position the window from within your code.
>>Tankko is not correct (I think.) It should be very easy to do on
>>windows. Observe:
>>#ifdef WIN32
>>/* Declare our "system window manager info" structure for retrieving
>>window manger system information, and a window handle */
>>HWND hwnd;
>>SDL_SysWMInfo info;
>>/* The info structure requires us to tell the runtime environment what
>>version of SDL we're compiling with before we can SDL_GetWMInfo, so we
>>use a preprocessor macro, which will fill out info.version with
>>constants defined at build-time. I assume this is because the info
>>structure changes from version to version (can anyone back me up on
>>this?) */
>>if (SDL_GetWMInfo(&info))
>>     hwnd = info->window;
>>     SetWindowPos(hwnd, x, y, width, height, FLAGS);
>>Rohit, you may have to set some FLAGS. For more information on those,
>>read the MSDN documentation for this function:
>>There is a possibility that this function isn't known to work, and that
>>Tankko is way ahead of me. I haven't personally done this, but I've had
>>extensive experience with Windows API programming, and I just dredged
>>up the rest by taking a brief look at the SDL source code.
>>Let me know if it works Rohit.

More information about the SDL mailing list