Well, I’m actually looking for a cross platform and window manager
independent method of programatically controlling the window position.
If I’ve got to code separate Win32 API calls for windows and Xwindows
calls for Linux then so be it, but I certainly don’t want to have to
code for every window manager as well. KDE is one thing, but Gnome can
use loads of different window managers if I remember correctly.
Has anyone else done this?
has anyone got any code?
I work in Pascal, but I’m fluent enough in C to convert it.
From the Stella source code (originally from some example on the SDL
page):
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.
SteveOn August 12, 2002 09:12 pm, Jason Farmer wrote: