Commit Graph

366 Commits

Author SHA1 Message Date
Sam Lantinga
d024c724d1 Fixed signedness issue when blitting on a big endian platform, as reported by capehill
For example, if sR is 0 and dR is 255, we will get -255*sA casted to an unsigned value. Basically results are quite large numbers instead of the expected 0-255 range.
2017-01-05 08:16:39 -08:00
Ryan C. Gordon
9d04205263 x11: deal with xrandr display size in millimeters being zero.
Xquartz on macOS reports a zero size, which leads to a division by zero here.
2017-01-04 09:33:47 -05:00
Sam Lantinga
d359180040 Fixed bug 3519 - SDL_GetDisplayMode fails to report mode.format when using Wayland backend
Ryan C. Gordon

Kristian says you can't do it with Wayland, and that going forward, it'll just handle whatever you throw at it anyhow.

https://twitter.com/hoegsberg/status/816148272402165761

So I say we mark it SDL_PIXELFORMAT_RGB888, which is what my X11 display currently reports, and leave it at that.
2017-01-03 00:44:05 -08:00
Sam Lantinga
18d9b23c65 Fixed bug 3539 - SDL2, missing MIR LDFLAGS
Gianfranco

Hello, this is the failure I got

https://launchpadlibrarian.net/300679206/buildlog_ubuntu-zesty-amd64.libsdl2_2.0.5+dfsg1-2ubuntu1_BUILDING.txt.gz

  LTLINK build/libSDL2.la
build/.libs/SDL_mirvideo.o: In function `MIR_InitDisplayFromOutput':
././src/video/mir/SDL_mirvideo.c:258: undefined reference to `mir_output_get_current_mode'
collect2: error: ld returned 1 exit status
2017-01-02 10:30:32 -08:00
Sam Lantinga
67ed894353 Fixed bug 3529 - SDL_EGL_UnloadLibrary is not called at all on SDL_Quit
kaisyu

In case of OpenGLES, the sequences of loading and unloading driver library should be like that:

SDL_Init
  ...
  SDL_GL_LoadLibrary
    SDL_EGL_LoadLibrary
...
SDL_Quit
  ...
  SDL_GL_UnloadLibrary
    SDL_EGL_UnloadLibrary
...


However, according to my test results, the varible '_this->gl_config.driver_loaded' does not allow 'SDL_GL_UnloadLibrary' to call 'SDL_EGL_UnloadLibrary'.
2017-01-01 19:10:36 -08:00
David Ludwig
0cfa0aa11c improved SDL_GetError() output generated by EGL code
This change attempts to report the EGL error codes generated by SDL's calls
into EGL, along with the name of the EGL function that failed.
2016-12-29 11:49:18 -05:00
Sam Lantinga
45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
49225f5f04 We don't currently support blitting to < 8 bpp surfaces, return an error instead of corrupting memory in that case. 2016-12-31 18:11:19 -08:00
Sam Lantinga
7f2068daca Fixed bug 3541 - DisplayIndex out of bounds in SDL_SetWindowPosition
Intellectual Kitty

In SDL_video.c, on line #1756, in SDL_SetWindowPosition (from today's distribution, 12-31-2016, https://hg.libsdl.org/SDL/shortlog/bf19e0c84483):

        if (displayIndex > _this->num_displays) {

should be:

        if (displayIndex >= _this->num_displays) {
2016-12-31 10:30:07 -08:00
Ryan C. Gordon
7c31636666 x11: Don't loop forever if the X server refuses a pointer grab. 2016-12-26 23:02:14 -05:00
Sam Lantinga
b4e069e7f8 Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes
felix

Compiling even a simple SDL2 'hello world' program with gcc -Wstrict-prototypes (GCC 6.2.1) results in warnings like:

/usr/include/SDL2/SDL_gamecontroller.h:143:1: attention : function declaration isn't a prototype [-Wstrict-prototypes]
 extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings();
 ^~~~~~

It seems there is a missing 'void' between the parentheses.
2016-12-26 02:12:21 -08:00
Alex Szpakowski
fd85f5748d Mac: back out commit 3e9b2ae41adf. It causes significant overhead on many GPUs. 2016-12-23 22:49:37 -04:00
Alex Szpakowski
d719374cb9 Mac: Fix over-saturated colors on P3 displays (e.g. the 2016 MBPs). 2016-12-23 22:08:18 -04:00
Alex Szpakowski
eda74fda96 tvOS: Expose remote swipe gestures as arrow key presses (thanks oviano!) 2016-12-18 13:05:14 -04:00
Alex Szpakowski
787a54c84b iOS bug #3377: work around bugs in some third party iOS libraries (e.g. Google admob) where they assume the optional UIApplicationDelegate ?window? property always exists and will crash if it doesn?t. 2016-12-18 12:28:28 -04:00
Ryan C. Gordon
f50a04009c windows: add whitespace to fix macro preprocessing issue (thanks, Sven!).
Apparently without a space here, "fastbuild -cache" breaks.
2016-12-13 00:22:42 -05:00
Sam Lantinga
e81bf12b85 Fixed edid parsing code for older gcc compilers
Ozkan Sezer

This adds the name 'ad' to two unnamed unions in edid.h
and adjusts edid-parse.c for it.  Nameless unions are not supported in
ancient gcc, which I happened to use on one of my ancient setups.
2016-12-12 09:18:42 -08:00
Sam Lantinga
8414c3d4ae Fixed ABI, don't change the return type of SDL_GL_SwapWindow() 2016-12-11 12:01:44 -08:00
Sam Lantinga
6211668e9f Fixed creating a renderer on the dummy driver on Mac OS X 2016-12-11 12:01:01 -08:00
Sam Lantinga
cb5a0b0f6a Fixed crash when creating a dummy window on Mac OS X 2016-12-11 11:45:33 -08:00
Sam Lantinga
454d9cb96d PP_OK isn't available in the NaCl build environment on buildbot. It's defined as 0 2016-12-09 05:19:31 -08:00
Sam Lantinga
97d05b0da8 Fixed a bunch of SwapWindow calls that needed their return value updated 2016-12-09 05:12:27 -08:00
Sam Lantinga
7a39681ea5 Fixed X11 OpenGL ES build 2016-12-09 05:04:18 -08:00
Sam Lantinga
fed8cbcdb6 Fixed build for EGL platforms 2016-12-09 05:00:35 -08:00
Sam Lantinga
524bf3c282 Fixed bug 3513 - SDL_GL_SwapWindow does not return error status
Return an error code from SDL_GL_SwapWindow(), like the other SDL APIs.
2016-12-09 01:47:43 -08:00
Sam Lantinga
26f05ecb4d Fixed missing prototypes on Android, patch from Sylvain 2016-12-02 02:25:12 -08:00
Sam Lantinga
84c0780e25 Fixed bug 3305 - Fixed TextInput status when the keyboard was dismissed with the dismiss key on the iPad
Diego

I was previously unaware that rotating the device to a different orientation when the keyboard is shown causes a keyboardWillHide followed by a keyboardWillShow notification. The previous patch would then mistakenly StopTextInput when rotating. This patch fixes that by checking if the device is rotating before stopping text input.
2016-12-02 02:21:35 -08:00
Sam Lantinga
1b689c335c Fixed bug 3503 - osx builds don't run on 10.6 as of rev. 10651
Ozkan Sezer

With rev. 10651, i.e. http://hg.libsdl.org/SDL/rev/747a6a795b21 ,
SDL2 - OS X builds fail to run on 10.6 (my setup: i686 / 10.6.8)
because the symbol _IOPMAssertionCreateWithDescription is missing.
The SDK listing it for 10.7+ does seem correct.  Reverting r10651
and rebuilding makes it to function again.
2016-12-01 11:52:47 -08:00
Sam Lantinga
4905cd9c09 Fixed bug 3340 - SDL_BlitScaled causes access violation in some cases.
Simon Hug

The SDL_BlitScaled function runs into an access violation for specific blit coordinates and surface sizes. The attached testcase blits a 800x600 surface to a 1280x720 surface at the coordinates -640,-345 scaled to 1280x720. The blit function that moves the data then runs over and reads after the pixel data from the src surface causing an access violation.

I can't say where exactly it goes wrong, but I think it could have something to do with the rounding in SDL_UpperBlitScaled. final_src.y is 288 and final_src.h is 313. Together that's 601, which I believe is one too much, but I just don't know the code enough to make sure that's the problem.

Sylvain

I think this patch fix the issue, but maybe it's worth re-writing "SDL_UpperBlitScaled" using SDL_FRect.
2016-11-30 22:06:05 -08:00
Sam Lantinga
7f764bd8d3 once more - iterating on this is annoying 2016-11-26 10:26:36 -08:00
Sam Lantinga
51ccc9ed8c if the tap is explicitly disabled by code or by another program, let it remain disabled! this is different than the automatic "event tap was too slow therefore we stopped processing it" timeout which we want to re-enable after. 2016-11-26 10:26:32 -08:00
Sam Lantinga
25f54f0f4f tap should default to disabled, not enabled 2016-11-26 10:26:26 -08:00
Sam Lantinga
354a8f276e SDL for Mac - only enable global event tap when actually necessary (app has focus and has requested relative mouse mode or has asked for a mouse grab). in other situations the event tap impacts system performance and battery life with no benefit. 2016-11-26 10:26:22 -08:00
Ryan C. Gordon
d1c35febce macOS: removed deprecated UpdateSystemActivity() call.
The non-deprecated approach (IOPMAssertion) already exists in SDL, and is
available in Mac OS X 10.6 and later (although it was incorrectly listed as
10.7 and later in SDL). Since SDL now requires 10.6 or later, this is no
longer conditionally used.
2016-11-25 00:13:13 -05:00
Ryan C. Gordon
fb5fd67ccb Fixed all known static analysis bugs, with checker-279 on macOS. 2016-11-24 21:41:09 -05:00
Ryan C. Gordon
e93e91f0b5 Pacify some GCC strict-aliasing compiler warnings. 2016-11-23 21:52:48 -05:00
Ryan C. Gordon
232ae68864 Still more compiler warning fixes for various platforms. 2016-11-23 17:20:28 -05:00
Sam Lantinga
3615633571 Renaming of guard header names to quiet -Wreserved-id-macro
Patch contributed by Sylvain
2016-11-20 21:34:54 -08:00
Sam Lantinga
4a089ca1c8 Fixed bug 3486 - Can't get HINSTANCE of my window
realitix

SDL2 allows to create widow and to get information through SDL_SysWMinfo.
But it misses something, with Vulkan, you need the HWND and HINSTANCE of the window for Win32 system.
Sadly, SDL2 provides only HWND but not HINSTANCE.

In some context, it can be difficult to get the HINSTANCE, indeed, I'm using pySDL2 (Python) and I can only access properties that SDL2 gives me.
I have to use a dirty trick like that to get the HINSTANCE:  (https://raw.githubusercontent.com/bglgwyng/pyVulkan/master/examples/win32misc.py)
2016-11-20 21:18:55 -08:00
Philipp Wiesemann
a49ac09c02 Windows: Fixed crash if using current SDL_GetWindowWMInfo() from older programs. 2016-11-18 00:06:09 +01:00
Philipp Wiesemann
d05a39d0a6 Wayland: Fixed file descriptor leaks if device was not initialized. 2016-11-18 00:05:54 +01:00
Philipp Wiesemann
c345126266 Emscripten: Fixed handling of deactivated mouse events.
SDL_GetEventState() was called with a button state instead of an event type.
2016-11-18 00:05:28 +01:00
Philipp Wiesemann
6fe15d6347 Wayland: Fixed memory leak if output retrieval failed.
Found by Cppcheck.
2016-11-16 22:09:40 +01:00
Sam Lantinga
818d1d3e80 Fixed bug 1646 - Warnings from clang with -Weverything 2016-11-15 01:30:08 -08:00
Sam Lantinga
0d24495b15 Removed unused constants
Except for SDL_bmp.c where they are historically interesting and I've left them in.
2016-11-15 01:24:58 -08:00
Thomas Perl
acce865911 [qtwayland] Set orientation and window flags via SDL hints 2016-11-13 10:39:04 +01:00
Sam Lantinga
009a3f5aa6 Fixed bug 3490 - Build failure with --enable-video-directfb
felix

Building SDL 2.0.5, or even the Mercurial snapshot (r10608) with GCC 6.2.1 and --enable-video-directfb generates a number of compiler diagnostics and fails.
2016-11-15 01:14:30 -08:00
Sam Lantinga
57d01d7d67 Patch from Sylvain to fix clang warnings 2016-11-13 22:57:41 -08:00
Sam Lantinga
74e1dd4c6f Define _GNU_SOURCE when building SDL 2016-11-11 13:14:00 -08:00
Ryan C. Gordon
2898ada338 wayland: fixed compiler warning about pipe2(). 2016-11-10 12:07:34 -05:00