No subject


Wed Jan 24 21:54:03 PST 2007


  SDL_SysWMinfo info;

  SDL_VERSION(&info.version);
  if(SDL_GetWMInfo(&info) > 0)
    if(info.subsystem == SDL_SYSWM_X11)
      x11Available = true;

  int x, y, w, h;
  info.info.x11.lock_func();
  theX11Display = info.info.x11.display;
  theX11Window  = info.info.x11.wmwindow;
  theX11Screen  = DefaultScreen(theX11Display);

  w = DisplayWidth(theX11Display, theX11Screen);
  h = DisplayHeight(theX11Display, theX11Screen);
  x = (w - screen->w)/2;
  y = (h - screen->h)/2;

  XMoveWindow(theX11Display, theX11Window, x, y);
  info.info.x11.unlock_func();


This code actually centers the window onscreen.  You can use it to place 
the window whereever you want.

Of course, this only works under X11 in Linux.  Don't know about other 
windowing systems.

Steve





More information about the SDL mailing list