Commit Graph

63 Commits (1686af726e6968ffe870e5d39824b30273756ec5)

Author SHA1 Message Date
Philipp Wiesemann 1686af726e Emscripten: Partially fixed not removing key event callbacks if hint was used.
The key event callbacks were always removed from the same target although it is
possible to set them to different targets using the hint. This is only a partial
fix because it assumes that the hint is not changed to a different value later.
2015-03-06 21:26:37 +01:00
Ryan C. Gordon 483ea8b7b0 Fixed SDL_PRI?64 for 64-bit Linux.
64-bit Linux uses a "long" instead of "long long" for 64-bit ints.

Added a special-case this so SDL_PRI?64 doesn't trigger compiler warnings
when used with SDL's 64-bit datatypes on 64-bit Linux.
2015-03-02 21:36:45 -05:00
Alfred Reynolds d34d608e59 SDL
- fix crash on OSX when removing a device. If the remove happened due to the CFRunLoopRunInMode call in SDL_SYS_JoystickDetect then we would delete the device right away, before SDL_SYS_JoystickUpdate could clean it up. So move the CFRunLoopRunInMode to after the cleanup logic, preventing this case. This does mean that adds and removes of joysticks now take 1 extra frame to show up.
2015-03-02 11:43:24 -08:00
David Ludwig d6c4296653 Fixed bug 2868 - SDL_FillRect can crash if surface's clip-rect is out-of-bounds
Thanks to John Skaller for the research into this, and for the fix!
2015-02-22 20:34:08 -05:00
Philipp Wiesemann 8321efba33 Emscripten: Fixed out of range joystick device index after joystick disconnect.
After disconnecting a joystick the remaining kept their original device index.
This was not correct because the device index must be a number between 0 and
SDL_NumJoysticks(). It was fixed with ideas from SDL's joystick implementation
for Android. Some range checks were removed as the caller already checks them.
2015-02-22 23:21:32 +01:00
Philipp Wiesemann 5c43207fad Emscripten: Fixed sending button and motion events for not opened joysticks.
SDL_SYS_JoystickUpdate() was implemented incorrectly. For every call to it all
attached joysticks were checked. But actually only the given SDL_Joystick should
be checked then. This allowed sending broken events for attached but not opened
joysticks. It also checked the opened joysticks more often than actually needed.
2015-02-22 21:00:35 +01:00
Ryan C. Gordon e4be934f5d Fixed naming conventions in some SDL_assert types, added compat #defines.
Fixes Bugzilla #1997.
2015-02-21 00:33:25 -05:00
Ryan C. Gordon 201868156e Mac OS X: Better way to stop duplicate joystick reports (thanks, Kyungdahm!).
Fixes Bugzilla #2822.
2015-02-19 23:52:10 -05:00
Ryan C. Gordon 33b9d9ad7f Windows: Added a FIXME. 2015-02-19 21:51:13 -05:00
Ryan C. Gordon 674eb55638 Windows: Free the argv we allocated for console_wmain(). 2015-02-19 21:50:40 -05:00
Ryan C. Gordon e974ccf828 Windows: Added a FIXME. 2015-02-19 21:49:30 -05:00
Ryan C. Gordon f7c4c3d010 Windows: Make a distinction between ANSI mainline and UTF-8 mainline. 2015-02-19 21:49:15 -05:00
Ryan C. Gordon e93ee5d7b1 Windows: Support unicode arguments for console applications (thanks, Jorgen!).
Fixes Bugzilla #2864.
2015-02-19 21:44:41 -05:00
Ryan C. Gordon 1b2cb70ca0 Mac OS X: replace some deprecated APIs with modern equivalents (thanks, Alex!).
Fixes Bugzilla #2858.
2015-02-19 19:55:30 -05:00
Edward Rudd 635a369c9d SDL_SetWindowPosition respects display num for SDL_WINDOWPOS_CENTERED_DISPLAY.
This allows for this kind of code in an application:

int monitorID = 1;  // the second monitor!
SDL_SetWindowPosition(sdlWin,
                      SDL_WINDOWPOS_CENTERED_DISPLAY(monitorID),
                      SDL_WINDOWPOS_CENTERED_DISPLAY(monitorID));

Fixes Bugzilla #2849.
2015-02-19 19:40:58 -05:00
Arne Janbu aefcd86dea Fix build on Linux when wayland is enabled
Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=2838
2015-01-10 13:47:37 +01:00
Ryan C. Gordon b7f6da0629 Some corrections to the SDL2.spec.in (thanks, Simone!).
Fixes Bugzilla #2809.
2015-02-19 13:42:56 -05:00
Ryan C. Gordon a309755961 Remove unnecessary parentheses and an unnecessary free() of a NULL pointer.
(Thanks, Simon!)

Fixes Bugzilla #2881.
2015-02-19 13:11:19 -05:00
Ryan C. Gordon 80ba854749 Corrected documentation about triggers values in SDL_GameControllerGetAxis().
Fixes Bugzilla #2319.
2015-02-18 16:25:15 -05:00
Ryan C. Gordon 8751b956f1 We maintain the list of platforms on the wiki now.
Also, I don't really want people emailing community members directly with
problems, so I'm removing their email addresses.

Fixes Bugzilla #2304.
2015-02-18 16:17:53 -05:00
Philipp Wiesemann 6dda14c0d8 Emscripten: Fixed receiving joystick events after failed init or subsystem quit.
The callbacks used to receive the HTML events were not removed if the joystick
subsystem initialization failed or if the joystick subsystem was quit. Also, the
already connected joysticks were not deleted if the initialization failed later.
2015-02-18 21:34:07 +01:00
Philipp Wiesemann f9adb453dd Removed redundant include statements from test programs.
The needed header files are already included with SDL.h. Still including them in
the test programs is confusing because it somehow suggests they would be needed.
2015-02-18 21:31:21 +01:00
Ryan C. Gordon f75d6c0915 X11: Don't create a window and GL context to look up the glX extension string.
It's not necessary.
2015-02-17 23:00:46 -05:00
Ryan C. Gordon f0c061d141 glX HasExtension(): check for NULL ext string first.
It's slightly faster than failing later, after a strchr() call, since this
will get called multiple times with a NULL string if the system totally
fails elsewhere.
2015-02-17 22:59:56 -05:00
Philipp Wiesemann 052720f7d5 Emscripten: Removed unused internal function. 2015-02-15 21:47:10 +01:00
Philipp Wiesemann bd2d014645 Emscripten: Changed return type of callback implementations from int to EM_BOOL.
The prototypes are declared with EM_BOOL (which is currently an int) in html5.h.
2015-02-15 21:44:36 +01:00
David Ludwig 8a700d4db2 WinRT: a minor, nit-picky cleanup of some OpenGL code 2015-02-15 12:11:44 -05:00
David Ludwig 5ad34f7a79 WinRT: improved OpenGL ES compatibility on WinPhone/ARM and Surface RT
This change integrates initialization settings for ANGLE/WinRT, as suggested in
MSOpenTech's latest ANGLE template-projects (for MSVC).

This should fix some OpenGL initialization issues on WinPhone 8.1 on ARM, and
on the 1st-generation Surface RT.
2015-02-15 11:53:24 -05:00
Philipp Wiesemann ec2df6490e Fixed crash if using clipboard functions without having initialized video. 2015-02-15 11:35:07 +01:00
Philipp Wiesemann cec3efe627 Fixed compile warning about unused variable in wave test program. 2015-02-15 11:33:39 +01:00
David Ludwig df3299627d WinRT: fixed crash when using up-to-date versions of ANGLE/WinRT 2015-02-15 00:08:27 -05:00
Philipp Wiesemann 2ef8b1a76f Emscripten: Fixed sending SDL_JOYDEVICEADDED events with an index out of range.
SDL_JOYDEVICEADDED events must contain the device index which is a value between
0 and the number of connected joysticks. The old implementation included a value
based on the instance id instead. It worked in some cases because the values are
similar initially. But after disconnecting joysticks this is no more the case
and the always increasing instance id becomes larger than number of joysticks.
2015-02-14 15:22:04 +01:00
Philipp Wiesemann 3941848838 Emscripten: Deactivated and corrected debug log messages on joystick events. 2015-02-14 15:16:41 +01:00
Philipp Wiesemann 6abd242b93 Emscripten: Fixed throwing JavaScript exception if no audio context available.
Handling the error in C provides the possibility to just continue without audio.
2015-02-14 00:16:27 +01:00
Philipp Wiesemann c5179c6acf Emscripten: Fixed not including SDL_internal.h. 2015-02-14 00:13:00 +01:00
Philipp Wiesemann 697c5c5758 Emscripten: Fixed framebuffer error message. 2015-02-14 00:10:58 +01:00
Philipp Wiesemann 2bb73d170c Emscripten: Fixed SDL_GetPlatform() returning "Unknown" instead of "Emscripten". 2015-02-14 00:08:48 +01:00
Philipp Wiesemann d1932834e2 Fixed test programs for joystick not exiting on events after first disconnect.
Exit was broken since the main loop extraction needed for Emscripten support
because the former local but now global variables were not reset correctly.
2015-02-12 21:40:53 +01:00
Ryan C. Gordon 7fd15e7e2c X11: Set dialog hint on message boxes (thanks, Melker!).
This helps the window manager do the right thing with these windows.
2015-02-11 01:48:52 -05:00
Philipp Wiesemann 39c41bb952 Fixed bug 2873 - Joystick test won't reload after reattach
lectem

-plug in the joystick
-start testjoystick 0
-unplug
-replug

The joystick is detected but doesn't enter the loop anymore since done==SDL_TRUE
2015-02-10 20:40:03 +01:00
Philipp Wiesemann bd61c276fa Fixed compiling test with older C. 2015-02-10 20:31:05 +01:00
Philipp Wiesemann e3f9bf3378 Fixed two inconsistencies on failed allocation. 2015-02-08 22:50:16 +01:00
David Ludwig 78f3a80cf2 WinRT: made note that VSync is always enabled on WinPhone, due to OS
Windows Phone does not appear to allow VSync to be turned off.  Doing so appears
to either result in content not getting drawn (when the D3D debug runtime is
turned off), or forcing VSync back on and logging an error (when the D3D debug
runtime is turned on).

VSync had been getting turned on anyways, this change just notes such:
- via the WinRT README
- by always setting the SDL_RENDERER_PRESENTVSYNC flag when creating an
  SDL_Renderer on Windows Phone
2015-02-08 15:44:15 -05:00
Philipp Wiesemann fe586d077f Fixed three memory leaks on failed allocation. 2015-02-08 21:25:37 +01:00
Philipp Wiesemann c17a5b1177 Fixed bug 2866 - testrelative.c: patch to make the orange box wrap around
Eric Wasylishen

Here's a patch to make the 'testrelative' demo program more useful: it just makes the orange rectangle wrap around. Previously, the orange cursor would just disappear off screen if you move the mouse a lot in one direction, so it was hard to tell if relative mouse mode was still working.
2015-02-07 22:40:36 +01:00
Philipp Wiesemann 60329e6a1e Added missing guards. 2015-02-03 21:22:25 +01:00
Ryan C. Gordon 56edbb4062 X11: Add events related to maximizing a window (thanks, Andrei and Gergely!).
Fixes Bugzilla #1447.
2015-02-02 01:21:02 -05:00
Ryan C. Gordon ece8d2bb05 X11: Fixes for OpenGL 3.0 and later context creation.
- Don't create a temporary context first; this was probably due to Windows
needing one to get the address of wglCreateContextAttribsARB(), but that's
a unique quirk of WGL, and doesn't apply to glX. The glX spec explicitly says
you have to get a function pointer that works with any context from
glXGetProcAddress(), including when no context exists.

- Properly check for the GLX_ARB_create_context instead of just looking for a
non-NULL glXCreateContextAttribsARB()...some implementations, like Mesa,
never return NULL for function lookups (Mesa returns pointers into a jump
table that is filled out when the GL is initialized; since you can look up
functions before you have a valid context, it can't definitely say a function
isn't valid at that point).
2015-02-02 01:05:41 -05:00
Philipp Wiesemann 86f87bf755 Added missing guards in implementation for PSP.
Thanks to Martin Gerhardy for pointing this out.
2015-01-31 22:45:54 +01:00
Philipp Wiesemann d036ad84ae Added missing include statements in implementation for PSP.
SDL_internal.h should be included to support dynamic API and fix warnings.
2015-01-31 22:43:05 +01:00