Commit graph

2756 commits

Author SHA1 Message Date
Gabriel Jacobo
f8c07dc1bd 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
c6b7c0f507 Christoph Mallon: Replace strlen(x) == 0 (O(n)) by x[0] == '\0' (O(1)). 2013-08-29 08:30:21 -07:00
Sam Lantinga
62d7359fd5 Christoph Mallon: Remove pointless if (x) before SDL_FreeSurface(x) 2013-08-29 08:29:51 -07:00
Sam Lantinga
08dfaaa2e6 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Gabriel Jacobo
4353b43e3f Fixes typo in EGL code (thanks jmcfarlane!) 2013-08-26 14:23:18 -03:00
Ryan C. Gordon
b61d361d2d Removed obvious comment to trigger buildbot. 2013-08-25 21:28:03 -04:00
Gabriel Jacobo
6dd2b54f38 Fixes "error: conflicting types for 'GLintptr'" 2013-08-25 11:48:49 -03:00
Sam Lantinga
1afef302ac Fixed crash if the IC isn't set up for some reason (bad X11 locale?) 2013-08-21 10:07:48 -07:00
Gabriel Jacobo
332278ee6f Fix a couple of warnings 2013-08-21 10:34:32 -03:00
Gabriel Jacobo
91d5b012ad More fixes for -Wdeclaration-after-statement 2013-08-21 10:13:12 -03:00
Gabriel Jacobo
ac6a540788 Fixes for -Wdeclaration-after-statement 2013-08-21 10:12:16 -03:00
Gabriel Jacobo
298ce1c1a7 OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
Gabriel Jacobo
271e0d67c4 OCD fixes: Adds a space before */ 2013-08-21 09:43:09 -03:00
Ryan C. Gordon
26992a5a9f Fixed compiler warning. 2013-08-20 20:31:57 -04:00
Gabriel Jacobo
5e78879e76 More non C89 compliant comments 2013-08-20 20:34:40 -03:00
Gabriel Jacobo
25c9f2cd30 Fixes a few non C89 compliant comments 2013-08-20 19:49:24 -03:00
Gabriel Jacobo
ef4a588d99 Fixes bug #2037, common EGL code for Android and X11 2013-08-19 16:29:46 -03:00
Sam Lantinga
814d56a9cc Fixed windows build 2013-08-16 17:50:44 -07:00
Sam Lantinga
8b93c73d0d The keyboard text events should be sent after the key down events 2013-08-16 15:38:06 -07:00
Sam Lantinga
ec992b0558 Fixed bug 1876 - SDL_TEXTINPUT only returns '?' (0x3F) in event.text.text with Khmer language input
Andreas

The issue comes down to this line on MSDN:
"TranslateMessage produces WM_CHAR messages only for keys that are mapped to ASCII characters by the keyboard driver."

"WM_KEYDOWN and WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message. WM_SYSKEYDOWN and WM_SYSKEYUP combinations produce a WM_SYSCHAR or WM_SYSDEADCHAR message."
Except for WM_CHAR, none of these messages are used in SDL. Hence TranslateMessage should be dropped entirely and proper handling be included in the WM_KEYDOWN event.
Currently TranslateMessage is called for every message even if it must not be called in certain cases (like "An application should not call TranslateMessage if the TranslateAccelerator function returns a nonzero value.").

WM_CHAR message handling should remain for external processes posting these messages - additionally, WM_UNICHAR should be added.

I made a patch for src/video/windows/SDL_windowsevents.c that seems to work fine. It doesn't solve the "missing" composition for Khmer, but at least input for languages that cannot be mapped to ASCII characters (and for which IME is not used) will now work on Windows.

--HG--
extra : rebase_source : 7024be6c3a874d0319ea4c65b7d43f105915288f
2013-08-16 15:35:10 -07:00
Sam Lantinga
a460259e6b Fixed alpha composition when destination alpha is transparent.
Jianyu Guan

I found I make a big mistake that when dstA==0, I just simply let *dstp=*srcp and forgot to make dstRGB = srcRGB*srcA.

The if consition "(*dstp & amask) == 0" in BlitRGBtoRGBPixelAlphaMMX and BlitRGBtoRGBPixelAlphaMMX3dNow should be removed.
2013-08-16 09:20:33 -07:00
Sam Lantinga
1873067816 Fixed alpha blending for the MMX blit functions
I see the Remarks of function SDL_BlitSurface shows that "when SDL_BLENDMODE_BLEND, we have dstA = srcA + (dstA * (1-srcA))". however, I tested some pictures but the result implies "dstA=arcA" actually. I stepped into the source code, and found after I set SDL_BLENDMODE_BLEND for the source surface, the final blit function is BlitRGBtoRGBPixelAlphaMMX when I use SDL_BlitSurface on my computer. And I found these codes:

    else if (alpha == amask) {
    /* opaque alpha -- copy RGB, keep dst alpha */
    *dstp = (*srcp & chanmask) | (*dstp & ~chanmask);

The same code is used in BlitRGBtoRGBPixelAlphaMMX3DNOW and BlitRGBtoRGBPixelAlpha. So I think they still keep dst alpha.

Best regards,
Jianyu Guan
2013-08-16 06:59:19 -07:00
Sam Lantinga
a0bc602061 Don't print "unrecognized key" message for an X11 keycode of 0. This can happen with composed characters. 2013-08-12 22:00:21 -07:00
Jørgen P. Tjernø
a100a39fe9 Mac: Fix restoring of Cmd-H-hidden fullscreen desktop windows.
This should fix http://bugzilla.libsdl.org/show_bug.cgi?id=1996

--HG--
extra : histedit_source : 5d56152c804e07c2750a8490d945f65f78d3cf93
2013-08-12 11:09:13 -07:00
Gabriel Jacobo
a3982939c5 Fixes #2022, do not resume on Android when surfaceChanged
If the app is in landscape mode and the user presses the power button, a pause
is followed immediately by a surfaceChanged event because the lock screen
is shown in portrait mode. This triggers a "false" resume.
So, we just pause and resume following the onWindowFocusChanged events.

Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before
blocking the event pump.
2013-08-12 11:13:50 -03:00
Sam Lantinga
dd7da60a4f Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow()
Rainer Deyke

I'm running Linux Mint 15 with the Cinnamon window manager.  SDL_DestroyWindow consistently locks up for me when the window if fullscreen.
2013-08-11 19:56:43 -07:00
Philipp Wiesemann
286dc2e1dc Added missing call to SDL_stack_free().
On Windows this is needed because SDL_stack_alloc() wraps SDL_malloc().
2013-08-10 23:21:06 +02:00
Sam Lantinga
9444c11e99 Fixed bug 2007 - SDL_SetWindowMinimumSize() not implemented on X11 (thanks Rainer!) 2013-08-09 23:13:52 -07:00
Jørgen P. Tjernø
4f1c2fd2c3 Mac: Fix mouse tap on 10.5.
There's no Block support in the runtime on 10.5, so the old code
wouldn't work.
2013-08-08 13:29:44 -07:00
Ryan C. Gordon
f43141b289 Backed out changeset 3f487d7d2d1d
This breaks applications.
2013-08-08 13:22:21 -07:00
Ryan C. Gordon
f3280d289a Send the SDL_QUIT when last window is destroyed, not during its close event.
--HG--
extra : rebase_source : 1a30ff486e98282c7d6a05d64eea0c4f3e026c41
2013-08-08 12:49:29 -07:00
Jørgen P. Tjernø
cf76f36660 Mac: Don't enable SDL_MAC_NO_SANDBOX by default.
To get this functionality, you need to use -DSDL_MAC_NO_SANDBOX=1 in
your CFLAGS.
2013-08-08 12:48:37 -07:00
Sam Lantinga
5a167e03cd Fixed compile error 2013-08-08 02:34:21 -07:00
Sam Lantinga
780f3a273d Fixed bug 2009 - Creating texture from 32-bit surface with colorkey and per-surface alpha ignores the colorkey
To fix this we need to ignore the alpha channel in the colorkey comparison, which is the way colorkey comparisons are defined in SDL.

We also need to reset the alpha and color modulation when converting a surface.
2013-08-08 02:30:32 -07:00
Jørgen P. Tjernø
5d1bee0f17 Ensure that the right window is current in SDL_GL_SwapWindow. 2013-08-07 16:29:28 -07:00
Jørgen P. Tjernø
9fb9406bbc Mac: Support for multiple contexts per SDL_Window. 2013-08-07 16:29:25 -07:00
Jørgen P. Tjernø
20c8287efc Mac: Don't -[NSOpenGLContext update] on (potentially) the wrong thread.
If the user is using their context from a non-main thread, we could be
calling -[NSOpenGLContext update] on our thread, while they were
accessing it on their thread.

With this change, we schedule updates when the event comes in on the
main thread, and act on them when the user calls SDL_GL_MakeCurrent or
SDL_GL_SwapWindow.
2013-08-07 16:29:21 -07:00
Jørgen P. Tjernø
8d8238f8ae Mac: Better mouse-grab if you define SDL_MAC_NO_SANDBOX.
This uses a better mouse grab if you define SDL_MAC_NO_SANDBOX. This
mouse grab uses CGEventTapCreate, which you cannot access if you have
sandboxing enabled.
2013-08-07 16:29:15 -07:00
Sam Lantinga
cdcee9a581 Unify the SetWindowPos() calls so that they all set the window state based on SDL state.
This prevents a rogue call to SetWindowPos() from changing the state unexpectedly.
Also moved the size correction code above the window position query, because the initial window size can affect the positioning.
2013-08-07 00:46:42 -07:00
Sam Lantinga
40b7af6399 Fixed incorrect window state if the window is created grabbed. We don't want to activate the window if it isn't shown yet. 2013-08-07 00:10:31 -07:00
Sam Lantinga
73a2e37abb Fixed bug 1848 - SDL_SetWindowSize cannot set sizes larger than desktop resolution in Windows 2013-08-06 22:55:55 -07:00
Sam Lantinga
330f7e1be3 Fixed a number of missing keys in the X11 keyboard mapping. 2013-08-06 18:19:34 -07:00
Philipp Wiesemann
7e69cee4c5 Added missing function prototype and changed its signature.
Signature was changed to prevent a header for SDL_GLContext.
2013-08-04 23:38:25 +02:00
Gabriel Jacobo
2a6b235190 Fixes bug #1889, allows for GL Context deletion/recreation on Android
Thanks ny00!
2013-08-03 12:54:39 -03:00
Ryan C. Gordon
a99dfca578 Some fixes for SDL_MaximizeWindow().
Fixes Bugzilla #1441.
2013-08-03 02:20:00 -04:00
Ryan C. Gordon
a60814585d Fixed some whitespace.
--HG--
extra : rebase_source : f10a447a25fafe9bc7a56dba0e6ebc74a3804063
2013-08-02 18:25:20 -04:00
Sam Lantinga
da00f7ef51 Fixed bug 1638 - Blit Alpha surface bug
The DUFFS_LOOP_124() macro was trying to be too clever and wasn't doing the right thing, it was checking n & 4 instead of width.
I'm not sure how we didn't catch this before, but it should be fixed now.
2013-08-01 01:29:07 -07:00
Ryan C. Gordon
72d8cda7bb Windows: Unstick shift keys in a timely manner when the OS loses a KEYUP event.
Fixes Bugzilla #1959.
2013-08-01 01:50:02 -04:00
Ryan C. Gordon
3d680115c7 Move the fix for Bugzilla #1395 into WIN_GL_SetupWindow() directly.
It's a cleaner solution.

--HG--
extra : rebase_source : efd29bea6e39b6aed73f78a0f119b3b4c2bbd498
2013-08-01 00:27:22 -04:00
Sam Lantinga
44c4197243 Documented why we have global and thread-local variables for the GL context. 2013-07-31 21:22:09 -07:00