Commit Graph

3196 Commits

Author SHA1 Message Date
Sam Lantinga
1fb69dd258 Fixed bug 1303 - SDL_CreateFromWindow duplicates window (Cocoa only)
Jens Köhler 2011-09-09 04:47:40 PDT

When calling SDL_CreateWindowFrom with a NSWindow which already contains a
NSView, the window will be duplicated because another NSView is added. I
attached a possible fix that prevents the creation of a second NSView.
2012-01-08 00:39:41 -05:00
Sam Lantinga
6a8e36cc7c Fixed bug 1305 - mouse wheel scroll-down event created when mouse wheel is pressed down
Martin Schreiber 2011-09-15 06:08:38 PDT

patch attached
2012-01-08 00:36:32 -05:00
Sam Lantinga
61a5c56022 The #define was asking to use dlopen(), but the code wasn't doing it.
Also added error message in case the library open failed in that case.
2012-01-07 21:02:39 -08:00
Sam Lantinga
ccc2bea519 Fixed crash if the rendering system couldn't create an OpenGL window. 2012-01-07 21:01:33 -08:00
Sam Lantinga
4e16ca7daf Fixed bug 1313 - Segfault on SDL_CreateWindow when gl lib cannot be loaded
Don't crash if the gl_data isn't valid, just return NULL.
2012-01-07 23:33:15 -05:00
Sam Lantinga
79ef2d54f2 Fixed bug 1333 - segfault if opengl window could not get created
When the window couldn't be created, the normal window destruction process happens, which among other things, destroys the framebuffer, if any.
2012-01-07 22:52:41 -05:00
Sam Lantinga
305531d766 Fixed bug 1342 - SDL_CreateRenderer creates OpenGL ES 2.0 renderer in iPhone 3G using default index (-1)
The uikit code wasn't checking to make sure the context was successfully created.
2012-01-07 22:34:51 -05:00
Sam Lantinga
da31e3d3e3 Fixed tab spacing 2012-01-07 22:33:58 -05:00
Sam Lantinga
af8d572022 Better error messaging when SDL can't create a window surface. 2012-01-07 14:21:22 -05:00
Sam Lantinga
f4231277fb Fixed bug 1256 - Invalid window warning in GL_CreateRenderer
Martin Gerhardy 2011-07-27 02:26:06 PDT
the window reference is lost in the GL_CreateRenderer function. The attached
patch should fix this error.

#0  SDLSystem_LogOutputFunction (userdata=0x63b010, category=1,
priority=SDL_LOG_PRIORITY_ERROR, message=0x7fffffffcd00 "Invalid window") at
src/system/sdl/SDLSystem.cpp:8
#1  0x00007ffff7b1ddb3 in SDL_LogMessageV (category=1,
priority=SDL_LOG_PRIORITY_ERROR, fmt=<value optimized out>, ap=<value optimized
out>) at src/SDL_log.c:275
#2  0x00007ffff7b1df7c in SDL_LogError (category=<value optimized out>,
fmt=<value optimized out>) at src/SDL_log.c:212
#3  0x00007ffff7b1d582 in SDL_SetError (fmt=0x7ffff7baaff0 "") at
src/SDL_error.c:111
#4  0x00007ffff7b96f9e in SDL_GL_MakeCurrent (window=0x0, ctx=0xa62ce0) at
src/video/SDL_video.c:2484
#5  0x00007ffff7b4ba0c in GL_ActivateRenderer (renderer=0xa8f680) at
src/render/opengl/SDL_render_gl.c:195
#6  0x00007ffff7b4c59a in GL_ResetState (window=0x918010, flags=<value
optimized out>) at src/render/opengl/SDL_render_gl.c:214
#7  GL_CreateRenderer (window=0x918010, flags=<value optimized out>) at
src/render/opengl/SDL_render_gl.c:343
#8  0x00007ffff7b48053 in SDL_CreateRenderer (window=0x918010, index=<value
optimized out>, flags=2) at src/render/SDL_render.c:166
2012-01-07 02:32:08 -05:00
Sam Lantinga
52890102d8 Added X11 dynamic loading support for XSetWMProperties() 2012-01-07 02:04:38 -05:00
Marco Trevisan (Treviño)
5706675b0d X11: Move to XSetWMProperties and add support to _NET_WM_PID
Use the convenience function XSetWMProperties to set size, input
and class hints, it also automatically sets the WM_CLIENT_MACHINE
(this one needed by _NET_WM_PID) and WM_LOCALE_NAME windows hints.

Plus we add support to the _NET_WM_PID atom which is needed by many
windows managers to correctly associate a SDL window to its process
and to related .desktop file and icon for the given host.
2011-06-27 19:30:52 +02:00
Sam Lantinga
9d5094c3d3 Fixed bug 1224 - Blit map not updated if source palette changed
bastien.bouclet@gmail.com 2011-06-12 11:08:58 PDT

SDL_LowerBlit doesn't update the blit color map if the source surface has
changed.

A proposed fix is attached, storing the source palette version in the color
map.
2012-01-07 01:28:06 -05:00
Sam Lantinga
8dcf899fca Fixed bug 1225 - Altivec blitters broken due to SDL_PixelFormat
bastien.bouclet@gmail.com 2011-06-13 05:50:58 PDT

Static pixel format initialization has not been updated to reflect header
changes in SDL_blit_N.c

The attached patch fixes Altivec support for me. altivec.h is needed for some
systems.
2012-01-07 01:25:55 -05:00
Sam Lantinga
d85a5d0c78 Fixed bug 1239 - Crash in iPad with iOS 3.2 because of missing contentScaleFactor support
Joseba García Echebarria 2011-06-30 19:03:56 PDT
I just found that SDL is crashing in the iPad simulator for iOS 3.2 but not for
iOS 4.2 or over when compiling with Xcode 4.0.2.
The Xcode debugger points to line 127 in video/uikit/SDL_uikitopenglview.m as
the line that triggers the crash.
On those lines one can find:

        /* Use the main screen scale (for retina display support) */
        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
                self.contentScaleFactor = [UIScreen mainScreen].scale;

I believe the problem to be that the "scale" selector is supported in iOS 3.2
in the iPad, but contentScaleFactor is not.
I'm no expert in Objective-C, but I believe the following code to be more
correct (it doesn't crash for me):
        /* Use the main screen scale (for retina display support) */
        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] &&
[self respondsToSelector:@selector(contentScaleFactor)])
                self.contentScaleFactor = [UIScreen mainScreen].scale;

The same check is being performed in line 155 so I imagine it will crash there,
too.

Vittorio Giovara 2011-08-22 17:58:20 PDT

yeah, -scale was introduced in 3.2 but made available only in 4.0, weird
anyways we just need to check against contentScaleFactor as we can be sure that
both are availble starting from 4.0

the attached patch addresses this
2012-01-07 01:21:50 -05:00
Sam Lantinga
caf36db44a Fixed bug 1344 - No OpenGL headers when compiling -> no working Software renderer at runtime neither
Make sure we have at least one render driver.
2012-01-07 01:13:15 -05:00
Sam Lantinga
a13eb5857b Fixed bug 1362 - SDL Fails to compile with Visual C++ Express 2008 with Feb 2007 DirectX SDK
Pallav Nawani 2012-01-04 00:48:29 PST
Issue:
Attempted to compile SDL as a static library.

DirectX SDK: Feb 2007
OS: Win 7
Visual C++ Express 2008
Compliation Mode: Static (Changed project settings from dll to lib)

Error:
C1021: invalid preprocessor command 'warning'

It seems that the #warning directive does not exist in Vc++ Express 2008.
2012-01-07 00:57:24 -05:00
Ryan C. Gordon
db8ac79a37 Use arts_suspend() in a loop to wait for arts to become ready.
(Transplanted from hg changeset 331f27f01cdb to the 1.3 branch.)
2012-01-02 15:16:45 -05:00
Sam Lantinga
d99f25b2dd Fixed bug 1337 - joystick crash due to heap corruption with btnx 2012-01-01 16:58:00 -05:00
Sam Lantinga
1942221a6f Check return value, not unsigned "supported" flags 2011-12-31 13:28:07 -05:00
Sam Lantinga
e256711bb9 Happy New Year! 2011-12-31 09:28:07 -05:00
Sam Lantinga
41ea58b0ef Added the ability to update a subrect of a YV12/IYUV texture. 2011-12-30 18:19:35 -05:00
Sam Lantinga
e60d18d093 Fixed bug 1315 - Greenish video when video size smaller than texture
The incoming pixels are contiguous for the update rectangle.
2011-12-30 18:18:42 -05:00
Sam Lantinga
a816157cb4 Initialize timers first so the tick counter is valid by the time the audio and video systems initialize. 2011-12-30 06:41:41 -05:00
Sam Lantinga
6b53a98d93 Fixed bug 1338 - Direct3D renderer should set D3DCREATE_FPU_PRESERVE for not behaving vastly different on doubles (causes 3rd party lib crashes!)
Jonas Thiem 2011-11-29 12:28:02 PST
Direct3D renderer should set D3DCREATE_FPU_PRESERVE for not behaving vastly
different to OpenGL/software rendering on doubles and break some libraries
really badly.

Most notable affected example: Lua, which does the most unpredictable things
which are really almost impossible to debug/find out for beginners who never
heard this culprit exists.

Since I believe all renderers should behave the same on that doubles simply
work as expected in a program, this should really be changed! (also this wasted
a few days of my life wondering why everything in my program was so broken)
2011-12-29 05:18:16 -05:00
Sam Lantinga
4ec39d8333 Fixed bug 1336 - Added a timestamp on all SDL events
Gueniffey 2011-11-23 04:11:31 PST

The attached simple patch adds a timestamp to all SDL events. It is useful to
dismiss old events and add UI responsiveness (my application does some
extensive tasks that creates a delay in the event queue handling. With this
patch, I can deal only with the most recent events.
2011-12-29 05:13:55 -05:00
Sam Lantinga
604270e214 Fixed bug 1335 - Added support for different pixel formats in OpenGL ES 2 renderer
Gueniffey 2011-11-23 04:06:31 PST

The attached patch adds native support for
SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888
2011-12-29 05:11:33 -05:00
Ryan C. Gordon
cd497f307b Don't call -[NSView setAcceptsTouchEvents] if the OS doesn't provide it.
Thanks to Dimiter 'malkia' Stanev for the fix!
2011-12-09 02:32:21 -05:00
Ryan C. Gordon
cc1616c646 More work to clean up compiler warnings. 2011-12-05 16:45:32 -05:00
Ryan C. Gordon
c3659093f8 Patched to compile. 2011-12-05 13:17:57 -05:00
Ryan C. Gordon
542fffc1f8 Fixed a tabstop. 2011-12-05 13:13:32 -05:00
Andreas Schiffler
5e0fdc8f9e Fix buildbot sdl-macosx-unix-x86 and sdl-macosx-amd64 compiler warnings 2011-12-05 07:41:20 -08:00
Sam Lantinga
b697ed5818 It works better if you compile it. 2011-11-29 02:28:34 -05:00
Sam Lantinga
0d371acf8e Better fix, iterate backwards over the array so we don't care whether the close code shuffles things down. 2011-11-29 02:27:34 -05:00
Sam Lantinga
1dc86eeece Closing the joystick removes it from the list. 2011-11-29 02:15:39 -05:00
Sam Lantinga
c7f0996903 Invalid assert. It's perfectly legit to initialize the joystick subsystem and get no joysticks. 2011-11-29 02:12:24 -05:00
Sam Lantinga
7345e9d2f6 Yes, let's save 32-bit BMP files, very useful for you know, making a game... 2011-11-29 02:11:39 -05:00
Ryan C. Gordon
1668c3dd20 Another iOS 3.1 compatibility fix.
Thanks to Vittorio Giovara for the patch!
2011-11-27 23:30:02 -05:00
Sam Lantinga
79494aee9d First pass at a simple drag and drop API, allowing you to accept files dropped into your application. 2011-11-20 19:38:18 -05:00
Ryan C. Gordon
162e2c3270 Make +sharedAppDelegate return a generic object instead of a SDLUIKitDelegate.
This way subclasses can use it without a lot of casting.

Thanks to Vittorio Giovara for the patch!
2011-11-19 19:23:33 -05:00
Ryan C. Gordon
eb19bd06d2 Check for selectors UIScreen responds to, not the base system version.
Thanks to Vittorio Giovara for the patch!
2011-11-19 19:18:20 -05:00
Ryan C. Gordon
464d3855ca Fix iOS build when SDL_POWER_UIKIT isn't defined.
Thanks to Vittorio Giovara for the patch!
2011-11-19 19:13:55 -05:00
Sam Lantinga
b76ca8acf5 Fixed where we set the content scale - it's used by the renderbufferStorage:GL_RENDERBUFFER_OES call. 2011-11-17 00:41:07 -05:00
Ryan C. Gordon
052948dc6e Patched to compile on newer FreeBSD releases.
Thanks to Marcus von Appen for the patch!
2011-11-16 05:13:40 -05:00
Sam Lantinga
2ddecd140d Fixed issues with the touch coordinates in landscape mode.
In landscape mode the frame stays the same, and the transform property is modified with the appropriate rotation.
The touch coordinates are rotated by the transform, so if I want to normalize them by the frame rect, I have to transform the frame rect first.
2011-11-15 01:38:27 -05:00
Sam Lantinga
fb26595d0d Fixed whitespace 2011-11-10 06:38:26 -05:00
Sam Lantinga
1a10b41f28 Work in progress fixing support for rotated video modes 2011-11-10 03:48:59 -05:00
Sam Lantinga
a59d3e6f2f Fixed issues closing lines with the OpenGL ES renderer. 2011-11-10 00:22:44 -05:00
Sam Lantinga
1bb72d783a Fixed an offset issue with glDrawTexiOES() when the viewport is set. 2011-11-10 00:22:01 -05:00
Sam Lantinga
5fedcb50d8 GIMP wrote bmp files in RGBX format. Huh. 2011-11-09 22:53:44 -05:00
Sam Lantinga
fe31953a46 Fixed creating a fullscreen window on iOS 2011-11-09 02:35:49 -05:00
Ryan C. Gordon
b7ab18db4c Fixed compiler warnings for uninitialized variables. 2011-11-09 00:27:44 -05:00
Ryan C. Gordon
57427cf80f Fixed uninitialized variable. 2011-11-08 19:45:41 -05:00
Ryan C. Gordon
83f9d9b276 Merge from https://bitbucket.org/keestux/sdl ... SDL_gesture code cleanup. 2011-11-08 16:24:02 -05:00
Sam Lantinga
858f6f21de To answer the FIXME, no, we shouldn't force this. The fullscreen flag implies borderless behavior even though the flag isn't set on the window (in case fullscreen is toggled) 2011-11-08 00:17:41 -05:00
Sam Lantinga
5cee776161 The iOS driver sets the fullscreen and shown flags on the window during creation, so we need the mode code to be aware of that, since none of the other fullscreen/shown code paths get run.
FIXME: Maybe we need a better way of detecting that?
2011-11-08 00:03:54 -05:00
Sam Lantinga
aaf891d9c8 Fixed a typo, we should set the driverdata if we are 3.2 or newer. 2011-11-08 00:02:47 -05:00
Sam Lantinga
e30ec4d8ce Fixed list loop caused when there are two entries in the list and the one being returned is already at the head. 2011-11-07 23:10:49 -05:00
Sam Lantinga
4305c920da Fixed SDL applications being killed immediately after being backgrounded, because they were trying to draw while minimized. 2011-11-07 23:07:00 -05:00
Sam Lantinga
c932d63cdb Need to send a key up, silly. 2011-11-07 02:24:52 -05:00
Sam Lantinga
6a5a074397 Fixed double-free in the shader cache at shutdown 2011-11-07 00:45:13 -05:00
Ryan C. Gordon
5054c0e57d Mac OS X: Fixed build when compiling without Cocoa support.
Thanks to Martin Gerhardy for the patch!
2011-11-06 17:05:48 -05:00
Ryan C. Gordon
c33e36f58b Fixed some preprocessor mistakes introduced in iOS project cleanup. 2011-11-03 11:51:47 -04:00
Ryan C. Gordon
dd3d93c50f Fix crash on X servers without UTF-8 support. 2011-10-31 23:37:57 -04:00
Sam Lantinga
6371c44a9e Lots of fixes importing SDL source wholesale into a new iOS project 2011-10-31 05:56:58 -04:00
Sam Lantinga
04ce234fd4 This code works for OpenGL ES 1.1 as well! :) 2011-10-31 03:06:32 -04:00
Sam Lantinga
462a6474ac Implemented RenderReadPixels for the OpenGL ES 2.0 renderer. 2011-10-31 02:55:21 -04:00
Sam Lantinga
a347411651 SDL_ConvertPixels() returns 0 on success 2011-10-31 02:44:21 -04:00
Sam Lantinga
4827ef3a38 Fixed warnings on iOS 2011-10-31 01:59:54 -04:00
Andreas Schiffler
d2ad34e8d3 Fix sdl-haiku buildbot compiler warnings 2011-10-30 00:19:13 -07:00
Andreas Schiffler
bc907fee45 Update SDL_HasClipboardText functions to return value based on clipboard content; Fix memory leak in fallback SetClipboard implementation 2011-10-29 23:43:59 -07:00
Ryan C. Gordon
a672530595 SDL_memcpyMMX(): Fixed handling of overflow bytes.
Thanks to Mason Wheeler for the fix!
2011-10-29 01:11:47 -04:00
Ryan C. Gordon
1a32c6a0c5 SDL_memcpyMMX(): Make sure srcskip and dstskip are 8-byte aligned.
Thanks to Patrick Baggett for the fix!
2011-10-29 01:03:50 -04:00
Ryan C. Gordon
40b38ee8db Removed tabs and DOS endlines from SDL_blit_copy.c ... 2011-10-29 00:57:45 -04:00
Kees Bakker
87a03a15a8 Type of SDL_GestureTouch.id is SDL_TouchID (only for SDL_gesture.c internal) 2011-10-27 23:04:50 +02:00
Kees Bakker
dded190188 Correct usage of SDL_AddDollarGesture (return value >= 0 on success) 2011-10-27 22:53:28 +02:00
Kees Bakker
2409db9e8b Refactor SDL_AddDollarGesture 2011-10-27 22:52:03 +02:00
Kees Bakker
0579ea60db Reformat SDL_gesture.c (part 2, space after keywords) 2011-10-27 22:23:09 +02:00
Kees Bakker
085bef88ff Reformat SDL_gesture.c (part 1, reindent using Emacs, c-basic-offset 4) 2011-10-27 21:26:44 +02:00
Ryan C. Gordon
ab5d942d93 Don't bother checking S_OK here, it'll work in falling through. 2011-10-26 12:04:05 -04:00
Ryan C. Gordon
599c080360 Fix X11 dynamic loading.
Previous change broke it.
2011-10-24 23:18:53 -04:00
Sam Lantinga
6d456a4116 Added SDL_GetScancodeFromName() and SDL_GetKeyFromName() 2011-10-24 21:34:54 -04:00
Sam Lantinga
9c2780471b valgrind FTW! 2011-10-24 23:00:09 -04:00
Ryan C. Gordon
bdb05fd683 Use correct Xinerama APIs for querying version and availability.
Fixes Bugzilla #1314.
2011-10-24 15:33:58 -04:00
Ryan C. Gordon
fcca056ae4 SDL_X11_HAVE_* should default (and reset) to zero. 2011-10-24 12:07:41 -04:00
Ryan C. Gordon
2412f91654 Add XGetInputFocus() to dynamic X11 function list. 2011-10-24 12:07:13 -04:00
Ryan C. Gordon
dfddb889df Set up window focus correctly when using an existing X11 window.
Thanks to Joseph Toppi for the fix!
2011-10-22 02:14:57 -04:00
Ryan C. Gordon
1871363aac XGetWindowProperty() can report success but still give you a NULL pointer.
Thanks to Joseph Toppi for the fix!
2011-10-22 02:13:35 -04:00
Ryan C. Gordon
756aae4a51 More cleanup in SDL_uikitopenglview.m 2011-10-24 11:38:52 -04:00
Ryan C. Gordon
d36f39749f Added stencil buffer support on iOS.
Thanks to Brian Barnes for the initial work on this patch!
2011-10-22 01:23:21 -04:00
Kees Bakker
66e3b3d7a6 Use a small function to release UIScreenMode after checking it is supported 2011-10-18 21:36:28 +02:00
Kees Bakker
4b46fb22ec Eliminate UIScreenMode parameter from UIKit_AddDisplay 2011-10-18 21:32:54 +02:00
Ryan C. Gordon
d47d246678 Merged with Kees Bakker's repo at https://bitbucket.org/keestux/sdl ... 2011-10-18 00:58:22 -04:00
Ryan C. Gordon
2014d62292 Don't crash with a NULL thread name. 2011-10-18 00:34:45 -04:00
Ryan C. Gordon
e7fb05cb0b Check for __ARM_ARCH_5TEJ__ in spinlock atomics.
Fixes Bugzilla #1264.

Thanks to Gueniffey for the patch!
2011-10-16 03:27:48 -04:00
Ryan C. Gordon
73f4a2a1fe Let iOS use OSAtomicCompareAndSwap32Barrier() if nothing else is available. 2011-10-16 03:02:46 -04:00
Ryan C. Gordon
535f1943d3 Fix up some retain/release issues with UIScreenMode objects.
Fixes Bugzilla #1191.

This patch is based on work done by Vittorio Giovara.
2011-10-14 20:47:53 -04:00
Ryan C. Gordon
d9eb836912 Don't use a global JNIEnv across threads; it's not thread safe.
Obtain the correct environment in a thread-safe way when appropriate instead.

Fixes Bugzilla #1312.

Thanks to Bill Chenbin for the patch!
2011-10-15 23:50:06 -07:00
Ryan C. Gordon
7533834caf Removed STL dependency in Android code. 2011-10-15 14:16:29 -07:00
Tim Angus
092332dd71 * Android's InputStream::skip is apparently buggy, so instead read into a dummy buffer 2011-10-14 17:29:49 +01:00