[SDL] position of a window under xorg

Laurent Carlier lordheavy at infonie.fr
Tue Jun 13 15:57:01 PDT 2006


I try to get the window position with the following code :

--
	if (hSurface)
	{
		SDL_SysWMinfo info;
		Window window, dummy;
		int x, y;
		XWindowAttributes attributes;
		Display *display;

		SDL_VERSION(&info.version);

		if (!SDL_GetWMInfo(&info))
			return (hY);

		info.info.x11.lock_func();
		display = info.info.x11.display;
		window = info.info.x11.window;
		XSync(display, false);
		XGetWindowAttributes(display, window, &attributes);
		XTranslateCoordinates (display, window, attributes.root, 0, 0, &x, &y, 
&dummy);
		info.info.x11.unlock_func();
		hY = y;
	}
--

But the returned coordinates are x = 4 and y = 22 when the window is located 
at 0,0. How can i take care about wm decorators ? Am i doing something 
wrong ?

Regards,

-- 
jabber : lordheavy at jabber.fr
mail : lordheavymREMOVEME at gmail.com




More information about the SDL mailing list