Commit Graph

111 Commits

Author SHA1 Message Date
sezero
7287068da5 revert the recent typecast assignment changes (see bug #4079)
also change the void* typedefs for the two vulkan function
pointers added in vulkan_internal.h  into generic function
pointer typedefs.
2018-02-12 17:00:00 +03:00
Sam Lantinga
49ae998d51 Fixed ISO C99 compatibility
SDL now builds with gcc 7.2 with the following command line options:
-Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
2018-01-30 18:08:34 -08:00
Sam Lantinga
a9072159b2 Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga
6224870504 Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h 2017-08-28 00:43:14 -07:00
Sam Lantinga
7bb3adf896 Renaming of guard header names to quiet -Wreserved-id-macro 2017-08-28 00:22:23 -07:00
Sam Lantinga
6f44ae30a4 Fixed bug 2293 - Precise scrolling events
Martijn Courteaux

I implemented precise scrolling events. I have been through all the folders in /src/video/[platform] to implement where possible. This works on OS X, but I can't speak for others. Build farm will figure that out, I guess. I think this patch should introduce precise scrolling on OS X, Wayland, Mir, Windows, Android, Nacl, Windows RT.

The way I provide precise scrolling events is by adding two float fields to the SDL_MouseWheelScrollEvent datastructure, called "preciseX" and "preciseY". The old integer fields "x" and "y" are still present. The idea is that every platform specific code normalises the scroll amounts and forwards them to the SDL_SendMouseWheel function. It is this function that will now accumulate these (using a static variable, as I have seen how it was implemented in the Windows specific code) and once we hit a unit size, set the traditional integer "x" and "y" fields.

I believe this is pretty solid way of doing it, although I'm not the expert here.

There is also a fix in the patch for a typo recently introduced, that might need to be taken away by the time anybody merges this in. There is also a file in Nacl which I have stripped a horrible amount of trailing whitespaces. (Leave that part out if you want).
2017-08-14 21:28:04 -07:00
Sam Lantinga
6abff120fd Fixed bug 3690 - SDL2 KMS/DRM render context support
Manuel

The attached patch adds support for KMS/DRM context graphics.

It builds with no problem on X86_64 GNU/Linux systems, provided the needed libraries are present, and on ARM GNU/Linux systems that have KMS/DRM support and a GLES2 implementation.
Tested on Raspberry Pi: KMS/DRM is what the Raspberry Pi will use as default in the near future, once the propietary DispmanX API by Broadcom is overtaken by open graphics stack, it's possible to boot current Raspbian system in KMS mode by adding "dtoverlay=vc4-kms-v3d" to config.txt on Raspbian's boot partition.
X86 systems use KMS right away in every current GNU/Linux system.

Simple build instructions:

$./autogen.sh
$./configure --enable-video-kmsdrm
$make
2017-08-02 10:22:48 -07:00
Philipp Wiesemann
f565e59fd8 winrt: Fixed SDL include. 2017-06-24 23:45:44 +02:00
Philipp Wiesemann
63db7e414d Removed newlines from error messages. 2017-03-26 21:00:19 +02:00
David Ludwig
3425d72450 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
d77ab77a7a Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga
7f0b81eebd 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
Sam Lantinga
04c2e22b30 Fixed a bunch of SwapWindow calls that needed their return value updated 2016-12-09 05:12:27 -08:00
Philipp Wiesemann
6162816977 WinRT: Corrected header file guard comment. 2016-11-05 21:22:58 +01:00
David Ludwig
2de39f53fb WinRT: added an extra NULL pointer check for SDL_*ScreenSaver() backend code 2016-08-31 12:52:55 -04:00
David Ludwig
3ea11f6b0e WinRT: added SDL_*ScreenSaver() support; fixed crash when restoring app from screensaver 2016-08-29 20:27:21 -04:00
David Ludwig
94792eaa5b WinRT: fixed bug where Win10 GameBar, when shown + hidden, might not restore a cursor's hidden state
The repro steps were this:
1. run an sdl2 winrt/uwp app, on Win10, v10.0.10586.0 or higher
2. hide the cursor, via a call to SDL_ShowCursor(0)
3. make the Win10 game bar appear, by pressing the Windows + G hotkey
4. observe that the mouse cursor appears, in order to interact with the
   game bar (this is expected behavior)
5. make the Win10 game bar disappear, either by pressing the Windows + G hotkey
   again, or clicking somewhere in the app

EXPECTED RESULT: cursor disappears, as game bar disappears

ACTUAL RESULT: cursor didn't always disappear
2016-08-20 13:46:45 -04:00
Philipp Wiesemann
46eb4f59f2 WinRT: Removed not needed SDL_zerop() after SDL_calloc().
SDL_calloc() already sets memory to zero.
2016-08-03 22:32:02 +02:00
David Ludwig
5ce0bfa718 WinRT: workaround a possible Windows bug, whereby hiding cursors, disables mouse-moved events
This workaround, unfortunately, requires that apps directly link to a set of
Win32-style cursor resource files (that contain a transparent cursor image).
Copies of suitable resource files are in src/core/winrt/, and should be
included directly in an app's MSVC project.

A rough explanation of this workaround/hack, and why it's needed (and
seemingly can't be done through programmatic means), is in this change's code.
2016-05-14 23:29:49 -04:00
David Ludwig
88ca3da8de WinRT: allow on-screen keyboard to be shown via SDL APIs, Win10/UWP only 2016-05-07 21:41:59 -04:00
David Ludwig
48da9275f9 WinRT: build/link fix 2016-04-13 21:59:50 -04:00
Ryan C. Gordon
b0c0d27997 Patched to compile on various platforms. 2016-04-12 18:11:36 -04:00
Ryan C. Gordon
5006582bed threads: Move SDL's own thread creation to a new internal API.
This allows us to set an explicit stack size (overriding the system default
and the global hint an app might have set), and remove all the macro salsa
for dealing with _beginthreadex and such, as internal threads always set those
to NULL anyhow.

I've taken some guesses on reasonable (and tiny!) stack sizes for our
internal threads, but some of these might turn out to be too small in
practice and need an increase. Most of them are simple functions, though.
2016-04-12 16:45:10 -04:00
Philipp Wiesemann
b32cb8cb55 WinRT: Removed dead code and fixed memory leak if allocation for driver failed. 2016-03-10 21:00:44 +01:00
Sam Lantinga
255c182471 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
David Ludwig
0343811914 WinRT: minor code-comment cleanups 2015-12-31 01:54:11 -05:00
David Ludwig
c29d30d4a7 WinRT: Fixed bug 3210, "alt-tab doesn't work correctly with full-screened, UWP (Win10 Store) apps" 2015-12-22 00:58:47 -05:00
David Ludwig
58a4cb1af5 WinRT: build fix for Windows Phone 8.0 2015-12-06 18:48:46 -05:00
David Ludwig
69224a6092 WinRT: enabled the Win10-Store Cert Kit bug-workaround, for Windows 8.0 apps 2015-12-06 18:42:30 -05:00
David Ludwig
5bd1d35f2c WinRT: enabled the Win10-Store Cert Kit bug-workaround, for Windows 8.1 apps 2015-12-06 18:33:43 -05:00
David Ludwig
aa85d1c457 WinRT: fixed a build error when compiling Windows 8.1 .dlls 2015-12-06 17:32:33 -05:00
David Ludwig
9ea123ba58 WinRT: removed an unused variable from DXGI-based display-detection code 2015-12-06 17:07:37 -05:00
David Ludwig
13269309e5 WinRT: workaround for a possible bug in the Win10 Store's Certification Kit
DXGI fails to report any displays in at least one of the
"Windows App Certification Kit 10.0"'s tests for Store Apps.  This was
causing SDL's video initialization code to fail, when the suspect test
("Direct3D Feature Test") was run, as DXGI was unable to report a
display-output at adapter-index 0, output-index 0.

The workaround that is applied here attempts to detect this case, then
use a hopefully-reasonable alternative means to calculate at least one
display output.
2015-12-06 17:06:40 -05:00
David Ludwig
574e672678 WinRT: added Win10/UWP (Universal Windows Platform) support
"UWP" appears to be Microsoft's new name for WinRT/Windows-Store APIs.

This set of changes updates SDL's WinRT backends to support the Win10 flavor
of WinRT.  It has been tested on Win10 on a desktop.  In theory, it should
also support Win10 on other devices (phone, Xbox One, etc.), however further
patches may be necessary.

This adds:
- a set of MSVC 2015 project files, for use in creating UWP apps
- modifications to various pieces of SDL, in order to compile via MSVC 2015 +
  the Win10 API set
- enables SDL_Window resizing and programmatic-fullscreen toggling, when using
  the WinRT backend
- WinRT README updates
2015-11-29 19:33:11 -05:00
David Ludwig
5c998e8b36 WinRT: minor code cleanup in window-creation code
Window flags can be detected on all WinRT platforms.
2015-11-26 11:15:43 -05:00
David Ludwig
1dfde4397a WinRT: native windows are inherently resizable (in WinRT 8.x) 2015-11-26 11:09:50 -05:00
David Ludwig
75e4d044c1 WinRT: bug-fix, fullscreen mode wasn't getting reported in Windows 8.0 apps
This bug did not occur in Windows 8.1 apps, just Windows 8.0.
2015-11-26 02:37:51 -05:00
David Ludwig
929ab9a3db WinRT: bug-fix, OpenGLES2 was failing to init, after recent windowing fixes
Some SDL_Window flags were getting lost inside WINRT_UpdateWindowFlags, namely
SDL_WINDOW_OPENGL.
2015-11-26 02:13:15 -05:00
David Ludwig
4c2c6ca7aa WinRT: bug-fix, fullscreen window flags weren't set if device was rotated 90 degrees 2015-11-26 01:36:36 -05:00
David Ludwig
64a721b2dd WinRT: lots of display and windowing related fixes
This change-set fixes a lot of windowing related bugs, especially with
regards to Windows 8.x apps running on Windows 10 (which was the driver for
this work).  The primary fixes include:
* listed display modes were wrong, especially when launching apps into a
  non-fullscreen space
* reported window flags were often wrong, especially on Windows 10
* fullscreen/windowed mode switches weren't failing (they are not
  programmatically possible in Win 8.x apps).
2015-11-26 00:41:39 -05:00
Philipp Wiesemann
b4626634fe Fixed comments at conditional compilation macros. 2015-06-05 19:41:18 +02:00
Sam Lantinga
78f2198e6c Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Philipp Wiesemann
6709176247 WinRT: Fixed format string for error message. 2015-04-13 20:52:18 +02:00
David Ludwig
388977ede4 WinRT: made OpenGL window-init work with latest round of ANGLE/WinRT updates
Various constants in ANGLE/WinRT, both in MSOpenTech's ms-master branch, and
in Google's branch, were changed again.  This change makes SDL/WinRT work with
them.

To note, the ms-master branch (of ANGLE) was updated via this merge:
bbd2eb0a9c (diff-d1377fbe747de154e1bfcf7221d3de67)
2015-03-17 19:45:47 -04:00
David Ludwig
4d6ae75723 WinRT: another ANGLE/OpenGL-initialization, error messaging tweak 2015-03-17 10:25:21 -04:00
David Ludwig
72c36417e7 WinRT: ANGLE/OpenGLES-initialization, error message improvements 2015-03-17 10:22:36 -04:00
David Ludwig
f61306873a WinRT: a minor, nit-picky cleanup of some OpenGL code 2015-02-15 12:11:44 -05:00
David Ludwig
39f669e5d1 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
David Ludwig
f64587cf07 WinRT: fixed crash when using up-to-date versions of ANGLE/WinRT 2015-02-15 00:08:27 -05:00
Edward Rudd
835d487683 add in support for passing down the "natural" (or flipped) scrolling direction in the MouseWheelEvent event 2014-12-03 11:00:56 -05:00