Commit graph

3268 commits

Author SHA1 Message Date
Ryan C. Gordon
546d0f18a2 BeOS/Haiku support for SDL_WINDOW_BORDERLESS.
--HG--
extra : rebase_source : 7f89afdb809feb1a7e4f75e90fd88da20a341601
2012-09-13 01:29:18 -04:00
Sam Lantinga
7b97d492a6 Fixed bug 1599 - On X11, SDL2 should use CLIPBOARD as well as PRIMARY for copy/paste
David White 2012-09-12 13:22:52 PDT

Background: X has two main 'buffers' for copy/paste:

PRIMARY -- normally used for implicit selection of text, with middle-click to
paste
CLIPBOARD -- works with an explicit copy/paste like on other platforms.

Currently SDL2 only provides access to PRIMARY. Since CLIPBOARD is much closer
to functionality of other platforms, SDL should provide access to that instead.

The attached patch makes it so that SDL_SetClipboardText() sets both PRIMARY
and CLIPBOARD and SDL_GetClipboardText() reads from CLIPBOARD instead of
primary.
2012-09-14 01:16:27 -07:00
Ryan C. Gordon
63b91d2986 Moved iOS-specific code into uikit target. Fixes crashes in X11 target. 2012-09-12 19:36:18 -04:00
Sam Lantinga
48e3952607 Fixed issue where the context couldn't be unbound after the window is shown because the current context was already marked as NULL. (Thanks to John McDonald for tracking that down!) 2012-09-10 20:25:55 -07:00
Sam Lantinga
73f3a3e912 Fixed error message when destroying a software renderer, thanks to wahono for the patch. 2012-09-06 21:34:52 -07:00
Gabriel Jacobo
b1656ffb91 Return a valid error in SDL_GL_Bind/UnbindTexture, thank you buildbot! 2012-09-03 11:54:48 -03:00
Gabriel Jacobo
bd7b381374 Implements SDL_GL_BindTexture and SDL_GL_UnbindTexture (#1576) 2012-09-03 11:16:12 -03:00
Ryan C. Gordon
bd6eef53b6 Removed a FIXME; RemoteIO is correct for iOS.
--HG--
extra : rebase_source : b7707b74bcdcafe4165a8c6eb7982c23fb2b9d0e
2012-09-02 19:37:36 -04:00
Sam Lantinga
9624fe2634 Use fast path for RGB 565 -> 32-bit XRGB 8888
Hello Sam,
while profiling ScummVM I noticed it was making use of the generic
BlitNToN blitter, which struck me as odd because it should be a very
classical codepath.
After investigating, I saw that in the blit op chooser:

    { 0x0000F800,0x000007E0,0x0000001F, 4, 0x00FF0000,0x0000FF00,0x000000FF,
      0, NULL, Blit_RGB565_ARGB8888, SET_ALPHA },
    { 0x0000F800,0x000007E0,0x0000001F, 4, 0x000000FF,0x0000FF00,0x00FF0000,
      0, NULL, Blit_RGB565_ABGR8888, SET_ALPHA },
    { 0x0000F800,0x000007E0,0x0000001F, 4, 0xFF000000,0x00FF0000,0x0000FF00,
      0, NULL, Blit_RGB565_RGBA8888, SET_ALPHA },
    { 0x0000F800,0x000007E0,0x0000001F, 4, 0x0000FF00,0x00FF0000,0xFF000000,
      0, NULL, Blit_RGB565_BGRA8888, SET_ALPHA },

Couldn't the optimized versions be used for NO_ALPHA too? I take it
that the resulting alpha component can be undefined as it should never
be used.
I tried this (see attached patch) and it worked perfectly (and
therefore faster) on ScummVM but there might be a trick (I'm not
expert at the semantics of SDL, ie NO_ALPHA, SET_ALPHA and COPY_ALPHA
there).
What do you think?

Cheers,
Bertrand
2012-09-02 16:03:56 -07:00
Ryan C. Gordon
a4a3cff536 Fixed compiler warning. 2012-08-30 12:58:58 -07:00
Ryan C. Gordon
fbb9321daf Fixed compiler warning on some versions of GCC. 2012-08-25 22:21:16 -04:00
Ryan C. Gordon
e5f91113a3 Fixed wglShareLists() call that used the wrong variable. 2012-08-25 16:49:05 -04:00
Ryan C. Gordon
386b1d15cf Whoops, removed wrong variable. 2012-08-24 19:39:51 -04:00
Ryan C. Gordon
816523a285 Fixed a bunch of compiler warnings with Cygwin/MingW. 2012-08-24 19:34:28 -04:00
Sam Lantinga
488a27f1b9 Fixed bug 1561 - BSD joystick: Increase the number of uhid devices to scan
Brad Smith 2012-08-01 20:10:19 PDT

The attached patch from the OpenBSD ports tree is to increase the number of
uhid devices to scan for joysticks. It's somewhat easy to exhaust the default
number of devices which are scanned.
2012-08-24 10:03:05 -07:00
Gabriel Jacobo
052e84a94b Fixes bug #1506, Changing orientation on the Android device throws off touch scaling 2012-08-24 13:10:29 -03:00
Gabriel Jacobo
5c98584a78 Fix for #1577, SDL_RenderCopyEx - Runtime check fails when dstrect == NULL and center == NULL
Thanks Michael Ehrmann.
2012-08-24 11:56:21 -03:00
Sam Lantinga
99502c82fd Fixed bug 1565 - some small GL context creation enhancements
Matthias Bentrup 2012-08-09 12:53:17 PDT

With OpenGL 4.3 the ARB added a new context flag for context reset isolation
and renamed the existing ES2 profile bit to ES profile bit, as it can be used
to request GLES 3 compatible contexts, too.

This patch adds these changes to SDL on Linux and Windows.

Also SDL lacks the ability to create shared contexts. This patch also adds a
new GL attribute to enable context sharing. As casting a GL context to int is
not portable, I added only a boolean attribute
SDL_GL_SHARE_WITH_CURRENT_CONTEXT, which makes the new context share resources
with the context current on the creating thread.
2012-08-12 11:16:24 -07:00
Sam Lantinga
bf2304785f Fixed bug 1564 - SDL has no function to open a screen keyboard on Android.
Philipp Wiesemann implemented a general on-screen keyboard API for SDL, and I switched iOS code over to use it.
2012-08-11 10:15:59 -07:00
Ryan C. Gordon
8912814135 Removed some unused variables that gcc 4.6.1 complains about. 2012-08-09 14:14:41 -04:00
Ryan C. Gordon
4f18aa19f5 Patched to compile on Mac OS X 10.8 SDK. 2012-08-08 13:44:58 -04:00
Ryan C. Gordon
68a98ad796 Patched to compile on Windows. 2012-08-01 21:03:46 -04:00
Ryan C. Gordon
55a52db07d Cleanups to Windows WGL_EXT_swap_control_tear code. 2012-08-01 20:57:03 -04:00
Ryan C. Gordon
2cd5fc4e97 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
706ea79345 Fixed black screen on iOS 2012-07-31 16:55:09 -07:00
Kajetan Swierk
a82bdaf85d Fixed typo in one of WGL definition 2012-07-22 21:47:56 +02:00
Sam Lantinga
6d35992e47 Fix for the Game Center status window always being behind the SDL window (untested!) 2012-07-22 11:24:04 -07:00
Gabriel Jacobo
e4b5104b91 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
9a4128b20d Should fix type-punning compiler warnings. 2012-07-20 13:52:25 -04:00
Ryan C. Gordon
82ebf2d4ff Fixed some minor compiler warnings.
--HG--
extra : rebase_source : 9466732b4e5ab87e92e8eb9e2377aa5405bdc23b
2012-07-20 13:33:15 -04:00
Sam Lantinga
1277706b2b More OpenGL ES fixes from Scott Percival 2012-07-19 09:36:58 -07:00
Sam Lantinga
4d8e7cdf64 Switch the OpenGL ES renderers to request EGL OpenGL contexts 2012-07-18 15:20:32 -07:00
Sam Lantinga
b3219a6db1 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
cb83481887 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
b29ba3d6cf 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
aa816459ab Fix memory leaks in X11_CreateDevice error paths
Patch contributed by Andre Heider
2012-07-18 14:48:32 -07:00
Sam Lantinga
9844cacdd7 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
0e49fa682a Patched to compile on FreeBSD 8.2. 2012-07-11 22:20:02 -04:00
Ryan C. Gordon
e3e3adf168 Removed unused variable to silence compiler warning. 2012-07-11 22:04:19 -04:00
Ryan C. Gordon
81bf162798 Patched to compile on PowerPC Mac OS X. 2012-07-11 20:20:04 -04:00
Sam Lantinga
6590f3daa3 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
8723c73510 Fixes #1422, removes global JNI Env, uses per thread copies, adds thread auto detaching. 2012-07-09 18:08:06 -03:00
Sam Lantinga
7b6f9ccd63 Removed unneeded audio buffer memset() for consistent behavior on all platforms. 2012-07-05 12:16:44 -04:00
Sam Lantinga
8533068f54 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
c7a5aa5128 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
540577559f 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
4a7b7a910b 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
655622dc62 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
a3161ce5ae Fix SDL_SetWindowSize with X11 non-RESIZABLE windows, patch by Pierre-Loup. 2012-06-22 23:31:22 -04:00
Sam Lantinga
a3bf8f0c71 Created a header file for system dependent API functions, and added SDL_iPhoneSetAnimationCallback() 2012-06-22 19:19:18 -04:00