This is not completely thread-safe since it's possible for an event to come in and be unfiltered between the flush call and the setting of the new filter, but it's much better than it was.
Alex Szpakowski
When calling SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED), the window moves to the correct position but it seems to internally set its x/y position values to the literal value of the SDL_WINDOWPOS_CENTERED define.
This causes all sorts of problems when SDL functions which use the window position (e.g. SDL_SetWindowGrab) are called after the aforementioned SDL_SetWindowPosition call.
Looking at the SDL_SetWindowPosition code, it seems that SDL_SendWindowEvent with the SDL_WINDOWEVENT_MOVED event is called at the end of the function using the literal value of the SDL_WINDOWPOS_CENTERED define, instead of the newly set window->x and window->y values.
SDL_SendWindowEvent then sets the values of window->windowed.x and window->windowed.y to that value (0x2FFF0000, aka 805240832.)
I have attached a patch which changes SDL_SetWindowPosition to make sure SDL_SendWindowEvent is called with the correct coordinate values, if SDL_WINDOWPOS_CENTERED is used (fixes the issue for me.)
Tested with Mac OS 10.8.3.
Fixes compiler warnings for things like this...
if (SDL_RectEmpty(&rect)) {}
...where the macro turned into "if ( (!(&rect)) && etc )" which some compilers
thought might be a programmer mistake, as "&rect" is always "true".
leighmanthegreat@hotmail.com
I downloaded SDL2 from hg source.
I built to a ./build directory.
I downloaded SDL_image 2 hg and attempted to build.
When it cannot find a sdl2-config the SDL_image configure correctly suggests setting SDL_CONFIG variable.
Setting this the configure still fails with 'Permission denied' on the call to sdl2-config.
Setting execute permission solves the problem.
If possible, sdl2-config should have executable bit set when it is created.
Colin Barrett
I see this manifest itself (VS2012 x86) as:
"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."
in the first call to SDL_GetTicks in my application. The disassembly at the problem line is:
hires_now.QuadPart *= 1000;
00AD0792 push 0
00AD0794 push 3E8h
00AD0799 mov eax,dword ptr [ebp-10h]
00AD079C push eax
00AD079D mov ecx,dword ptr [hires_now]
00AD07A0 push ecx
00AD07A1 call _allmul (0AE7D40h)
00AD07A6 mov dword ptr [hires_now],eax
00AD07A9 mov dword ptr [ebp-10h],edx
Apparently _allmul should be popping the stack but isn't (other similar functions in SDL_stdlib.c - _alldiv and whatnot - DO pop the stack).
A 'ret 10h' at the end of _allmul appears to do the trick
nfxjfg
SDL_touch.h:63:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
Is:
extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices();
Should be:
extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
Martin Gerhardy
the coordinate system from sdl is not correctly transformed to the coordinate system of opengl. glScissor expects them to be a little bit different. Attached is a patch that fixes this