Commit Graph

3245 Commits

Author SHA1 Message Date
Ryan C. Gordon
f32956dc1b Add support for (GLX|WGL)_EXT_swap_control_tear.
This required a small public API change: SDL_GL_SetSwapInterval() now accepts
 negative values, and SDL_GL_GetSwapInterval() doesn't report errors anymore
 (if it can't work, it'll return zero as a reasonable default).

If you need to test for errors, such as a lack of swap_control_tear support,
 check the results of SDL_GL_SetSwapInterval() when you set your desired
 value.
2012-08-01 20:29:36 -04:00
Sam Lantinga
8974094e37 Fixed black screen on iOS 2012-07-31 16:55:09 -07:00
Kajetan Swierk
758423638b Fixed typo in one of WGL definition 2012-07-22 21:47:56 +02:00
Sam Lantinga
1c2ef337ed Fix for the Game Center status window always being behind the SDL window (untested!) 2012-07-22 11:24:04 -07:00
Gabriel Jacobo
62b982e79f Fixes Android_JNI_FileRead behaviour where reading past the end of a file returns zero instead of the number of bytes read. 2012-07-20 15:22:48 -03:00
Ryan C. Gordon
21d0a3503b Should fix type-punning compiler warnings. 2012-07-20 13:52:25 -04:00
Ryan C. Gordon
7d67b05181 Fixed some minor compiler warnings. 2012-07-20 13:33:15 -04:00
Sam Lantinga
891cb6673b More OpenGL ES fixes from Scott Percival 2012-07-19 09:36:58 -07:00
Sam Lantinga
1d7093bd80 Switch the OpenGL ES renderers to request EGL OpenGL contexts 2012-07-18 15:20:32 -07:00
Sam Lantinga
719eabe5ee Improved simultaneous support for OpenGL and OpenGL ES
From Scott Percival

Okay, I think I have something for this. Tested it on GL and GLES
machines, it seems to work okay.

- Add a new SDL GL attribute SDL_GL_CONTEXT_EGL:
        - Only useful for the X11 video driver at the moment
        - Set to 1 for an EGL context, 0 to use the default for the video driver
        - Default is 0, unless library is built for EGL only
        - Should be set after SDL init, but before window/context
creation (i.e. same place you'd specify attributes for major/minor GL
version)
- After a lot of agony pondering the least-terrible way to go about
it, made it so that X11_GL_LoadLibrary and X11_GLES_LoadLibrary check
SDL_GL_CONTEXT_EGL. If no GL context exists yet, and the attribute
choice doesn't match with the checking function, then it changes all
the function pointers in the video driver and passes control on to the
new LoadLibrary method.
- Likewise, make X11_CreateWindow check this attribute before firing
off a call to X11_GL_GetVisual/X11_GLES_GetVisual
- Added a sanity check to the start of X11_GL_LoadLibrary
- Tidied up SDL_x11opengles.h
- Moved ownership of the gles_data structure over to
X11_GLES_LoadLibrary/UnloadLibrary
- Should incorporate the 3 fixes posted by Andre Heider

This is obviously quite a bit to take in, but is (at least) a proof of
concept for the approach I think EGL/GLX mingling should take. Any
comments/criticism is much appreciated.
2012-07-18 15:17:27 -07:00
Sam Lantinga
1792e4e31d Fix OpenGL initialization when OpenGL and OpenGLES are both available.
Both options default to "yes" via configure, and having libs/headers
for both installed is not unusual.

We default to OpenGL on this compile time combination, but can enforce
OpenGLES via setting the envvar SDL_VIDEO_X11_GLES.
This will be further refined based on community feedback.

Contributed by Andre Heider
2012-07-18 15:02:48 -07:00
Sam Lantinga
3cc390b137 Rename envvar to overwrite X11 EGL library name.
We cannot use SDL_VIDEO_GL_DRIVER for both EGL and GLES1/2, so rename
the envvar for EGL to SDL_VIDEO_EGL_DRIVER and keep SDL_VIDEO_GL_DRIVER
for GLES1/2.

Contributed by Andre Heider
2012-07-18 15:01:41 -07:00
Sam Lantinga
49eb187b19 Fix memory leaks in X11_CreateDevice error paths
Patch contributed by Andre Heider
2012-07-18 14:48:32 -07:00
Sam Lantinga
f63870e37d Fixed bug 1434 - Add AltiVec detection for OpenBSD/powerpc
Brad Smith 2012-02-29 19:31:46 PST

The attached patch adds AltiVec detection for OpenBSD/powerpc. Please apply the
patch to both 2.0 and 1.2.
2012-07-18 13:06:38 -07:00
Ryan C. Gordon
641161f677 Patched to compile on FreeBSD 8.2. 2012-07-11 22:20:02 -04:00
Ryan C. Gordon
da2c5c7165 Removed unused variable to silence compiler warning. 2012-07-11 22:04:19 -04:00
Ryan C. Gordon
1ceed54b76 Patched to compile on PowerPC Mac OS X. 2012-07-11 20:20:04 -04:00
Sam Lantinga
a14df76c17 Fixed bug 1540: SDL 2.0 won't link on Visual Studio 2012 RC for x64
Thanks to Marek Pokorny for tracking this down and providing a fix.
2012-07-11 08:51:16 -04:00
Gabriel Jacobo
af5f6d6ddb Fixes #1422, removes global JNI Env, uses per thread copies, adds thread auto detaching. 2012-07-09 18:08:06 -03:00
Sam Lantinga
13ac487e86 Removed unneeded audio buffer memset() for consistent behavior on all platforms. 2012-07-05 12:16:44 -04:00
Sam Lantinga
12c31c0abf Marcus von Appen fixed bug 1535: SDL_UpdateWindowRects() SIGSEGV on X11 with out-of-bound rects
Using SDL_UpdateWindowRects () with SDL_Rect instances, that do not clip
to the bounds of the SDL_Window, causes a BadValue error on X11, if shared
memory is enabled:

X Error of failed request:  BadValue (integer parameter out of range for
operation)
  Major opcode of failed request:  142 (MIT-SHM)
  Minor opcode of failed request:  3 (X_ShmPutImage)
  Value in failed request:  0x5
  Serial number of failed request:  67
  Current serial number in output stream:  70

Attached is a test program to recreate the behaviour along with a simple
patch for SDL_x11framebuffer.c, which reduces the rect area to the window
bounds.

I am not sure, if XPutImage() is more robust here, so I applied it to the
non-shared memory version, too.
2012-07-05 07:26:18 -04:00
Sam Lantinga
fac49f9828 Patrick Baggett implemented relative mouse mode on Win32
Here is my first rough attempt. "testrelative" feels right to me, but I'd like it someone else tested this, especially compared to Linux/OSX. The "Ctrl+r" to switch between relative and normal mouse movements seems to work flawlessly. With relative mouse movement, the only way to change focus is via keyboard. I'm not sure if that is the correct approach, but that would seem to be the most useful mode for games. Still, if my assumption is wrong, I can fix that no problem.
2012-07-03 23:52:02 -04:00
Sam Lantinga
66d1c8e003 Vittorio Giovara fixed bug 1528: move hint registration from SDLUikitAppDelegate
When subclassing SDLUikitAppDelegate you usually override the -postFinishLaunch
method so that you can (for example) call a different function than SDL_main.

As it is now, however, overriding -postFinishLaunch will bar out the
SDL_SetHint for the idle timer. Attached a simple patch the moves the hint
callback to the -application:didiFinishLaunchingWithOptions:
2012-07-02 08:37:48 -04:00
Sam Lantinga
22635aff00 Marcus von Appen fixed bug 1530: X11 touch initialisation does not check its file handles 2012-07-02 08:33:10 -04:00
Sam Lantinga
c45ef572c4 Disable the SDL event pump after the SDL main routine returns, since events will be dispatched by the Cocoa event loop. 2012-06-25 11:10:34 -04:00
Sam Lantinga
6adb4e9008 Fix SDL_SetWindowSize with X11 non-RESIZABLE windows, patch by Pierre-Loup. 2012-06-22 23:31:22 -04:00
Sam Lantinga
5160c3d202 Created a header file for system dependent API functions, and added SDL_iPhoneSetAnimationCallback() 2012-06-22 19:19:18 -04:00
Sam Lantinga
32a20bfc64 Fixed orientation and color when rendering to texture 2012-06-22 11:38:49 -04:00
Gabriel Jacobo
a1de587006 Fixes #1523 by removing inconsistent use of texture->access 2012-06-21 11:16:14 -03:00
Sam Lantinga
c69811e85e Fixed issue with tiling window managers (bug 1246)
Patch contributed by Driedfruit - thanks!
2012-06-21 09:58:22 -04:00
Gabriel Jacobo
9eb7a5f09f Fixes #1519, adds initialization to Android RWops internal variables. 2012-06-20 11:25:40 -03:00
Sam Lantinga
e3179ba01b Fixed compiling with Visual Studio 2012-06-19 13:50:14 -04:00
Gabriel Jacobo
5cd65923a0 Fixes #1522, improved Xinerama / Twinview support 2012-06-19 14:19:05 -03:00
Gabriel Jacobo
1be4f2c07f Fixes #1422, restores GL context automatically under Android 2012-06-19 13:57:42 -03:00
Ryan C. Gordon
b4cd73d4d5 Fix from 1.2 branch: ignore bogus Linux evdev joystick axes. 2012-06-03 05:05:34 -04:00
Sam Lantinga
9a96b99516 Fixed SDL_config.h build include path 2012-06-01 20:31:50 -04:00
Sam Lantinga
726f2cdfde Fixed includes for Objective C 2012-06-01 20:05:38 -04:00
Gabriel Jacobo
2e96488df0 RenderCopyEx,rotation and flipping for all hardware/software backends (#1308) 2012-06-01 19:51:08 -03:00
Dimitris Zenios
e387df94fc 1.Fixed a memory leak inside XInput2 code
2.Replaced XKeycodeToKeysym with XkbKeycodeToKeysym since XKeycodeToKeysym is deprecated in newer X11 version
3.Rewrote testime.c since it was disabled after SDL_compat.c removal
4.Take into account common arguments also in testrelative.c
2012-05-31 19:23:30 +03:00
Dimitris Zenios
689dd07956 1.Moved all xinput2 functionality to its own file
2.Implement touch events using Xinput2.Leave evtouch as a fallback when xinput2 is not supported
2012-05-31 13:37:02 +03:00
Sam Lantinga
94597260b7 Fixed compile error with both new and old Xext headers (bug 1498) 2012-05-30 11:44:57 -04:00
Sam Lantinga
b249d5f9ae Fixed compile error 2012-05-30 11:43:33 -04:00
Sam Lantinga
a74c7583bc Initial support for XInput2 by Dimitris Zenios
1.initial work on XInput2 support
2.Implemented relative mouse motion when XInput2 is enabled
3.Created a test app to test relative mouse motion
4.Fixed Bug #1498
2012-05-30 11:25:35 -04:00
Sam Lantinga
5b2b2679a9 Allow SDL_uikitkeyboard.h to be included in C++ applications 2012-05-25 18:21:10 -04:00
Gabriel Jacobo
a6c03533e0 Fixes issue #1500 "SDL_RWops fails under Android 4" by removing stale Local Refs
and replacing them for their global equivalents.
2012-05-25 15:35:41 -03:00
Gabriel Jacobo
8edbb26524 Fix for issue #1465, Leak in Android_JNI_SetActivityTitle (SDL_SetWindowTitle)
Thanks Martin Gerhardy!
2012-05-25 15:10:13 -03:00
Ryan C. Gordon
b782955be2 SDL_ExitProcess() was ignoring exit code parameter. 2012-04-09 23:55:43 -04:00
Sam Lantinga
809447b726 I think this may fix the altivec blitters. 2012-04-08 03:59:36 -04:00
Wim Looman
bf836266b7 Make mouse relative mode save the original co-ordinates to restore them
properly.
2012-02-04 00:13:21 +13:00
Wim Looman
fde369d185 Change SDL_SetCursor to set the cursor back to the default cursor when the
window is unfocused.
2012-02-03 23:53:51 +13:00