Commit graph

74 commits

Author SHA1 Message Date
Sam Lantinga 082f32d198 Fixed bug 3722 - Fall back to xinerama/xvidmode if xrandr modes initialization fails
Levi Bard

In some environments, xrandr modes initialization can fail even though xrandr support is present and of a sufficient version.
(The one I encountered was an AWS instance running a virtual display)

The attached patch allows SDL to keep trying other methods if xrandr modes initialization fails (still subject to SDL_VIDEO_X11_REQUIRE_XRANDR).
2017-08-02 10:28:13 -07:00
Ryan C. Gordon 61a3ba303c Replaced a few single-line "//" comments. 2017-01-07 17:09:14 -05:00
Ryan C. Gordon 9d04205263 x11: deal with xrandr display size in millimeters being zero.
Xquartz on macOS reports a zero size, which leads to a division by zero here.
2017-01-04 09:33:47 -05:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga 57d01d7d67 Patch from Sylvain to fix clang warnings 2016-11-13 22:57:41 -08:00
Sam Lantinga 74e1dd4c6f Define _GNU_SOURCE when building SDL 2016-11-11 13:14:00 -08:00
Sam Lantinga d780031277 Fixed bug 3476 - round() needs _GNU_SOURCE on some old systems
Ozkan Sezer

On systems with old glibc, such mine with glibc-2.8, the following warning
is issued and is fixed easily by defining _GNU_SOURCE:

/home/me/SDL2-2.0.5/src/video/x11/SDL_x11modes.c: In function 'CalculateXRandRRefreshRate':
/home/me/SDL2-2.0.5/src/video/x11/SDL_x11modes.c:263: warning: implicit declaration of function 'round'
/home/me/SDL2-2.0.5/src/video/x11/SDL_x11modes.c:263: warning: incompatible implicit declaration of built-in function 'round'
2016-11-06 09:30:06 -08:00
Sam Lantinga 27d4f09929 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
Sam Lantinga 0250eb3c4f Fixed bug 3134 - CalculateXRandRRefreshRate() returns incorrect refresh rate due to floating point truncation.
Michael

In SDL_x11modes.c the CalculateXRandRRefreshRate() function performs integer math on values that may return fractional results. This causes a value that would be calculated as 59.99972... to be returned as 59. In Linux the xrandr command returns 60Hz for this particular display mode yet SDL returns 59Hz.

I suggest this function be updated to correctly round the result of the calculation instead of truncating the result.
2016-10-01 14:16:04 -07:00
Philipp Wiesemann 81235118ab X11: Fixed missing error message if SDL_GetDisplayDPI() failed. 2016-05-20 22:14:40 +02:00
Ryan C. Gordon eeb899999f Patched to compile. 2016-01-05 05:22:35 -05:00
Ryan C. Gordon 7605ccf68a Use SDL's stdinc functions instead of C runtime calls. 2016-01-05 02:29:16 -05:00
Ryan C. Gordon c3114975db Added SDL_GetDisplayUsableBounds(). 2016-01-04 23:52:40 -05:00
Ryan C. Gordon 81209acbd8 x11: Let apps specify that video init should fail if XRandR is unavailable.
Notably: it sets the error string to inform you that your custom SDL is built
without xrandr support, which apparently has been a support issue for
Unreal Engine 4 developers.
2016-01-04 23:44:27 -05:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Ryan C. Gordon 18c7d6df21 XRandR: fixed primary output detection logic (thanks, "winterknight"!).
Fixes Bugzilla #3185.
2015-12-29 02:16:14 -05:00
Philipp Wiesemann 32147ba780 X11: Fixed memory leak when initializing multiple screens. 2015-12-05 17:08:07 +01:00
Ryan C. Gordon 5224dfcc9a X11: Let XRandR respect multiple screens (DISPLAY=:0.0 vs :0.1, etc). 2015-11-17 12:15:35 -05:00
Ryan C. Gordon c67213f331 X11: Fixed XRandR display detection.
Previously this only worked on X11 when Xinerama was carrying the weight.

Fixes Bugzilla #3062.
2015-08-07 01:02:35 -04:00
Ryan C. Gordon ca46804210 X11: Fixed a memory leak when adding duplicate display modes. 2015-08-07 00:59:31 -04:00
Alfred Reynolds dc2e9ba13b Fix build. 2015-07-29 17:19:04 -07:00
Alfred Reynolds 51c72e10f7 Add X11 implementation of SDL_GetDisplayDPI. 2015-07-29 17:19:02 -07:00
Ryan C. Gordon 1e3c28ac64 X11: Added a test for a weird X11 error we get with Xinerama, rarely. 2015-06-30 15:00:48 -04:00
Philipp Wiesemann 0e45984fa0 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