Commit Graph

2118 Commits

Author SHA1 Message Date
Ryan C. Gordon
72335eba68 Deal with ELF underscores on Solaris with Sun Studio.
Fixes Bugzilla #595.

--HG--
branch : SDL-1.2
2008-09-14 21:45:04 +00:00
Ryan C. Gordon
bdabeb0777 Prevent crash from unaligned memory access on sparc64, etc.
Fixes Bugzilla #602. I suspect this will crash elsewhere if the system
 actually had modelines to report, though.

--HG--
branch : SDL-1.2
2008-09-08 07:33:05 +00:00
Patrice Mandin
df30ba72ab Check defines do not already exist in recent system headers
--HG--
branch : SDL-1.2
2008-08-07 20:55:45 +00:00
Patrice Mandin
a632fb1c4f Check defines do not already exist in recent system headers
--HG--
branch : SDL-1.2
2008-08-07 20:38:35 +00:00
Ryan C. Gordon
7e365d2e5e Tweaked fatbuild.sh so it works with install_name_tool.
--HG--
branch : SDL-1.2
2008-07-25 10:52:10 +00:00
Patrice Mandin
26c97cc49b Fix bug 545, by returning early whenever an error occurs when initializing joystick structure
--HG--
branch : SDL-1.2
2008-07-19 11:54:55 +00:00
Ryan C. Gordon
4a08c7dae7 Merged r3674:3675 from trunk: comment in README about svn RSS feed.
--HG--
branch : SDL-1.2
2008-07-05 18:27:27 +00:00
Sam Lantinga
3e05be829e Date: Sat, 5 Apr 2008 19:54:28 -0700
From: "Chris Peterson"
To: sdl@lists.libsdl.org
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.

--HG--
branch : SDL-1.2
2008-04-13 04:50:17 +00:00
Ryan C. Gordon
66b653c07f Fix X11 build issue with multiple includes of Xlibint.h ...
--HG--
branch : SDL-1.2
2008-03-31 05:27:21 +00:00
Ryan C. Gordon
928e7555c7 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
 objects.

--HG--
branch : SDL-1.2
2008-03-12 22:01:48 +00:00
Sam Lantinga
e1a1900167 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
switch.

--HG--
branch : SDL-1.2
2008-02-29 14:01:45 +00:00
Sam Lantinga
3f1d5190af Added patch note for Sylvain's patch
--HG--
branch : SDL-1.2
2008-02-29 13:58:37 +00:00
Sam Lantinga
091bf8dd74 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.

--HG--
branch : SDL-1.2
2008-02-29 13:57:49 +00:00
Sam Lantinga
ba9c21cfb1 * 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,
[http://bugs.freedesktop.org/show_bug.cgi?id=13962], 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,
[http://websvn.kde.org/tags/KDE/3.5.9/kdebase/kcontrol/energy/energy.cpp?annotate=774532#l343]).


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,
[http://svn.mplayerhq.hu/mplayer?view=rev&revision=25637]. 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.

--HG--
branch : SDL-1.2
2008-02-29 13:55:44 +00:00
Sam Lantinga
11cf68d29c 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

--HG--
branch : SDL-1.2
2008-02-26 10:50:28 +00:00
Ryan C. Gordon
6f0c9da0cd Date: Sat, 2 Feb 2008 22:08:05 +0100
From: Marcus von Appen
To: sdl@lists.libsdl.org
Subject: [SDL] [Patch] SDL-1.2 SDL_revcpy() asm patch for the cld flag

Hi,

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 http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/120052

Attached is the submitted patch, which fixes the issue.

Regards
Marcus

--HG--
branch : SDL-1.2
2008-02-04 17:22:56 +00:00
Sam Lantinga
08dd5ae5b2 Fixed crash in SDL_SetGammaRamp()
--HG--
branch : SDL-1.2
2008-01-25 05:48:08 +00:00
Sam Lantinga
5ee11a3d9b Damien Carbery fixed bug #542
In SDL 1.2.13 sdl.m4 the AM_PATH_SDL function looks for sdl-config.
It sets the PATH:
 PATH="$prefix/bin:$prefix/usr/bin:$PATH"
but does not save the current PATH or restore the current PATH at the end.

This breaks the build on Solaris because we have GNU tools in another dir
(listed at the top of PATH) but non-GNU tools with the same names in
$prefix/bin. Later configure tests finds the non-GNU tools and quits in error

--HG--
branch : SDL-1.2
2008-01-24 15:50:20 +00:00
Sam Lantinga
8bb48809ad Updates for building on Windows CE using mingw32ce cross compiler:
http://sourceforge.net/mailarchive/forum.php?thread_name 0703291652.38437.jwalt%40garni.ch&forum_name=cegcc-devel

Hi!

I just managed to compile SDL for Windows CE using the "mingw32ce"
configuration of http://cegcc.sourceforge.net. Test programs work as expected
(except for those using signals -- no POSIX on mingw32ce), and I didn't yet
encounter any problem.

While it was a pain to get everything compiled and running, the changes to
SDL are actually quite small (see attached SDL-ce.diff).

Unfortunately, the win32 headers shipped with cegcc are not 100% correct, and
it feels quite messy to work around them in SDL code, so those headers will
also need to be patched. (Attachment: win32api-ce.diff)

Since I had to apply the libtool patch from the cegcc patch, I have also ad ded
my copy of aclocal.m4 for SDL. I had to modify the cegcc libtool patch to
use "lt_cv_deplibs_check_method=pass_all" for mingw32ce, otherwise libtool
would not recognize the import libraries as valid for dynamic linking.

All these changes should not affect non-WinCE builds, so they could be
included in mainline SDL.

If you need some docs, you can use this description for a cross-compilation
README:

1) get cegcc from http://cegcc.sourceforge.net
2) build and install the "mingw32ce" variant (see cegcc installation docs)
3) patch w32api-headers (if not yet included in cegcc)
4) setup environment (customize the first three lines as you like):
PREFIX=/opt/mingw32ce
TARGET=arm-wince-mingw32ce
BUILD=`uname -m`-pc-linux-gnu
export PATH="$PREFIX/bin:$PREFIX/$TARGET/bin:$PREFIX/local/bin:$PATH"
export CFLAGS="${CFLAGS:- -O2 -g} -I$PREFIX/local/include"
export CPPFLAGS="${CPPFLAGS:- -O2 -g} -I$PREFIX/local/include"
export CXXFLAGS="${CXXFLAGS:- -O2 -g} -I$PREFIX/local/include"
export LDFLAGS="${LDFLAGS:- -O2 -g} -L$PREFIX/local/lib"
export HOST_CC="gcc"
export CC="$PREFIX/bin/$TARGET-gcc"
export CXX="$PREFIX/bin/$TARGET-g++"
export LD="$PREFIX/bin/$TARGET-ld"
export AS="$PREFIX/bin/$TARGET-as"
export AR="$PREFIX/bin/$TARGET-ar"
export RANLIB="$PREFIX/bin/$TARGET-ranlib"
export CONFIG_SHELL="/bin/sh"
5) build and install
./configure --target=$TARGET --host=$TARGET --build=$BUILD
make
make install
6) use (4) and (5) for any SDL-using software you want to cross-compile
7) copy $PREFIX/local/bin/SDL-1-2-0.dll into your executable directory on the WinCE machine

--HG--
branch : SDL-1.2
2008-01-03 06:19:07 +00:00
Sam Lantinga
809d293a66 Updated config scripts
--HG--
branch : SDL-1.2
2008-01-03 06:06:06 +00:00
Sam Lantinga
6b3f41d9c8 Fixed bug #531
The static libs should include all the other libraries the dynamic SDL library
links with.

sdl.pc should include these so "pkg-config sdl --libs --static" works

--HG--
branch : SDL-1.2
2008-01-01 15:23:59 +00:00
Sam Lantinga
17ace74124 Clean up the test directory for release
--HG--
branch : SDL-1.2
release-1.2.13
2007-12-31 06:18:12 +00:00
Sam Lantinga
7d3a78030e Fixed 1 out of 210 warnings. ;-)
--HG--
branch : SDL-1.2
2007-12-31 06:12:50 +00:00
Sam Lantinga
1d1dc75500 Don't need the bundle resource
--HG--
branch : SDL-1.2
2007-12-31 03:09:42 +00:00
Sam Lantinga
8ae7b66350 Updated MacOS Classic version, added version resource to MPW build.
--HG--
branch : SDL-1.2
2007-12-31 03:04:31 +00:00
Sam Lantinga
9db178f495 Updated gcc-fat.sh to build on Mac OS X 10.5
--HG--
branch : SDL-1.2
2007-12-31 00:03:33 +00:00
Sam Lantinga
d4c77d50c3 Added symbian.zip to released files
--HG--
branch : SDL-1.2
2007-12-30 21:50:41 +00:00
Sam Lantinga
c028d6f334 Don't use -fvisibility if it generates warnings ... like this one:
warning: visibility attribute not supported in this configuration; ignored

--HG--
branch : SDL-1.2
2007-12-30 05:00:20 +00:00
Sam Lantinga
4d7e9468cc Fixed bug #510
Oops, we were disabling the screensaver before checking SDL_VIDEO_ALLOW_SCREENSAVER

--HG--
branch : SDL-1.2
2007-12-29 21:41:48 +00:00
Sam Lantinga
fa61958343 Guillaume Borios fixed bug #508
When unicode translation is ON, pressing the escape key raise an NSBeep()
because the NSTextView interprets the key as a special command (in that case
impossible to interpret)... The NSTextView instance should replaced by
something subclassed so that doCommandBySelector: does nothing.

Example code :

@interface SDLTranslatorResponder : NSTextView
{
}
- (void) doCommandBySelector:(SEL)myselector;
@end

@implementation SDLTranslatorResponder
- (void) doCommandBySelector:(SEL) myselector {}
@end

--HG--
branch : SDL-1.2
2007-12-29 21:31:26 +00:00
Sam Lantinga
3c8d72035f Fixed return value for iconifying the window in a couple spots.
--HG--
branch : SDL-1.2
2007-12-29 20:28:21 +00:00
Sam Lantinga
2ea5504ad8 J. Snell fixed bug #482
Fixed arguments used with sdl-config in sdl.m4

--HG--
branch : SDL-1.2
2007-12-29 20:08:51 +00:00
Sam Lantinga
e1bb13d727 Fixed bug #478
Take the min and max values into account.

--HG--
branch : SDL-1.2
2007-12-29 19:44:02 +00:00
Sam Lantinga
138e23eaa6 Added patch note for fixing bug #503
--HG--
branch : SDL-1.2
2007-12-29 19:01:13 +00:00
Sam Lantinga
fc9f99f291 Tony White fixed bug #503
Support escaped quotes on Win32 command lines.

--HG--
branch : SDL-1.2
2007-12-29 18:58:09 +00:00
Sam Lantinga
d588e8c1c4 Fixed bug #502
XRefreshKeyboardMapping() is only available when X_HAVE_UTF8_STRING is defined.

--HG--
branch : SDL-1.2
2007-12-29 18:50:33 +00:00
Sam Lantinga
fc146970ff Support both 10.2 and 10.3 PPC runtime SDK
--HG--
branch : SDL-1.2
2007-12-29 17:13:21 +00:00
Sam Lantinga
62cdfa64d3 Updated patch notes for 1.2.13
--HG--
branch : SDL-1.2
2007-12-29 06:21:47 +00:00
Sam Lantinga
76f1001651 Fixed bug #497
Check all joysticks instead of stopping if one has been removed.

--HG--
branch : SDL-1.2
2007-12-29 06:16:35 +00:00
Sam Lantinga
09cd129590 Fixed bug #464
Added X1/X2 button constants

--HG--
branch : SDL-1.2
2007-12-29 06:08:17 +00:00
Sam Lantinga
7855ee7a06 Improved detection of mprotect()
--HG--
branch : SDL-1.2
2007-12-29 06:06:03 +00:00
Sam Lantinga
5fa4843899 Updated version to 1.2.13
--HG--
branch : SDL-1.2
2007-12-29 05:30:20 +00:00
Sam Lantinga
1b32f5a97d Updated version to 1.2.13
--HG--
branch : SDL-1.2
2007-12-29 05:20:51 +00:00
Sam Lantinga
87d97715ae Made the mprotect() fix for SDL_SoftStretch() more general for hardened linux, etc.
--HG--
branch : SDL-1.2
2007-12-29 05:18:33 +00:00
Sam Lantinga
8b29ed785f Fixed bug #528
OpenBSD (and possibly others) do not have executable memory by default,
so use mprotect() to allow execution of dynamic assembly block.

--HG--
branch : SDL-1.2
2007-12-29 03:50:29 +00:00
Sam Lantinga
26747330e7 Erik Heckers fixed bug #493
Searching the installed man pages for SDL functions fails, e.g.
  man -k SDL_ |grep Video
After investigating this I found that "makewhatis", the tool that generates
the "whatis" database, reads the SDL_* man pages, but doesn't produce
entries in the "whatis" database for the SDL_* man pages.
After some more debugging I found the reason is a missing space.
After editing SDL_Init.3(.gz) and replacing
   SDL_Init\- Initializes SDL
with
   SDL_Init \- Initializes SDL
everything works fine.
After running "makewhatis" I can successfully do a
   man -k SDL_
and SDL_Init is listed in the output.

--HG--
branch : SDL-1.2
2007-12-29 02:34:53 +00:00
Sam Lantinga
3432b32c7b Hans de Goede fixed bug #495
When running boswars: http://www.boswars.org/ on a machine with intel
integrathed graphics it crashes when it tries to play the initial theora
splashscreen video:
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  140 (XVideo)
  Minor opcode of failed request:  19 ()
  Serial number of failed request:  25
  Current serial number in output stream:  26
boswars: xcb_xlib.c:41: xcb_xlib_lock: Assertion `!c->xlib.lock' failed.
Aborted

I recognized this problem from a few years back, when I encountered it while
working on the Xv blitter for xmame. The problem is that for some reason
creation the Xvport and XvImage succeeds, and failure (lack of resources / hw
capability?) is only indicated during the first XvPut[Shm]Image. I've written a
patch for SDL using the work around for this I developed for xmame (and which
is still used successfully in xmame after many years of usage).

I'll admit it isn't very pretty, but after investigating several possibilities
this was the best option, any other fixes would need changes to the SDL api and
abi.

--HG--
branch : SDL-1.2
2007-12-29 02:23:48 +00:00
Sam Lantinga
9f413fe6d9 Date: Thu, 27 Dec 2007 07:38:25 +0000
From: John Bartholomew
Subject: [SDL] SDL Semaphore implementation broken on Windows?
Hi,

Over the past couple of days, I've been battling with SDL, SDL_Mixer and SMPEG to try to find an audio hang bug.  I believe I've found the problem, which I think is a race condition inside SDL's semaphore implementation (at least the Windows implementation).  The semaphore code uses Windows' built in semaphore functions, but it also maintains a separate count value.  This count value is updated with bare increment and decrement operations in SemPost and SemWaitTimeout - no locking primitives to protect them.

In tracking down the apparent audio bug, I found that at some point a semaphore's count value was being decremented to -1, which is clearly not a valid value for it to take.

I'm still not certain exactly what sequence of operations is occuring for this to happen, but I believe that overall it's a race condition between a thread calling SemPost (which increments the count) and the thread on the other end calling SemWait (which decrements it).

I will try to make a test case to verify this, but I'm not sure if I'll be able to   (threading errors being difficult to reproduce even in the best    circumstances).

However, assuming this is the cause of my problems, there is a very
simple fix:
Windows provides InterlockedIncrement() and InterlockedDecrement()
functions to perform increments and decrements which are guaranteed to be atomic.  So the fix is in thread/win32/SDL_syssem.c: replace occurrences of --sem->count with InterlockedDecrement(&sem->count); and replace occurrences of ++sem->count with InterlockedIncrement(&sem->count);

This is using SDL v1.2.12, built with VC++ 2008 Express, running on a
Core 2 duo processor.

--HG--
branch : SDL-1.2
2007-12-28 22:05:17 +00:00
Sam Lantinga
8b3c845e2c Fixed fatbuild.sh script for building on Mac OS X 10.5
The minimum PPC SDK is 10.3.9

--HG--
branch : SDL-1.2
2007-12-28 20:39:31 +00:00
Sam Lantinga
5b100cbad4 Date: Wed, 14 Nov 2007 22:20:27 -0500
From: Calvin Vette
Subject: Fix to compile SDL-1.2 SVN on OS X Leopard

I found I needed to add a conditional check for Leopard to compile
cleanly on 1.2-SVN (20071114):

#include <AudioUnit/AudioUnit.h>
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
#include <AudioUnit/AUNTComponent.h>
#endif

where there is now just:
#include <AudioUnit/AudioUnit.h>

--HG--
branch : SDL-1.2
2007-12-28 18:15:43 +00:00