Commit graph

2909 commits

Author SHA1 Message Date
Sam Lantinga
e4a0db291e Re-added the 3DNow! and AltiVec instruction support. 2011-02-22 21:44:36 -08:00
Sam Lantinga
92bf0fc2fd Update the cursor correctly when it enters and leaves the window. 2011-02-21 23:45:48 -08:00
Sam Lantinga
1918f54080 Actually set the cursor! :) 2011-02-21 23:10:00 -08:00
Sam Lantinga
642eea1ebc Simplified the X11 window creation 2011-02-21 22:52:31 -08:00
Sam Lantinga
f817468a0b The OpenGL test window shouldn't be visible. 2011-02-21 22:52:07 -08:00
Sam Lantinga
36be715703 Don't automatically send minimized and maximized events, it's up to the windowing system to decide what to do with them. 2011-02-21 22:51:44 -08:00
Sam Lantinga
252402726d Clear the hidden flag when shown and the shown flag when hidden. 2011-02-21 22:50:15 -08:00
Sam Lantinga
0f6925189c Simplified Windows window creation. 2011-02-21 22:27:19 -08:00
Sam Lantinga
9da77abd36 Fixed compiler warnings 2011-02-21 22:26:59 -08:00
Sam Lantinga
f8481050cd Simplified and unified the window creation process a little. 2011-02-21 22:03:39 -08:00
Sam Lantinga
165076c9c3 We can defer window creation.
Added documentation for why we need an SDLView
2011-02-21 21:32:11 -08:00
Sam Lantinga
f3564c3a8e Fixed compiler warning 2011-02-21 20:35:44 -08:00
Sam Lantinga
24864a72cc Added disabled preferences menu option so it looks more like other application menus. 2011-02-21 20:34:22 -08:00
Sam Lantinga
22779f35b2 Implemented cursor support and SDL_WarpMouseInWindow() on Mac OS X 2011-02-21 17:15:50 -08:00
Sam Lantinga
ada3863500 Implemented Cocoa_SetWindowIcon(), added SDL_ConvertSurfaceFormat() 2011-02-21 16:45:23 -08:00
Sam Lantinga
eb66b35c80 We still want the delegate functionality for windowShouldClose() 2011-02-21 15:25:49 -08:00
Sam Lantinga
9619f0bccf Do error checking in SDL_GetDisplayForWindow() 2011-02-21 15:08:36 -08:00
Sam Lantinga
658997241d Fixed the responder chain for event handling, the listener fully handles mouse events - even in fullscreen mode.
The only reason we need a custom view is to handle right mouse down.

Implemented mouse grabbing, although it's kind of clunky right now.  I'll be adding a relative mode that will be smoother soon.
2011-02-21 10:50:53 -08:00
Sam Lantinga
c379a10fa4 The valid mouse coordinates actually range from 0 to w-1 and h-1 2011-02-20 23:51:59 -08:00
Sam Lantinga
84c86a8df1 Reverted the experiment, it didn't work. 2011-02-20 23:51:31 -08:00
Sam Lantinga
e4acc9ef07 Experiment to try to account for source clipping 2011-02-20 23:16:58 -08:00
Sam Lantinga
04bd7cfffc Fixed bug 1105 (SDL_GetMouseState returns wrong location upon window re-activation) 2011-02-20 20:49:31 -08:00
Sam Lantinga
8e56849e83 Fixed testgles on iOS (bug 1136) 2011-02-20 14:16:11 -08:00
Sam Lantinga
f0c1972949 Fixed compiler warning 2011-02-20 13:56:57 -08:00
Sam Lantinga
b76f908f27 Fixed compiling on Mac OS X 10.4 2011-02-20 12:39:59 -08:00
Sam Lantinga
f2209fb448 Simple rumble API for haptic
Edgar Simo      2011-02-20 10:27:52 PST

Adding patch that adds a simplified API for the haptic subsystem built ontop of
the "real one" for those who want simple rumble without jumping through hoops.

Adds 4 functions:

- extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
- extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
- extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float
strength, Uint32 length );
- extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);

Also provided is test/testrumble.c which does test this.

This has all been tested on linux and has worked, but due to being built ontop
of the other haptic API it should work on all OS the same.
2011-02-20 10:54:44 -08:00
Sam Lantinga
e7aaeec596 Added a revision number for easy compile-time tests. 2011-02-20 10:42:51 -08:00
Sam Lantinga
d5af47a5c7 Untested fix for bug 946 (SDL_HapticIndex returns 0 for all devices)
Edgar Simo      2011-02-20 09:02:31 PST

Linux uses fname, which is the name of the device path like for example
/dev/input/event3 so it shouldn't have the issue. However I can confirm that it
looks like haptic->index never gets properly set on windows. Have to look at
mac os x also. I'll see if I can fix it real quick now.
2011-02-20 09:28:13 -08:00
Sam Lantinga
ee61cc3170 Added OpenGL state caching for decent speed improvement. 2011-02-19 21:51:21 -08:00
Sam Lantinga
e2438fbcb2 Yes, it compiles now. 2011-02-19 16:41:01 -08:00
Sam Lantinga
9b4905af3b Fixed warning on Mac OS X 10.4 2011-02-19 14:27:16 -08:00
Sam Lantinga
662a1c6cbd Autogenerated full mask checks for pixel format match 2011-02-19 14:19:15 -08:00
Sam Lantinga
234bc0aa5d Added missing log debug function 2011-02-19 11:23:56 -08:00
Sam Lantinga
92f76388ca Zero streaming textures to reduce confusion.
(See mailing list message with subject "Streaming textures not properly initialized?")
2011-02-17 18:58:43 -08:00
Sam Lantinga
3746025d7f Allow the application to explicitly request a software renderer. 2011-02-17 12:03:48 -08:00
Sam Lantinga
baf813b8c1 Our minimum Windows version is Windows 2000, so it's okay to directly call InitializeCriticalSectionAndSpinCount().. 2011-02-17 09:26:15 -08:00
Sam Lantinga
58d7fc4732 Fixed bug 1128
Patrick Baggett      2011-02-16 22:58:33 PST

This enhancement is for both x86/x64 Windows.

The SDL implementation of mutexes uses the Win32 API interprocess
synchronization primitive called a "Mutex". This implementation is subpar
because it has a much higher overhead than an intraprocess mutex. The exact
technical details are below, but my tests have shown that for reasonably high
contention (10 threads on 4 physical cores), it has 13x higher overhead than
the Win32 CriticalSection API.

If this enhancement is accepted, I will write a patch to implement SDL mutexes
using the critical section API, which should dramatically reduce overhead and
improve scalability.


-- Tech details --
Normally, Win32 Mutexes are used across process boundaries to synchronize
separate processes. In order to lock or unlock them, a user->kernel space
transition is necessary, even in the uncontented case on a single CPU machine.
Win32 CriticalSection objects can only be used within the same process virtual
address space and thus to lock one, does not require a user->kernel space
transition for the uncontended case, and additionally may spin a short while
before going into kernel wait. This small spin allows a thread to obtain the
lock if the mutex is released shortly after the thread starts spinning, in
effect bypassing the overhead of user->kernel space transition which has higher
overhead than the spinning itself.
2011-02-17 09:13:12 -08:00
Sam Lantinga
ea8037a625 Implemented OpenGL ES RenderClear() 2011-02-17 02:23:48 -08:00
Sam Lantinga
7fda55f8d4 Fixed warnings about unused variables and so forth. 2011-02-17 02:18:41 -08:00
Sam Lantinga
30d36c1c80 Fixed SDL_RenderClear() if the render driver doesn't implement it. 2011-02-17 02:17:38 -08:00
Sam Lantinga
b411d9fc24 Fixed crash when drawing non-textured primitives 2011-02-17 02:16:30 -08:00
Sam Lantinga
1cbbefce43 Fixed bug 1122 (spinlock fails to compile with -march=armv4t) 2011-02-16 17:17:21 -08:00
Sam Lantinga
d4acca7166 Renamed SDL_keysym.h to SDL_keycode.h to avoid confusion.
--HG--
rename : include/SDL_keysym.h => include/SDL_keycode.h
2011-02-16 15:46:12 -08:00
Sam Lantinga
d2b922f555 Fixed bug #1090 (SDL_BlitCopyOverlap() assumes memcpy() operates in order)
Even if we're blitting between two different surfaces their pixels might still overlap, because of SDL_CreateRGBSurfaceFrom(), so always use SDL_BlitCopy() and check for overlap in that function.

When handling overlapping surfaces, don't assume that memcpy() iterates forward, instead use memmove() correctly, and provide a fallback implementation of SDL_memmove() that handles the different cases.

Fixed a bug with SDL_memset() not completely filling lengths that aren't a multiple of 4.
Optimized SDL_memcpy() a bit using the same technique as SDL_memset().
2011-02-16 15:25:10 -08:00
Sam Lantinga
9f536cb6f7 Source is not executable... 2011-02-16 12:52:09 -08:00
Sam Lantinga
c2204a539c Fixed bug #1121 (More than one device through SDL_JOYSTICK_DEVICE)
Chusslove Illich      2011-02-13 04:30:28 PST

Currently SDL_JOYSTICK_DEVICE environment variable can be used to add
exactly one topmost device. I think it would be nice if one could also set
several devices (e.g. a stick and a throttle) in this way, as a colon-
separated list. The attached patch implements this
2011-02-16 04:51:13 -08:00
Sam Lantinga
e6accab8ba Fixed bug #1085 (Jump to NULL function pointer on ALSA_OpenDevice)
Bruno      2010-12-16 02:41:51 PST

Fix segfault in ALSA_OpenDevice()

When alsa is linked to libsdl instead of being loaded on demand at runtime the
alsa macro snd_pcm_hw_params_alloca(ptr); misbehaves.

That macro calls snd_pcm_hw_params_sizeof() in order to determine the amount of
memory to allocate but due to mis-placed define that function is replaced with
ALSA_snd_pcm_hw_params_sizeof by preprocessor (and in case of link to alsa that
function pointer is initialized to itself).

Attached patch fixes the issue.
2011-02-16 04:08:28 -08:00
Sam Lantinga
e17d29cd0e Setup the screensaver in the OpenGL case as well. 2011-02-16 02:57:00 -08:00
Sam Lantinga
2266448814 Fixed bug #963 (Crash with OpenGL & window resizing)
The crash was already fixed, but the window doesn't need to be recreated if you're just changing the size of the OpenGL window.
2011-02-16 02:55:46 -08:00
Sam Lantinga
e0bf2dc643 Made it possible to build SDL from a fresh checkout without any additional steps.
The trick is that if you're using configure and you don't want to have SDL_config.h and SDL_revision.h to show up as modified, you need to configure and build from a separate directory.

You also need to include SDL_revision.h directly if you want to use the SDL_REVISION constant, as a side effect of these changes.

--HG--
rename : include/SDL_config.h.default => include/SDL_config.h
2011-02-16 02:37:09 -08:00