Sun, 13 Apr 2008 04:50:17 +0000Date: Sat, 5 Apr 2008 19:54:28 -0700 SDL-1.2
Sam Lantinga [Sun, 13 Apr 2008 04:50:17 +0000] rev 4145
Date: Sat, 5 Apr 2008 19:54:28 -0700
From: "Chris Peterson"
Subject: [SDL] [PATCH] SDLMain.m: fix a bug and some warnings for Mac OS X

Here are some small fixes for the src/main/macosx/SDLMain.m source
file used by Mac OS X apps:

1. setupWorkingDirectory() called chdir() within an assert(), which
gets compiled out in non-debug builds.

2. When some of gcc's optional warnings are enabled, it complains
about some implicit casts and the use of #import in SDLMain.m.

Mon, 31 Mar 2008 05:27:21 +0000Fix X11 build issue with multiple includes of Xlibint.h ... SDL-1.2
Ryan C. Gordon [Mon, 31 Mar 2008 05:27:21 +0000] rev 4144
Fix X11 build issue with multiple includes of Xlibint.h ...

Wed, 12 Mar 2008 22:01:48 +0000Don't recreate the GL content in windib target if SDL_SetVideoMode() is being SDL-1.2
Ryan C. Gordon [Wed, 12 Mar 2008 22:01:48 +0000] rev 4143
Don't recreate the GL content in windib target if SDL_SetVideoMode() is being
called in response to a window resize event...prevents loss of GL state and

Fri, 29 Feb 2008 14:01:45 +0000We probably want to still do this for fullscreen surfaces, since we may be SDL-1.2
Sam Lantinga [Fri, 29 Feb 2008 14:01:45 +0000] rev 4142
We probably want to still do this for fullscreen surfaces, since we may be
clearing the edges of a centered video mode or garbage left over from a mode

Fri, 29 Feb 2008 13:58:37 +0000Added patch note for Sylvain's patch SDL-1.2
Sam Lantinga [Fri, 29 Feb 2008 13:58:37 +0000] rev 4141
Added patch note for Sylvain's patch

Fri, 29 Feb 2008 13:57:49 +0000Date: Thu, 28 Feb 2008 22:54:29 +0100 SDL-1.2
Sam Lantinga [Fri, 29 Feb 2008 13:57:49 +0000] rev 4140
Date: Thu, 28 Feb 2008 22:54:29 +0100
From: Sylvain Beucler
Subject: [SDL] SDL window resize and flicker

I have a resizable SDL window, and when it's resized, the surface goes
black _and_ is flushed to screen before I have a chance to redraw
it. This causes flicker.

The super-small attached patch fixes this issue by avoiding a
SDL_Flip() right after the window resize. What do you think?

This SDL_ClearSurface function is only called once in the code, in
SDL_SetVideoMode, and as far as I can tell the patch doesn't introduce
other changes than getting rid of the flicker.

Fri, 29 Feb 2008 13:55:44 +0000* Added configure option --enable-screensaver, to allow enabling the screensaver by default. SDL-1.2
Sam Lantinga [Fri, 29 Feb 2008 13:55:44 +0000] rev 4139
* Added configure option --enable-screensaver, to allow enabling the screensaver by default.
* Use XResetScreenSaver() instead of disabling screensaver entirely.

Full discussion summary from Erik on the SDL mailing list:

Current behaviour

SDL changes the user's display power management settings without
permission from the user and without telling the user.

The interface that it uses to do so is DPMSDisable/DPMSEnable, which
should only ever be used by configuration utilities like KControl, never
by normal application programs, let alone by the libraries that they
use. Using an interface that is not at all intended for what SDL tries
to achieve means that it will not work as it should. Firstly, the power
management is completely disabled during the whole lifetime of the SDL
program, not only when it should be. Secondly, it makes SDL
non-reentrant, meaning that things will break when multiple SDL programs
are clients of the same X server simultaneously. Thirdly, no cleanup
mechanism ensures that the setting is restored if the client does not do
that (for example if it crashes).

In addition to that, this interface is broken on xorg,
[], so what SDL tries
to do does not work at all on that implementation of the X Window
System. (The reason that the DPMSEnable works in KControl is that it
calls DPMSSetTimeout immediately after,

The problems that the current behaviour causes
1. Information leak. When the user is away, someone might see what the
user has on the display when the user counts on the screensaver
preventing this. This does not even require physical access to the
workstation, it is enough to see it from a distance.
2. Draining battery. An SDL program that runs on a laptop will quickly
drain the battery while the user is away. The system will soon shut down
and require recharging before being usable again, while it should in
fact have consumed very little energy if the user's settings would have
been obeyed.
3. Wasting energy. Even if battery issues are not considered, energy as
such is wasted.
4. Display wear. The display may be worn out.

The problems that the current behaviour tries to solve

1. Preventing screensaver while playing movies.
Many SDL applications are media players. They have reasons to prevent
screensavers from being activated while a movie is being played. When a
user clicks on the play button it can be interpreted as saying "play
this movie, but do not turn off the display while playing it, because I
will watch it even though I do not interact with the system".

2. Preventing screensaver when some input bypasses X.
Sometimes SDL uses input from another source than the X server, so
that the X server is bypassed. This obviously breaks the screensaver
handling. SDL tries to work around that.

3. Preventing screensaver when all input bypasses X.
There is something called Direct Graphics Access mode, where a
program takes control of both the display and the input devices from the
X server. This obviously means that the X server can not handle the
screensaver alone, since screensaver handling depends on input handling.
SDL does not do what it should to help the X server to handle the
screensaver. Nor does SDL take care of screeensaver handling itself. SDL
simply disables the screensaver completely.

How the problems should be solved

The correct way for an application program to prevent the screensaver
under X is to call XResetScreenSaver. This was recently discovered and
implemented by the mplayer developers,
[]. SDL needs to
wrap this in an API call (SDL_ResetScreenSaver) and implement it for the
other video targets (if they do not have a corresponding call, SDL
should do what it takes on that particular target, for example sending
fake key events).

1. When a movie is played, the player should reset the screensaver when
the animation is advanced to a new frame. The same applies to anything
similar, like slideshows.

2. When the X server is handling input, it must handle all input
(keyboards, mice, gamepads, ...). This is necessary, not only to be able
to handle the screensaver, but also so that it can send the events to
the correct (the currently active) client. If there is an input device
that the X server can not handle for some reason (such as lack of Plug
and Play capability), the program that handles the device as a
workaround must simulate what would happen if the X server would have
handled the device, by calling XResetScreenSaver when input is received
from the device.

3. When the X server is not handling the input, it depends on the
program that does to call XResetScreenSaver whenever an input event
occurs. Alternatively the program must handle the screensaver countdown
internally and call XActivateScreenSaver.

Tue, 26 Feb 2008 10:50:28 +0000Date: Tue, 05 Feb 2008 01:41:08 -0500 SDL-1.2
Sam Lantinga [Tue, 26 Feb 2008 10:50:28 +0000] rev 4138
Date: Tue, 05 Feb 2008 01:41:08 -0500
From: Mike Miscevic
Subject: SDL and capslock/numlock

Find attached a patch against SDL-1.2.13 for check of SDL_NO_LOCK_KEYS
environment variable. This differs slightly from other patches I've seen
in that it has 3 modes:

Disable CAPS-LOCK and NUM-LOCK supression of down+up key events,
suitable for games where the player needs these keys to do more than
just toggle. A value of 1 will effect both CAPS-LOCK and NUM-LOCK. A
value of 2 will effect only CAPS-LOCK. A value of 3 will effect only
NUM-LOCK. All other values have no effect.

This works for me and has been tested on:
- Fedora 8 64-bit
- SRCRPM SDL-1.2.13-1.fc8.src.rpm
- Emeny Territory Quake Wars (ETQW), native 32-bit commercial game

--Mike Miscevic

Mon, 04 Feb 2008 17:22:56 +0000Date: Sat, 2 Feb 2008 22:08:05 +0100 SDL-1.2
Ryan C. Gordon [Mon, 04 Feb 2008 17:22:56 +0000] rev 4137
Date: Sat, 2 Feb 2008 22:08:05 +0100
From: Marcus von Appen
Subject: [SDL] [Patch] SDL-1.2 SDL_revcpy() asm patch for the cld flag


as reported through the FreeBSD bug tracking system in SDL 1.2.13 (and
in the 1.2 branch, if I see that correctly) the SDL_revcpy() macro sets
the direction flag (std), but does not clear it afterwards (cld), which
is wrong according to the GCC and SYS V specs. This can cause some
weird side effects, which in turn can lead to memory corruption.

You can read the full report with a detailed description and test
program at

Attached is the submitted patch, which fixes the issue.


Fri, 25 Jan 2008 05:48:08 +0000Fixed crash in SDL_SetGammaRamp() SDL-1.2
Sam Lantinga [Fri, 25 Jan 2008 05:48:08 +0000] rev 4136
Fixed crash in SDL_SetGammaRamp()