Commit Graph

8326 Commits

Author SHA1 Message Date
Ryan C. Gordon
9d0bfb6d5c Fixed dynapi for new SDL_WarpMouseGlobal() function signature. 2015-07-18 00:04:49 -04:00
Ryan C. Gordon
1f9da252c3 Patched to compile on Raspberry Pi. 2015-07-18 00:03:34 -04:00
Ryan C. Gordon
fd638d4de7 SDL_WarpMouseGlobal() should return non-void.
There are platforms it isn't implemented on (and currently can't be
implemented on!), and there's currently no way for an app to know this.

This shouldn't break ABI on apps that moved to a revision between 2.0.3 and
2.0.4.
2015-07-17 21:03:58 -04:00
Philipp Wiesemann
13564bca67 Fixed spaces in header file. 2015-07-16 21:48:35 +02:00
Philipp Wiesemann
1db4b71718 Windows: Fixed wrong debugger output if logging empty string as info or warning. 2015-07-16 21:31:21 +02:00
Philipp Wiesemann
d0a842f36e Fixed typo in test header file comment. 2015-07-15 21:12:04 +02:00
Philipp Wiesemann
eebcb04cdd PSP: Fixed error handling in SDL_SemWaitTimeout().
Signed integers were converted to unsigned before being checked if smaller 0.

Found by Cppcheck.
2015-07-15 21:11:24 +02:00
Philipp Wiesemann
e859cd05af Fixed comment in test program. 2015-07-15 21:10:38 +02:00
Ryan C. Gordon
2736ba00ad X11: center parentless message boxes on the primary display if possible.
This relies on a successful SDL_Init(SDL_INIT_VIDEO) to work, since it's
silly to reproduce all the Xinerama/XRandR code in the message box parts. If
X11 is available but SDL hasn't been initialized, the message box will center
in the primary screen, which will be positioned weirdly on multi-head setups,
but this should fix the most significant common case.
2015-07-14 23:46:35 -04:00
Ryan C. Gordon
13cafe01a0 Added test/testdisplayinfo.c 2015-07-14 21:28:26 -04:00
Ryan C. Gordon
17b301fc53 x11: Patched to compile on systems without the Xutf8LookupString() function. 2015-07-11 00:59:56 -04:00
Philipp Wiesemann
2851aec2cd Fixed memory leak in test harness.
Found by Cppcheck.
2015-07-06 21:02:20 +02:00
Sam Lantinga
94455a125d Better fix for bug 3048, don't crash if the window title is NULL 2015-07-05 15:45:48 -07:00
David Ludwig
1f754d5829 Fixed bug 3048, "Crashes in Cocoa_SetWindowTitle" 2015-07-04 21:04:49 -04:00
Ryan C. Gordon
808bd8b3bf Cocoa: support drag-and-drop of multiple objects. 2015-07-04 14:09:09 -04:00
Sam Lantinga
c3eb820b20 Fixed style 2015-07-03 09:18:14 -07:00
Sam Lantinga
67e6ece0d4 commit a7d7af2a419b453188ffe87386455fc26c1306fa
Author: Benoit Pierre <benoit.pierre@gmail.com>
Date:   Fri Jul 3 02:17:10 2015 +0200

    fix 14dd48ae5bc43b61b2a0dd0b3177d22edec707ef regression

    The window manager detection code in X11_HasWindowManager does not work
    with Awesome (http://awesome.naquadah.org/). Remove it, and reuse the
    result of the more correct checks in X11_CheckWindowManager.
2015-07-03 09:17:24 -07:00
Philipp Wiesemann
342b9f2478 Added missing file to the release archive. 2015-07-02 20:11:40 +02:00
Philipp Wiesemann
8983b729c2 Removed redundant variable check when processing gestures. 2015-07-01 21:10:54 +02:00
Sam Lantinga
6e4ab7faaa Hack to fix missing window decorations after toggling fullscreen mode in Mac OS X 10.10 2015-06-30 19:30:02 -07:00
Ryan C. Gordon
951687168c X11: Added a test for a weird X11 error we get with Xinerama, rarely. 2015-06-30 15:00:48 -04:00
Ryan C. Gordon
b13f11a84d X11: Call XRefreshKeyboardMapping() when we get various MappingNotify events.
According to the Xlib docs, you need to do this or Xlib's internal state gets
out of sync.
2015-06-30 14:41:17 -04:00
Ryan C. Gordon
bb955046cf X11: Don't ignore keyboard mapping changes.
MappingNotify events don't have a window associated with them, so SDL was
dropping these before the point where we would have handled them.
2015-06-30 14:39:39 -04:00
Ryan C. Gordon
cbf57156de Fixed assertion failure in diskaudio target caused by new hotplugging support.
Fixes Bugzilla #3032.
2015-06-30 13:46:06 -04:00
Sam Lantinga
b5d616076c Fixed bug 2464 - Configure a sdl2-config.cmake.in together with sdl2.pc.in
Leonardo

Despite having a CMakeLists.txt file, SDL2 seems to be mainly built using the autotools system by package-managers. It is nice to have it but it is only useful if you are building SDL2 by yourself.

People that want to use CMake to find their already-installed SDL2 are using a FindSDL2.cmake module based on the old FindSDL.cmake. This is not deprecated but it is discouraged by the CMake devs (see http://www.cmake.org/Bug/view.php?id=14826), as these modules needs maintainers to be included in the official CMake installation.

To fix that, SDL and its accompanying libraries could configure a simple sdl2-config.cmake file, much like it does with sdl2.pc.in. We don't need to configure a full sdl2-config.cmake as in this post, http://forums.libsdl.org/viewtopic.php?t=10068&sid=ccf8abbf0d73fb03ae9cded991e60959 (because it depends on it being built with CMake). Using something as simple as http://www.cmake.org/Wiki/CMake/Tutorials/Packaging#Package_Configuration_Files is deemed enough. Here is another: http://quickgit.kde.org/?p=prison.git&a=blob&f=lib%2Fprison%2FPrisonConfig.cmake.in
2015-06-29 22:24:00 -07:00
Sam Lantinga
039ac898b8 Fixed compiling if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM is not defined 2015-06-25 07:17:08 -07:00
Philipp Wiesemann
fa26e9ced7 Mac OS X: Fixed typo in build script comment. 2015-06-26 20:12:10 +02:00
Philipp Wiesemann
171928dc8a Emscripten: Corrected build instructions in documentation.
And fixed a typo.
2015-06-26 20:11:41 +02:00
Sam Lantinga
fc8504e535 Fixed bug 2834 - Patch to support dead keys on Windows
Elise Maurer

When inputting text, dead-keys are currently not handled correctly on Windows with the latest SDL2 tip as well as the 2.0.3 release.

Using a French AZERTY keyboard, when I type the `^` key followed by `e` key to compose the `` character, I erroneously get two SDL_TEXTINPUT events, one with the `^` character and one with the `e` character.

I've looked at the history for SDL_windowsevents.c and there's been some back-and-forth with several methods for handling text input:

  * r8142 removed any handling of WM_CHAR because keyboard input was being handled through WM_KEYDOWN along with ToUnicode since r7645.

  * But using ToUnicode actually breaks dead-keys (googling for "ToUnicode dead keys" reports many horror stories of people trying to work around that and failing).

  * It seems like r7645 introduced a double-fix: it fixed WM_CHAR to properly handle Unicode, and also (unnecessarily?) added text input handling to WM_KEYDOWN. Later, r8142 removed the WM_CHAR stuff instead of the WM_KEYDOWN stuff.

The attached patch restores handling of text input through WM_CHAR and removes it from WM_KEYDOWN. I've tested it with French, English and Russian layouts and it seems to do its job. Obviously, with such matters, it's still a risky change.
2015-06-25 11:49:48 -07:00
Sam Lantinga
797525f534 Fixed whitespace in SDL_evdev.c 2015-06-24 17:55:38 -07:00
Sam Lantinga
705e5df32d Fixed an issue with mouse/keyboard removal
Sometimes, on removal SDL_EVDEV_udev_callback() gets called with zero udev_class. This in turn seems to be caused the SDL_udev.c:guess_device_class() failing to find the attributes of the parent device.

Apparently this is normal, attributes are not guaranteed to be in place during removal, depending on timing. This lack of attributes causes guess_device_class() to return zero.

This fix mimics the code in linux/SDL_sysjoystick.c:joystick_udev_callback() which effectively has the same fix already in place.
2015-06-24 17:54:39 -07:00
Alfred Reynolds
928bd310d4 SDL
- disable compiling in XAudio2 support. We both need the DX SDK to make this code plus we need to work out the runtime dependency problem this code bring in on windows (needing the DX runtime installed).

CR: SamL
2015-06-24 10:56:51 -07:00
Alfred Reynolds
8ed571083e SDL
- do the scancode to keyboard code lookup for the grave key, so that we can show users the correct keyface for the key, rather than forcing it to "`".  Note that if a game is using SDLK_* for its KB mapping then after this change on some keyboards the top left key will no longer be mapped correctly with the old data.

CR: SamL
2015-06-24 10:56:37 -07:00
Sam Lantinga
95aeece375 Fixed bug 3030 - SDL_RecreateWindow fails to restore title, icon, etc.
Adam M.

It loses the title and icon when window recreation fails. For instance, this may happen when trying to create an OpenGL ES window on a system that doesn't support it. But at that point, the title and icon have already been lost.
2015-06-22 23:36:06 -07:00
Ryan C. Gordon
fa81fdae07 Fixed compiler warning about shadowed local variables. 2015-06-23 01:44:44 -04:00
Ryan C. Gordon
1410f444ad Updated Mac OS X documentation for fatbuilt.sh -> gcc-fat.sh transition. 2015-06-22 21:30:08 -04:00
Philipp Wiesemann
6752fbbec1 Windows: Fixed crash if initialization of EGL failed but was tried again later. 2015-06-21 19:37:37 +02:00
Philipp Wiesemann
bbc824dfcb Backed out changeset 30a317c4af6c 2015-06-21 19:36:35 +02:00
Philipp Wiesemann
ec5381a76a Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
2015-06-21 17:33:46 +02:00
Philipp Wiesemann
797a37d1b5 Added missing file and folder to the release archive. 2015-06-20 11:15:37 +02:00
Sam Lantinga
088cb64b25 Added the docs directory to the release archive 2015-06-20 00:25:28 -07:00
Sam Lantinga
4388c6e166 GCC is warning about global functions with the same name as variables in the code, when using -Wshadow.
This is a little ridiculous because we have no idea what functions a given platform will provide, so we'll disable -Wshadow for now.
2015-06-19 23:53:33 -07:00
Sam Lantinga
cfce458df8 Use CLOCK_MONOTONIC_RAW, if available, which is not subject to adjustment by NTP 2015-06-19 23:49:00 -07:00
Sam Lantinga
5ac1d2ab15 Android has clock_gettime() - thanks Michael Labbe! 2015-06-19 23:40:23 -07:00
Sam Lantinga
1838d55586 Cleaned up Xcode rules a little more 2015-06-19 23:32:37 -07:00
Sam Lantinga
bdd751991d Simplified Mercurial ignore rules for Xcode build products 2015-06-19 23:27:35 -07:00
Sam Lantinga
49733e3a0d Fixed bug 2538 - SDL_SetTextureAlphaMod does not work with SDL_FlipMode or rotation in the software renderer
Adam M.

When setting a texture alpha mod other than 255 and also specifying a flip mode in the software renderer, the rendering fails. When the texture has an alpha channel, it becomes invisible when flipped. When the texture does not have an alpha channel, it is flipped but the colors are wrong: the alpha mod makes the texture darker rather than more translucent.

0) Initialize a software renderer.
1) Load 16-bit 565 or 32-bit texture.
2) Set texture blend mode to BLEND.
3) Set texture alpha mod to 150.
4) Draw the texture flipped horizontally and/or vertically.
2015-06-19 23:22:53 -07:00
Sam Lantinga
4713d5b479 Fixed bug 1550 - SDL_RenderCopy/CopyEx in software should optionally render 8bit alpha
Adam M.

There are three problems in the code that I see.
1. SW_RenderCopyEx enables a color key on surface_scaled even if the source surface didn't have a color key.
2. SW_RenderCopyEx doesn't copy blend mode, color mod, or alpha mod from src to surface_scaled.
3. When SDL_BlitScaled(src, srcrect, surface_scaled, &tmp_rect) is called, it blends the src pixels into surface_scaled instead of overwriting them (if src has blending, etc. enabled).

I've attached a patch that 1) fixes the three problems that I mentioned, 2) adds the requested performance improvement of using the regular blit function if no rotation or flipping is needed, 3) avoids cloning the source surface if no stretching is required, and simplifies the rotation code slightly.
2015-06-19 23:20:43 -07:00
Sam Lantinga
219c607c5f Fixed bug 3023 - setting a white and then non-white texture color mod breaks the texture with software renderer
Adam M.

Okay, here is the problem, I think.

During the first blit, RLEAlphaSurface is called to do RLE conversion of the RGBA source into a format allowing it "to be quickly alpha-blittable onto dest". Since the destination is the screen, it has no alpha channel. RLEAlphaSurface calls copy_opaque(dst, src + runstart, len, sf, df) (where copy_opaque is copy_32), which has this code:

SDL_RLEaccel.c:984:
  RGBA_FROM_8888(*src, sfmt, r, g, b, a);
  PIXEL_FROM_RGBA(*d, dfmt, r, g, b, a);

On the first line, it reads the source pixel 0xFFFFFFFF. The second line drops the alpha value (because dfmt for the screen has no alpha channel) and writes 0x00FFFFFF. Later, when the RLE conversion is being undone, uncopy_32 is called, which has the following code:

SDL_RLEaccel.c:1001:
  Uint32 pixel = *s++;
  RGB_FROM_PIXEL(pixel, sfmt, r, g, b);
  a = pixel >> 24;
  PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, a);

However, the the alpha channel has already been dropped by copy_opaque (= copy_32), so pixel = 0x00FFFFFF and 'a' becomes 0. Thus, all opaque pixels lose their alpha channel when being unRLE'd. (I don't know what happens to pixels with alpha from 1-254, but they should be checked too.)

So, that seems to be the problem, but I'm not sure what the solution should be. Since opaque pixels have alpha == 255, I'm thinking to create another uncopy function for opaque pixels that simply uses 255 for alpha.

However, there may be other problems here. For translucent pixels, uncopy_32 assumes the alpha channel is stored in the upper 8 bits, but copy_32 doesn't store it there. Instead, it stores it in whatever location is appropriate for the destination surface. Isn't one of their behaviors incorrect, given the other? I'm not sure which to change, however.

For translucent pixels, it seems that the blit function uses do_blend, which is the BLIT_TRANSL_888 macro, which also assumes alpha is in top 8 bits. It has the comment "we have made sure the alpha is stored in the top 8 bits...", but it seems that's not true (copy_32 doesn't make sure the alpha goes there).

Perhaps the correct fix is to make copy_32 put the alpha there, but then that seems to require that RLE conversion be limited to destination surfaces that don't use the upper 8 bits. However, looking further, it seems that has already been done: if (masksum != 0x00ffffff) return -1; /* requires unused high byte */
2015-06-19 23:12:13 -07:00
Sam Lantinga
3ceb72380e [mq]: 3027_rleperf.diff 2015-06-19 22:12:47 -07:00