Commit Graph

288 Commits

Author SHA1 Message Date
Sam Lantinga
2348e426c7 Fixed whitespace 2013-10-21 22:08:56 -07:00
Sam Lantinga
bcf5472d16 Fixed bug 2073 - Mac: window moves unexpectedly when exiting SDL_WINDOW_FULLSCREEN_DESKTOP mode
Alex Szpakowski

In Mac OS X, when SDL_SetWindowFullscreen(window, 0) is called on a window which was in SDL_WINDOW_FULLSCREEN_DESKTOP mode, its original size is restored but its position is moved to the bottom of the screen.

I tracked down the issue to these two lines: http://hg.libsdl.org/SDL/file/fdd5cc9e9f90/src/video/cocoa/SDL_cocoawindow.m#l1034

I believe [nswindow setFrameOrigin:rect.origin] implicitly calls [nswindow constrainFrameRect:rect toScreen:screen], which will attempt to constrain the window to the screen, but at that point the window size is still full-screen rather than the restored window size, so the constrainFrameRect function operates on the wrong window size.

https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/constrainFrameRect:toScreen:

I resolved the issue by swapping the order of the function calls, like so:
[nswindow setContentSize:rect.size];
[nswindow setFrameOrigin:rect.origin];
2013-10-21 02:37:03 -07:00
Sam Lantinga
b8b9bfbe5b Fixed some warnings building for 64-bit Windows 2013-10-21 01:16:16 -07:00
Sam Lantinga
11d38d696e Fixed bug 2015 - surface getting leak in SDLTest_ScreenShot function
Nitz 2013-08-06 03:53:41 UTC

In function SDLTest_ScreenShot() surface pointer getting leak while return
2013-10-21 00:30:05 -07:00
Sam Lantinga
80930559a3 Fixed bug 2012 - Algorithm logic getting wrong in ComputeOutCode
Nitz

I was going through the SDL_IntersectRectAndLine function and wondered to see the ComputeOutCode function implementation.

The problem in this algo is, x and y axis are getting check with respect to 0, Which is wrong, it should be get checked with respect to rectangle x and y axis.
2013-10-21 00:25:43 -07:00
Sam Lantinga
deb8086b08 Fixed bug 2072 - Make OS X's filesystem calls use -[NSString fileSystemRepresentation]
C.W. Betts

The recommended way of getting a file name that POSIX file APIs can open in OS X when using an NSString is -[NSString fileSystemRepresentation]. However, the current filesystem API in hg uses -[NSString UTF8String].
2013-10-21 00:20:27 -07:00
Sam Lantinga
360c3d853a Better cleanup if OpenGL initialization fails 2013-10-21 00:15:24 -07:00
Sam Lantinga
a503dabe01 Fixed a crash initializing Android touch IDs 2013-10-20 23:23:25 -07:00
Sam Lantinga
f8c11bb955 Fixed the status bar visibility in iOS 7 2013-10-20 23:05:53 -07:00
Sam Lantinga
85c2e2367c Fixed Y axis inversion on iOS; positive is up, negative is down. 2013-10-20 22:23:09 -07:00
Sam Lantinga
08fa8da77c Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings
Andreas Ertelt

The problem in question is caused by changeset 7771 (http://hg.libsdl.org/SDL/rev/5486e579872e / https://bugzilla.libsdl.org/show_bug.cgi?id=2121)

The redefinition of __inline__ (introduced by the addition of begin_code.h:128's "|| __STRICT_ANSI__") results in mingw's gcc throwing multiple

   warning: always_inline function might not be inlinable [-Wattributes]

as well as a whole bunch of redefinitions of mingw internals which break linking of projects including the SDL2 headers.
2013-10-20 21:56:15 -07:00
Sam Lantinga
4ca34ad4a4 Prevent conflicts when linking both SDL2 and SDL2_gfx 2013-10-20 21:34:38 -07:00
Sam Lantinga
aa86e05d21 Fixed windows compile 2013-10-20 20:49:36 -07:00
Sam Lantinga
f5fa492e26 Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values.
Went through the code and used the macro and fixed a couple places that were using incorrect timestamp comparisons.
2013-10-20 20:42:55 -07:00
Ryan C. Gordon
d710399671 Fix some edge cases in XInput haptic timing. 2013-10-20 23:38:19 -04:00
Ryan C. Gordon
dddb878761 Disable Win32 thread naming again. See Bugzilla #2089. 2013-10-20 23:08:45 -04:00
Ryan C. Gordon
0e699eb5bb Added SDL_GL_FRAMEBUFFER_SRGB_CAPABLE (thanks, David!).
Fixes Bugzilla #1985.
2013-10-20 21:18:05 -04:00
Ryan C. Gordon
d1bde399af Backed out changeset 737771c47c6f, done testing Buildbot changes. 2013-10-20 20:24:00 -04:00
Ryan C. Gordon
df3680846b Intentionally breaking Windows and Raspberry Pi builds to test Buildbot change. 2013-10-20 20:02:02 -04:00
Ryan C. Gordon
f28c7fe8a5 Backed out hg changeset add2dbe99fe2. REFGUID is apparently a const type. 2013-10-20 16:03:11 -04:00
Ryan C. Gordon
c521ae84bc Patched to compile on non-C99 Microsoft compiler. 2013-10-20 16:02:24 -04:00
Ryan C. Gordon
a614f18666 Patched to compile on Windows. 2013-10-20 16:01:10 -04:00
Ryan C. Gordon
b285b60092 Allow XInput haptics to run for SDL_HAPTIC_INFINITY time (thanks, Mitchell!).
Partially fixes Bugzilla #2126.
2013-10-20 15:55:47 -04:00
Ryan C. Gordon
6e1169ddc2 Fixed goofy logic in haptic device comparison code.
Mitchell Keith Bloch did the research on this bug, and came up with a slightly
 different patch than this.

Partially fixes Bugzilla #2126.
2013-10-20 15:49:52 -04:00
Ryan C. Gordon
54dce3f53a Don't bother calling SDL_SYS_HapticEffectType() at all for XInput devices. 2013-10-20 15:45:48 -04:00
Ryan C. Gordon
5e74299a83 Fix adding of XInput devices (thanks, Mitchell!)
Partially fixes Bugzilla #2126.
2013-10-20 15:40:20 -04:00
Sam Lantinga
ade13fd741 It's okay to quit things more than once. 2013-10-20 10:39:26 -07:00
Sam Lantinga
20f5167d27 Use vertex arrays for drawing points in addition to lines 2013-10-20 10:35:51 -07:00
Sam Lantinga
82b8e6df87 Fixed bug 2158 - Pixel missing in SDL_RenderDrawLines
Sean McKean

I am running Ubuntu 12.04 (GL version 1.4 Mesa 8.0.4) , and on drawing a set of lines through the renderer through SDL_RenderDrawLines() (looped or not) or SDL_RenderDrawRect() I notice a pixel missing. For RenderDrawLines() it seems to be the second point in the sequence; for RenderDrawRect() it is the lower-right. This can be fixed by specifying SDL_RenderDrawPoint(s), but wouldn't it be easier to specify each pixel in a GL_POINTS glBegin/End loop in the OpenGL code, just to make sure?

I also ran the same program on Android; the rendering seemed to be correct, which uses glDrawArrays.
2013-10-20 10:10:14 -07:00
Sam Lantinga
a25b51923a Fixed compiling with the new X11 symbol wrapping 2013-10-20 09:58:37 -07:00
Stefanos Apostolopoulos
6a3478c235 Fix bug 1300 by querying current border size in ConfigureNotify, and adjusting window coordinates accordingly. 2013-10-20 17:23:43 +02:00
Sam Lantinga
e343273abb Fixed bug 2162 - SDL_RenderClear not clearing entire render target
Kevin Wells

Overview:
SDL_RenderClear is only clearing part of a texture when it is the render target and a different size than the screen.

Steps to Reproduce:
1) This only occurs with the render driver set to direct3d, so: SDL_SetHint(SDL_HINT_RENDER_DRIVER,"direct3d")
Also, my window was 1280x720.

2) Create a texture for a render target with a resolution of 1024x1024:
texture=SDL_CreateTexture(main_window.renderer,SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET,1024,1024);
SDL_SetTextureBlendMode(texture,SDL_BLENDMODE_BLEND);

3) Target the texture for rendering: SDL_SetRenderTarget(main_window.renderer,texture);

4) Set the draw color to whatever you want (problem occurs with both 0,0,0,0 and 0,0,0,255 among others) and then clear the render target:
SDL_SetRenderDrawColor(main_window.renderer,0,0,0,0);
SDL_RenderClear(main_window.renderer);

Actual Results:
Only about the top 3/4s of the texture gets cleared on calling SDL_RenderClear. The bottom 1/4 or so does not clear.

Expected Results:
Entire render target should be cleared.
2013-10-19 01:29:23 -07:00
Ryan C. Gordon
b4a00144fb Fixed the XInput2 X11 symbols. 2013-10-18 10:56:45 -04:00
Sam Lantinga
379c0054dc Fixed bug 2123 - SDL_BlitScaled crashes in src/video/SDL_blit_N.c:2145
We need to reset the blit function when switching between scaled and unscaled blits.
2013-10-18 00:47:22 -07:00
Sam Lantinga
a329c7f1c9 Fixed bug 2139 - SDL_CreateWindow/WIN_GL_LoadLibrary fails due to external iconv not being able to convert path
J?nis R?cis

Brief history:

We recently ported a game from SDL 1.2 to SDL 2. While doing Windows testing, I soon discovered that the game exits without opening a window with my cross-compiled SDL2.dll, but works great with the SDL2.dll from the MinGW SDK on libsdl.org. It was as simple as swapping out the DLLs to make it work.

Running the game in Wine showed that the game actually does run, up until the call to SDL_CreateWindow, which fails and leads the game to print out an error:

Failure to create window (LoadLibrary("OPENGL32.DLL"): (null))

Which basically says that there was no error, but maybe that's a Wine quirk.

The error string originates in SDL_windowsopengl.c, in WIN_GL_LoadLibrary, which contains this piece of code:

    wpath = WIN_UTF8ToString(path);
    _this->gl_config.dll_handle = LoadLibrary(wpath);
    SDL_free(wpath);
    if (!_this->gl_config.dll_handle) {
        char message[1024];
        SDL_snprintf(message, SDL_arraysize(message), "LoadLibrary(\"%s\")",
                     path);
        return WIN_SetError(message);
    }

After some digging, I discovered the culprit: WIN_UTF8ToString returns NULL. Why? Because it calls iconv_open from an iconv.dll that does not support the UCS-2-INTERNAL encoding. Why does the official SDL2.dll work? Because it calls no external iconv functions at all.

It turns out that the Fedora MinGW infrastructure (from which I obtained the conventiently prebuilt iconv.dll) does not provide a DLL from libiconv, but instead provides a DLL from a minimal Windows library called win-iconv. Which knows a good bit, but doesn't know anything about UCS-2-INTERNAL:

http://code.google.com/p/win-iconv/source/browse/trunk/win_iconv.c#155

So there are two problems here:

1) The error message is clearly useless, because LoadLibrary is an innocent bystander. Instead wpath should probably checked for NULL, and a more appropriate error should be set. Ideally something that makes it clear than an external iconv is causing trouble.
2) SDL doomed itself at the ./configure step, by finding an existing iconv and happily using it without confirming support for the mandatory encodings required by SDL.

There are certainly a few easy ways out of the situation (although I didn't yet manage to figure out how to prevent ./configure from looking for external iconv), but this had me completely stomped for a good while, so I figured it's worth writing down if anything.

(Search also found this, which talks a little about using UTF-16LE instead of UCS-2-INTERNAL: https://bugzilla.libsdl.org/show_bug.cgi?id=2075)
2013-10-18 00:13:51 -07:00
Sam Lantinga
7ad441a37c Fixed bug 2069 - Device addition/removal queries all USB devices rather than only HID devices.
Andreas Ertelt
SDL_dxjoystick.c is setting the classguid for device (dis)connect events to USB Devices in general:
    dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;

Wouldn't it make more sense to have it just subscribe to Hid device events? This would mean less meaningless events reaching the application.
2013-10-17 23:40:13 -07:00
Sam Lantinga
3f8df1097c Fixed 1598 - Mingwin build fails on src/audio/xaudio2/SDL_xaudio2.c 2013-10-17 23:15:27 -07:00
Sam Lantinga
888d807a71 Removed redundant #ifdef 2013-10-17 23:05:40 -07:00
Sam Lantinga
12ca3ce3fa Fixed building using MinGW
Our SDL_windows.h needed to be included before anything else so UNICODE is defined.
2013-10-17 23:02:29 -07:00
Ryan C. Gordon
a2bd897064 Don't supply duplicate X11 symbols inside SDL.
Fixes static linking when something else also uses X11.
2013-10-18 01:36:41 -04:00
Sam Lantinga
95dc9940a2 Fix to unbreak SDL_GetSystemRAM() on FreeBSD
Marcus von Appen

Revision eecbcfed77c9 of the SDL hg repo introduces the new
SDL_GetSystemRAM() function, which breaks the build on FreeBSD. Find
attached a patch, which unbreaks the build and also should (for most
cases) properly implement the sysctl support it.
2013-10-17 20:49:30 -07:00
Sam Lantinga
14e13e13c4 Fixed compiler warning if dynamic X11 loading isn't enabled. 2013-10-17 17:38:55 -07:00
Sam Lantinga
7db31223e6 Fixed using the wrong variable when reporting a missing SDL scancode mapping. 2013-10-17 17:37:23 -07:00
Sam Lantinga
2e6b4b960d Fixed compiling on Mac OS X, added a system RAM test 2013-10-17 11:56:33 -07:00
Sam Lantinga
852004a22a The _SC_PHYS_PAGES method of calculating RAM works on Linux. 2013-10-17 11:32:14 -07:00
Sam Lantinga
8b79cbadef Added an API to get the amount of system RAM 2013-10-17 11:32:56 -07:00
Sam Lantinga
6435a82d08 Backed out revision fb5ab0e91c56, the platform specific messagebox functions don't have the right prototype since they're designed to be used standalone. 2013-10-14 09:12:30 -07:00
Sam Lantinga
4b603abfd7 For some reason, trying to raise the window programmatically while it's alt-tabbed away will minimize it. Added a workaround for this. 2013-10-14 08:56:55 -07:00
Sam Lantinga
fea2699c25 Fixed the windows message debug output so it works without HAVE_LIBC 2013-10-14 08:56:50 -07:00
Sam Lantinga
06cab8575e Added support for SDL_PIXELFORMAT_UYVY surfaces on Mac OS X 2013-10-14 08:56:37 -07:00
Sam Lantinga
8ec3ba3829 Fixed accumulating mouse wheel motion for the Microsoft Wireless Mouse 5000 2013-10-13 19:59:40 -07:00
Sam Lantinga
a7b2db05cd Added an assert to catch init/quit call mismatch that might bite people. 2013-10-13 19:48:45 -07:00
Gabriel Jacobo
e9d2133934 Prevent keystrokes from leaking through to the console when using evdev.
This uses the same method Weston and X use. Sadly, to be fully effective when
launching remotely, this needs root permissions.
2013-10-13 17:15:43 -03:00
Gabriel Jacobo
074a1c4c63 Fixes X11 video backend compilation when no GL is available
For example, in our Raspberry Pi sysroot.
2013-10-12 16:29:34 -03:00
Sam Lantinga
a7e1fdddea Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
Sam Lantinga
15682c0c5f Report joystick added/removed events even if we don't have udev.
T. Joseph Carter

As discussed (possibly to death), the Linux joystick driver does not actually report events for added or removed joysticks when you haven't got udev support.

We simply cannot know about removed joysticks without udev.  But we can (and we should) report adding them.  This brings the legacy case in line with pretty much the rest of SDL's joystick drivers.
2013-10-10 20:58:20 -07:00
J?rgen P. Tjern?
2568a367c8 Mac: Better handling when someone else is the app delegate. 2013-10-07 16:01:40 -07:00
Ryan C. Gordon
f7e0a9b2b0 Patched to compile in C90 mode. 2013-10-10 02:21:41 -04:00
Gabriel Jacobo
89131435f8 Adds gl_profile_mask to test framework, uses it in testgles 2013-10-10 00:49:57 -03:00
Gabriel Jacobo
d0fddfab84 Fixes Bug 2134 - [Android] Black screen after resume (sometimes) 2013-10-10 00:30:03 -03:00
J?rgen P. Tjern?
c455f7291c Fix SDL_SetWindowPosition on fullscreen windows.
This reverts http://hg.libsdl.org/SDL/rev/7cdeb64faa72 and fixes it in
the correct way. If you call SDL_SetWindowPosition on a fullscreen
window, it would update the x & y variables for the window, but not
actually move the window (since it was fullscreen). That would make the
internal state of the SDL_Window incorrect, causing
SDL_WarpMouseInWindow to offset incorrectly.

This makes it so SDL_SetWindowPosition updates the `windowed' x & y
coordinates, which take effect when you revert from fullscreen.
2013-10-07 14:16:38 -07:00
Sam Lantinga
cca094225a Only allocate a joystick instance ID once we know it's a joystick.
This fixes compatibility with code that assumes 0 based joystick instance IDs.
2013-10-06 20:39:23 -07:00
Sam Lantinga
11c45c4ede Removed unused variables (thanks Joseph!) 2013-10-06 13:50:36 -07:00
Sam Lantinga
8f46bcfd6d Check for NULL joystick in SDL_JoystickGetGUID() 2013-10-06 13:49:23 -07:00
Sam Lantinga
90a219a375 Fixed bug where a Logitech wireless keyboard with built-in mouse touchpad didn't get recongized as both devices. 2013-10-05 21:15:55 -07:00
Sam Lantinga
529664278f Fixed bug 2132 - Tests may use invalid SDL_window pointers when windows are closed
norfanin

Some of the tests keep using the pointers of a destroyed SDL_Window when the common event handling handled the close event. The event handler itself does not NULL the pointer after the destruction.

The attached patch adds a loop in the handler that will assign NULL to the destroyed window. It also adds checks to some of the tests so they skip those windows by checking for NULL.
2013-10-05 19:09:03 -07:00
Philipp Wiesemann
0db36f51aa Added detection of touch devices before first touch events happen on Android.
On Android available touch devices are now added with video initialization (like
the keyboard). This fixes SDL_GetNumTouchDevices() returning 0 before any touch
events happened although there is a touch screen available. The adding of touch
devices after a touch event was received is still active to allow connecting
devices later (if this is possible) and to provide a fallback if the new init
did not work somehow. For the implementation JNI was used and API level 9 is
required. There seems to be nothing in the Android NDK's input header (input.h)
to implement everything on C side without communication with Java side.
2013-10-05 17:08:19 +02:00
Sam Lantinga
36b759174f Do a 32-bit compare on RGBA values. Thsi should be inlined in optimized builds. 2013-10-05 12:29:05 -07:00
Ryan C. Gordon
5607cc45c5 Avoid redundant state changes in the GLES2 renderer. 2013-10-05 00:29:57 -04:00
Ryan C. Gordon
500e4f6f9a Removed "u_colorTable" uniform from the GLES2 renderer. It's not used anywhere. 2013-10-04 11:25:14 -04:00
Gabriel Jacobo
9c489c7c0d Fix EGL/OpenGL ES paths 2013-10-04 08:23:37 -03:00
Sam Lantinga
509898460c Added optional error checking for OpenGL ES 2.0 in the same style as the OpenGL renderer.
You can enable it like this: SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
2013-10-03 20:48:52 -07:00
Sam Lantinga
e5ef978e13 Fixed a potential double-free bug if glGenTextures() failed. 2013-10-03 20:42:43 -07:00
Gabriel Jacobo
b39a4daf04 SDL_TEXTINPUT support for EVDEV 2013-10-03 10:28:10 -03:00
Sam Lantinga
1f21484bdd Fixed const/non-const warning 2013-10-03 03:31:05 -07:00
Sam Lantinga
1df1e69691 Added the platform specific messagebox function to the video function list 2013-07-14 11:28:44 -07:00
Sam Lantinga
8fbd7dc735 Fixed bug 2130 - Two members of Windows WindowData not initialized
norfanin

SetupWindowData in SDL_windowswindow.c doesn't initialize two members of SDL_WindowData with NULL. This is an issue because other parts of the SDL code seem to make the assumption that this is the case. WIN_DestroyWindowFramebuffer for example uses data->mdc and data->hbm if they're not NULL.
2013-10-03 00:54:58 -07:00
Ryan C. Gordon
ce45fa28e2 SDLK_DELETE should probably be SDLK_BACKSPACE on iOS.
The key on the software keyboard works like backspace, at least. Not sure
 what happens with a bluetooth keyboard here.
2013-10-02 22:18:04 -04:00
Ryan C. Gordon
958640e5d1 Get rid of glGetError() calls in GLES2 renderer.
It's not usually useful, and it causes pipeline stalls.
2013-10-02 22:16:11 -04:00
Gabriel Jacobo
57e09318dd Uses SDL_UDEV for Linux joystick hotplugging 2013-10-01 08:47:06 -03:00
Sam Lantinga
69a4351eb0 Fixed bug 2121 - GCC throws error on SDL_FORCE_INLINE when compiling with -ansi 2013-09-30 22:35:32 -07:00
Sam Lantinga
22a972a440 Fixed bug 2122 - SDL_CreateTexture allows illegal texture sizes
Lloyd Bryant

SDL_CreateTexture() is succeeding (i.e. returning a valid pointer) when the requested horizontal or vertical size of the texture exceeds the maximum allowed by the render.  This results in hard-to-understand errors showing up when later attempting to use that texture (such as with SDL_SetRenderTarget()).
2013-09-30 22:16:14 -07:00
Gabriel Jacobo
889b6bd794 Removes unused property use_egl from internal structure gl_config 2013-09-28 19:23:59 -03:00
Gabriel Jacobo
c691de00c5 Fix: SDL_EVDEV_device_removed does not need UDEV 2013-09-28 19:17:27 -03:00
Sam Lantinga
202528a48f Call AddRef() on the device so it doesn't accidentally get released from underneath the caller. 2013-09-28 14:07:17 -07:00
Sam Lantinga
25f607a3c2 Make it clear we're just returning a D3D9 device, allowing for new functions to get other D3D versions 2013-09-28 14:07:14 -07:00
Sam Lantinga
cf5e5a8360 Added a hint to create the D3D device in thread-safe mode: SDL_HINT_RENDER_DIRECT3D_THREADSAFE 2013-09-28 14:07:08 -07:00
Sam Lantinga
803965bcc2 Added platform specific call: SDL_RenderGetD3DDevice() 2013-09-28 14:07:05 -07:00
Sam Lantinga
9f390e7967 Moved SDL_Direct3D9GetAdapterIndex() to SDL_windowsvideo.c since it doesn't belong in the window code. 2013-09-28 14:06:59 -07:00
Sam Lantinga
89c31bb42a Implemented SDL_UpdateYUVTexture() for Direct3D 2013-09-28 14:06:55 -07:00
Sam Lantinga
17c9ff85e2 Added missing SDL_assert.h 2013-09-28 14:06:51 -07:00
Sam Lantinga
57bd514707 Added optimized YUV texture upload path with SDL_UpdateYUVTexture() 2013-09-28 14:06:47 -07:00
Sam Lantinga
d0a57ea2b5 Rolled back my LoadLibrary change. The first failed call causes a dialog to pop up in Windows apps (but not console apps) and that's really bad. I'll have to deal with this in my app. 2013-09-28 14:06:39 -07:00
Sam Lantinga
dfa53e7e3c SDL_LoadObject on Windows now calls LoadLibrary a second time in its EX form whenever the first load fails. This second call uses the "altered" search path for DLL dependencies, which includes searching the directory that the DLL itself lives in. 2013-09-28 14:06:31 -07:00
Sam Lantinga
b6be1435c5 Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Added a reference to SDL_Direct3D9GetAdapterIndex to SDL_test_common.c so SDL will fail to compile if the new symbol isn't included properly.

CR: Jorgen
2013-09-28 14:06:20 -07:00
Gabriel Jacobo
1ccbad9603 Do not use UDEV references in EVDEV if UDEV has not been detected 2013-09-28 15:48:32 -03:00
Gabriel Jacobo
9ceed73db4 Raspberry Pi support (also unified UDEV and EVDEV support) 2013-09-28 13:28:19 -03:00
Philipp Wiesemann
90afb94ec6 Corrected name of SDL_Color field from unused to a. 2013-09-28 12:48:26 +02:00
Sam Lantinga
8b6ad7ffba Fixed bug 2101 - CWBackPixel causes weird window flickering on window resize
aBothe

I tried to experiment a bit with SDL2 and OpenGL today and noticed that something caused some weird flickering when resizing my nicely drawn SDL2/OpenGL window:
Just after resizing, the background went black and I had to let my OpenGL code redraw the contents..
However, after some hours spent with googling I found out that in OpenGL examples where this CWBackPixel flag was not used when creating X windows, there was no flickering while resizing the window.

See http://www.sbin.org/doc/Xlib/chapt_04.html @ "The Window Background" for more info.
2013-09-27 23:47:57 -07:00
Sam Lantinga
b9567776d7 # User Darren Salt <devspam@moreofthesa.me.uk>
# Date 1379621782 -3600
#      Thu Sep 19 21:16:22 2013 +0100
Work around a false-positive in the X11 mouse wheel code

This false positive occurs when one particular button on my mouse is
pressed. The kernel which I'm using is patched to cause a release event to
be synthesised immediately when the mouse says that this button is pressed
because the mouse doesn't signal release until the button is next pressed.

(Also documents a false negative, observed with the horizontal scroll wheel
on the same mouse.)
2013-09-27 23:35:17 -07:00
Sam Lantinga
c95761e00a Fixed bug 2100 - directfb fails to build 2013-09-27 23:29:05 -07:00
Edward Rudd
869a707612 add in High DPI support (aka Retina)
- based on J?rgen's patch with a few bug fixes
2013-09-20 13:43:00 -04:00
Sam Lantinga
0103bc0bff Default to OpenGL ES 2.0 instead of 1.0 when it's available. 2013-09-27 22:09:51 -07:00
Sam Lantinga
d3d6f9ad19 Fixed syntax error in C style block comment. 2013-09-14 11:25:52 -07:00
Ryan C. Gordon
bfe1b1d066 Don't incorrectly report success for negative swap intervals on Mac OS X. 2013-09-14 01:30:57 -04:00
Sam Lantinga
fae4190dca Added SDL_Direct3D9GetAdapterIndex(), which returns the adapter index you would pass into CreateDevice to get your device on the right monitor in full screen mode. This fixes the default adapter in SDL_render_d3d.c, which means that tests will work fullscreen off the main monitor now.
CR: Sam
2013-09-13 17:42:46 -07:00
Sam Lantinga
49d64d52d5 Fix X11_RestoreWindow() and X11_RaiseWindow() to properly do window activation.
X11_RestoreWindow() had a call ordering problem that prevented activation, and X11_RaiseWindow() wasn't attempting activation. Windows and OS X both activate in these cases.

CR: saml
2013-09-13 17:42:38 -07:00
Sam Lantinga
67c02a282a Mac: Translate Ctrl-Left click to right click. 2013-09-13 17:42:31 -07:00
Sam Lantinga
e231d5b450 Mac: Turn off momentum-based scrolling. 2013-09-13 17:41:17 -07:00
Sam Lantinga
37509cf3e3 Mac: Fix cast warning. 2013-09-13 17:40:41 -07:00
pgriffais
a9166450f4 [SDL] X11+GL: Allow Visual override for GL windows.
SDL provides an SDL_VIDEO_X11_VISUALID environment variable that lets you override
window visuals, but it wasn't being checked for OpenGL windows.

CR: Sam.
2013-09-10 18:25:13 -07:00
Ryan C. Gordon
83383c6527 Disable thread naming on Win64 for now.
We can't use _try/_except without the C runtime, and we can't use inline
 asm with the Win64 compiler. We'll need to move this to an .asm file or
 something later.
2013-09-07 13:47:14 -04:00
Sam Lantinga
dc9ddf1f61 Fixed bug 2090 - Some joystick inputs are delayed on FreeBSD
kikuchan

Some joysticks with high sampling rate need to be read() more fast,
otherwise it delay user inputs due to internal queue.
Especially, an app that issues SDL_PollEvent() not so frequent
2013-09-06 20:54:14 -07:00
Sam Lantinga
10ffa28a28 Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time. 2013-09-06 20:45:08 -07:00
J?rgen P. Tjern?
f06eeb013b Fix to buffer overrun in SDL_JoystickGetGUIDString(). 2013-09-05 15:49:57 -07:00
Sam Lantinga
4b942c5a07 Fixed bug 2076 - OpenGL doesn't work with --disable-threads
stepik-777

Thread local storage is used to store current window and current opengl context. OpenGL worked before this changeset: 7596 (45e5c263c096)
2013-09-05 07:15:26 -07:00
Sam Lantinga
cefffd618f Fixed bug 2082 - SDL stdlib implementation does not force upper case for %X format specifier
norfanin

When SDL_vsnprintf handles the %x format specifier, a boolean is set to signal forced lower case. It also should be able to signal forced upper case for the %X specifier. A boolean is not sufficient anymore. The attached patch adds an enum for the three cases: lower, upper and no change.
2013-09-05 06:59:34 -07:00
Sam Lantinga
48aca0b2df Fixed bug 2084 - SDL_log xxx on Android outputs to Logcat with incorrect priority.
Pallav Nawani

This effects all SDL_Logxxx functions. On android, the debug output has a priority that is 1 higher than intended, ie, if you try SDL_LogInfo, the log has the priority of Warn instead.
2013-09-05 06:43:34 -07:00
Ryan C. Gordon
b63d11ce9c The SDL_PixelFormat* passed to SDL_ConvertSurface() should be const. 2013-09-04 23:40:11 -04:00
Ryan C. Gordon
2bafbedac7 Enabled thread naming on Windows.
This is now done without compiler or C runtime support for __try/__except.

(Granted, it uses Visual Studio-style inline asm, but still...)
2013-08-31 01:36:38 -04:00
Gabriel Jacobo
ace1e98a18 Fixes bug #2040, prepare SDL_GL_CONTEXT_EGL for deprecation on v2.1
SDL_GL_CONTEXT_EGL = 1 is now internally treated as profile_mask = SDL_GL_CONTEXT_PROFILE_ES
2013-08-29 15:02:32 -03:00
Gabriel Jacobo
eec4710c53 Fixes bug #2074 - Thanks Sylvain!
SDL_syssem.c:159 comparison of unsigned expression >= 0 is always true
Solved by comparing unsigneds directly

SDL_systimer.c:164: warning: control may reach end of Compile
Solved by returning the default value if all else fails.

SDL_androidgl.c:41:1: warning: type specifier missing, defaults to 'int'
SDL_androidgl.c:47:1: warning: control reaches end of non-void function
Solved by adding void return type to the function implementation
2013-08-29 14:03:44 -03:00
Sam Lantinga
e07d7e649c Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)). 2013-08-29 08:30:21 -07:00
Sam Lantinga
3e2930defe Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x) 2013-08-29 08:29:51 -07:00
Sam Lantinga
f79fc33a39 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Sam Lantinga
1d2c7796ae Christoph Mallon: Correct indendation. 2013-08-29 08:27:25 -07:00
Sam Lantinga
7267ea8f8b Christoph Mallon: Use SDL_arraysize() 2013-08-29 08:26:55 -07:00
Sam Lantinga
9e23d17869 Christoph Mallon: Simplify assignment. 2013-08-29 08:26:24 -07:00
Sam Lantinga
67c10169ee Christoph Mallon: Report an error, if creating the directories in SDL_GetPrefPath() failed. 2013-08-29 08:25:54 -07:00
Sam Lantinga
db7c92b4b4 Christoph Mallon: Remove lone /* if */ comment. 2013-08-29 08:25:24 -07:00
Sam Lantinga
321aa4ae10 Christoph Mallon: Simplify avoidance of duplicate / in SDL_GetPrefPath() 2013-08-29 08:24:43 -07:00
Ryan C. Gordon
257cef3024 Change order we enumerate Windows joysticks.
Make it so XInput devices are listed before DirectInput devices, and that the XInput
 devices are sorted by userid in ascending numeric order (so device 0 comes first).
2013-08-28 22:09:17 -04:00
Ryan C. Gordon
ea4350d821 Don't corrupt XInput device state during SDL_SYS_JoystickClose(). 2013-08-28 22:07:54 -04:00
Ryan C. Gordon
2538d31140 Fix endlines for logging via OutputDebugString(). 2013-08-28 22:05:16 -04:00
Ryan C. Gordon
aa65211486 Make XInput joystick names match the numbers on the device.
(And how the Haptic code already names them.)
2013-08-28 17:17:21 -04:00
Ryan C. Gordon
7949989884 Fixed comment typo. 2013-08-28 17:12:07 -04:00
Ryan C. Gordon
4b255c63f1 Reworked XInput and DirectInput joystick code.
Now multiple XInput controllers map correctly to device indexes instead of grabbing
the first available userid, and are completely separated out from DirectInput.

Also, the hardcoded limitation on number of DirectInput devices is gone. I don't
expect there to really ever be more than eight joysticks plugged into a machine, but
it was a leftover limitation for a static array we didn't actually use anymore.

Fixes Bugzilla #1984. (etc?)
2013-08-28 16:43:47 -04:00
Ryan C. Gordon
c89e04694d Better XInput detection code for DirectInput device enumeration.
This code is way faster than the Wbem code, and less ugly.
2013-08-28 16:35:32 -04:00
Gabriel Jacobo
ad20c801cb Fixes typo in EGL code (thanks jmcfarlane!) 2013-08-26 14:23:18 -03:00
Ryan C. Gordon
2abe45e8cb Removed obvious comment to trigger buildbot. 2013-08-25 21:28:03 -04:00
Edward Rudd
833fd30eb8 reworked GetBasePath on OS X to use Contents/Resource by default if bundled, or exedir if not bundled.
- also adds OS X specific magic for bundled apps adding an Info.plist property of name SDL_FILESYSTEM_BASE_DIR_TYPE to the following values will change the bahaviour.
* bundle -- use the bundle directory e.g. "/Applications/MyGame/Blah.app/"
* parent -- use the bundle parent directory e.g. "/Applications/MyGame/"
* resource -- use the bundle resource directory (default) e.g. "/Applications/MyGame/Blah.app/Contents/Resources/"
2013-08-25 11:24:01 -04:00
Gabriel Jacobo
64e6eeac7f Fixes "error: conflicting types for 'GLintptr'" 2013-08-25 11:48:49 -03:00
Ryan C. Gordon
c9c6852f84 Minor FreeBSD code cleanup. 2013-08-24 21:15:10 -04:00
Edward Rudd
e5b65e4e03 Fix #2062 Be more diligent about validating trailing "/" existence in HOME and XDG_DATA_HOME env vars 2013-08-24 09:05:18 -04:00
Ryan C. Gordon
58a558e326 Patched to compile on Solaris. 2013-08-23 23:34:23 -04:00
Ryan C. Gordon
88cd94a0eb Patched to compile on FreeBSD. 2013-08-23 21:48:40 -04:00
Ryan C. Gordon
97948aef66 Add support for some BSDs and Solaris to SDL_GetBasePath(). 2013-08-23 21:38:54 -04:00
Gabriel Jacobo
f60bcf8b50 Fix warning in GL ES2 renderer 2013-08-22 17:26:22 -03:00
Ryan C. Gordon
faf760d203 XAudio2/DirectSound: Use the usual Windows string convert (thanks, Norfanin!). 2013-08-22 13:32:27 -04:00
Sam Lantinga
cd27a1ef05 Fixed compiling on old versions of the DirectX SDK 2013-08-21 12:12:04 -07:00