[SDL] Window/surface dimensions mismatch problem

Bob Pendleton bob at pendleton.com
Tue Jan 14 05:41:01 PST 2003


On Mon, 2003-01-13 at 16:38, Daniel Phillips wrote:
> As a preliminary step in tracking down the X window/OpenGL window size mismatch, I 
> modified X11_GL_CreateWindow to read as follows:
> 
> int X11_GL_CreateWindow(_THIS, int w, int h)
> {
> 	int retval;
> #ifdef HAVE_OPENGL
> 	XSetWindowAttributes attributes;
> 	unsigned long mask;
> 	unsigned long black;
> 
> 	black = (glx_visualinfo->visual == DefaultVisual(SDL_Display,
> 						 	SDL_Screen))
> 	       	? BlackPixel(SDL_Display, SDL_Screen) : 0;
> 	attributes.background_pixel = black;
> 	attributes.border_pixel = black;
> 	attributes.colormap = SDL_XColorMap;
> 	mask = CWBackPixel | CWBorderPixel | CWColormap;
> 
> 	SDL_Window = XCreateWindow(SDL_Display, WMwindow,
> 			0, 0, w, h, 0, glx_visualinfo->depth,
> 			InputOutput, glx_visualinfo->visual,
> 			mask, &attributes);
> 	if ( !SDL_Window ) {
> 		SDL_SetError("Could not create window");
> 		return -1;
> 	}
> 	{
> 		XWindowAttributes attributes;
> 		XGetWindowAttributes(SDL_Display, SDL_Window, &attributes);
> 		printf("Requested size: (%i, %i); got (%i, %i)\n", w, h, attributes.width, attributes.height);
> 	}
> 	retval = 0;
> #else
> 	SDL_SetError("X11 driver not configured with OpenGL");
> 	retval = -1;
> #endif
> 	return(retval);
> }
> 
> I run this under KDE, having selected "Store Settings" on the KDE window on a
> previous run, and supply w=640, h=480 to SDL_SetVideoMode. To my surprise and
> displeasure, even when the created/displayed window is not in fact the requested
> size, I always see:
> 
>    Requested size: (640, 480); got (640, 480)
> 
> In other words, X is telling SDL that the window is 640 x 480, even though it is
> displaying some other size.  I say "displeasure", because if I'd been able to detect
> the mismatch at this point I'd be well on my way to producing a patch by now.  As
> it stands, I have to admit that the mechanism involved is more convoluted than I
> thought.  It probably requires exploring the KDE and/or QT source, which would be
> more of a time commitment that I was expecting.  Bob, perhaps you can shed some
> light on this?

I know I replied privately, but for the rest of you, what can I say, I
haven't been following this thread. And, I've either never run into, or
never noticed this problem. Could be because I use GNOME, but I doubt
it.

Could you explain how you know the displayed size is wrong?

		Bob Pendleton

> 
> The first time I get an SDL window resize event and act on it, everything snaps
> properly into place.  But this isn't a good situation, it means resizable SDL
> windows are broken on KDE, so this needs to be tracked down.
> 
> On the positive size, it turns out that my SDL+OpenGL application runs perfectly
> with no window manager at all, which is an interesting fact that suggests a fun
> project, namely an SDL+OpenGL-based hardware-accelerated desktop.
> 
> Regards,
> 
> Daniel
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
-- 
+------------------------------------+
+ Bob Pendleton, consultant for hire +
+ Resume: http://www.jump.net/~bobp  +
+ Email:  bob at pendleton.com          +
+------------------------------------+





More information about the SDL mailing list