Discussion:
SDL fullscreen problems in dwm
Thomas Spurden
2010-05-07 07:27:14 UTC
Permalink
I have recently being playing a few games that use SDL to get a
full-screen window. This causes some problems with dwm. These have
been discussed before on the list, but have always assumed is was simply
a problem with SDL assuming a reparenting WM. I came across a post on
the awesome mailing list which pointed me to a bug[1] in their issue
tracker; basically at least part of the problem is the fact that awesome
"restarts" when the screen resolution is changed. This seems to be the
behavior I am seeing in dwm.

I had some success running World of Goo (which sets the resolution to
800x600 by default) in monocle mode, however any other stacking mode
required a switch to a VT and killing the game (black window covering
most of the screen, mouse & keyboard input grabbed). If I set the game
resolution to my current resolution (1920x1200) the game starts and
plays fine in any stacking mode.

As I see it the problem is this: dwm receives a ConfigureNotify on the
root window with a new size (new screen resolution), this then calls
updategeom, which causes some problem with the game. I'm not familiar
enough with X11 programming to tell exactly what the problem is, but it
seems that this is the root of it to me.

Does this seem a reasonable explanation? If so is there anything that
can be changed in dwm to support full-screen SDL applications at
non-current resolutions?

[1] http://awesome.naquadah.org/bugs/index.php?do=details&task_id=717
--
Thomas Spurden
Jacob Todd
2010-05-07 23:22:11 UTC
Permalink
This is a known problem, see the BUGS file.
h***@hessiess.com
2010-05-14 16:18:58 UTC
Permalink
Its because SDL is resolution dependent(non resizeable). I wrote the
Quad-Ren graphics engine, a resolution independent graphics engine to
solve this problem. It was designed specifically to work with tiling WM's.
Szabolcs Nagy
2010-05-14 15:36:38 UTC
Permalink
Post by h***@hessiess.com
Its because SDL is resolution dependent(non resizeable).
what do you mean by non resizeable?
h***@hessiess.com
2010-05-14 16:40:59 UTC
Permalink
Post by Szabolcs Nagy
Post by h***@hessiess.com
Its because SDL is resolution dependent(non resizeable).
what do you mean by non resizeable?
Literally non resizeable, the window cannot be resized.
Mate Nagy
2010-05-14 15:43:04 UTC
Permalink
Post by h***@hessiess.com
Literally non resizeable, the window cannot be resized.
hm, I can open SDL windows that are resizable easily enough,
with... "SDL_RESIZABLE"

Mate
h***@hessiess.com
2010-05-14 16:50:53 UTC
Permalink
Post by Mate Nagy
Post by h***@hessiess.com
Literally non resizeable, the window cannot be resized.
hm, I can open SDL windows that are resizable easily enough,
with... "SDL_RESIZABLE"
Mate
Sure, but *NO ONE* uses that flag. Go download almost any game made with
SDL, its not resizeable.
Anders Andersson
2010-05-14 16:25:15 UTC
Permalink
Post by h***@hessiess.com
Post by h***@hessiess.com
Literally non resizeable, the window cannot be resized.
 hm, I can open SDL windows that are resizable easily enough,
 with... "SDL_RESIZABLE"
Sure, but *NO ONE* uses that flag. Go download almost any game made with
SDL, its not resizeable.
Doesn't that mean that the games are very badly designed? Or do all
those games have specially tailored graphics for each single physical
display size?
pancake
2010-05-14 17:15:40 UTC
Permalink
Many of them are using fixed resolution pixmaps, not vectors, so, to
avoid scaling or incorrect display they prefer to drop this
possibility (ugly btw)
Post by Anders Andersson
Post by h***@hessiess.com
Post by Mate Nagy
Post by h***@hessiess.com
Literally non resizeable, the window cannot be resized.
hm, I can open SDL windows that are resizable easily enough,
with... "SDL_RESIZABLE"
Sure, but *NO ONE* uses that flag. Go download almost any game made with
SDL, its not resizeable.
Doesn't that mean that the games are very badly designed? Or do all
those games have specially tailored graphics for each single physical
display size?
Anders Andersson
2010-05-14 17:28:03 UTC
Permalink
Many of them are using fixed resolution pixmaps, not vectors, so, to avoid
scaling or incorrect display they prefer to drop this possibility (ugly btw)
Yeah, but they could still implement a scrolling view or similar.
Making a game for a fixed resolution was ok on the Amiga, possibly as
far as VGA. Off-topic anyway.
pancake
2010-05-14 17:02:08 UTC
Permalink
On Fri, 14 May 2010 16:50:53 -0000
Post by h***@hessiess.com
Post by Mate Nagy
Post by h***@hessiess.com
Literally non resizeable, the window cannot be resized.
hm, I can open SDL windows that are resizable easily enough,
with... "SDL_RESIZABLE"
Mate
Sure, but *NO ONE* uses that flag. Go download almost any game made with
SDL, its not resizeable.
[***@dazo tmp]$ cat sdldwm.c
/*
* Copyright (C) 2010
* pancake <youterm.com>
*
* $ gcc sdldwm.c -shared -ldl -fPIC -o sdldwm.so
* $ LD_PRELOAD=./sdldwm.so programname
*/
#define _GNU_SOURCE
#include <dlfcn.h>

static void *(*svm)(int w, int h, int b, unsigned int f);
static void __() __attribute__ ((constructor));
static void __() { svm = dlsym(RTLD_NEXT, "SDL_SetVideoMode"); }

void *SDL_SetVideoMode(int w, int h, int b, unsigned int f) {
return svm(w,h,b,f|0x10);
}

what about this hack?
Thomas Spurden
2010-05-14 18:10:52 UTC
Permalink
Post by pancake
/*
* Copyright (C) 2010
* pancake <youterm.com>
*
* $ gcc sdldwm.c -shared -ldl -fPIC -o sdldwm.so
* $ LD_PRELOAD=./sdldwm.so programname
*/
#define _GNU_SOURCE
#include <dlfcn.h>
static void *(*svm)(int w, int h, int b, unsigned int f);
static void __() __attribute__ ((constructor));
static void __() { svm = dlsym(RTLD_NEXT, "SDL_SetVideoMode"); }
void *SDL_SetVideoMode(int w, int h, int b, unsigned int f) {
return svm(w,h,b,f|0x10);
}
what about this hack?
I think you will find that this would just stop the app working; when
the SDL_RESIZABLE flag is set the app has to react to SDL_VIDEORESIZE
events from SDL by re-calling SDL_SetVideoMode with the size in the
SDL_VIDEORESIZE event. If the app isn't set up to do this then things
will go wrong...
--
Thomas Spurden
pancake
2010-05-14 19:01:25 UTC
Permalink
Well .. It is possible to hackaround the event handler to manage this
event. But surely will depend on app.. So.. Crappy
Post by Thomas Spurden
Post by pancake
/*
* Copyright (C) 2010
* pancake <youterm.com>
*
* $ gcc sdldwm.c -shared -ldl -fPIC -o sdldwm.so
* $ LD_PRELOAD=./sdldwm.so programname
*/
#define _GNU_SOURCE
#include <dlfcn.h>
static void *(*svm)(int w, int h, int b, unsigned int f);
static void __() __attribute__ ((constructor));
static void __() { svm = dlsym(RTLD_NEXT, "SDL_SetVideoMode"); }
void *SDL_SetVideoMode(int w, int h, int b, unsigned int f) {
return svm(w,h,b,f|0x10);
}
what about this hack?
I think you will find that this would just stop the app working; when
the SDL_RESIZABLE flag is set the app has to react to SDL_VIDEORESIZE
events from SDL by re-calling SDL_SetVideoMode with the size in the
SDL_VIDEORESIZE event. If the app isn't set up to do this then things
will go wrong...
--
Thomas Spurden
Loading...