Commit Graph

3454 Commits (500378eb5288ca6381de1f8b3dde3f9f3fef50cc)

Author SHA1 Message Date
Sam Lantinga 6e1b11bae4 Fixed bug 3714 - Windows: SDL_WINDOW_FULLSCREEN_DESKTOP broken on 3 monitor setup w/ DPI scaling
Eric Wasylishen 2017-07-26 18:42:58 UTC
I set up an (admittedly exotic) 3-monitor setup, and when I enter fullscreen-desktop on the middle display (#2), the SDL window is off center. (covers half of monitor #2 and most of monitor #3).

The displays are arranged from left to right:

Display #1 (main): 2880x1800, 200% scaling
Display #2: 1920x1200, 150% scaling
Display #3: 1920x1080, 100% scaling

SDL display bounds:
INFO: Bounds: 1440x900 at 0,0
INFO: Bounds: 1281x801 at 1921,0  (these are incorrect)
INFO: Bounds: 1920x1080 at 4800,0

Correct bounds reported by calling EnumDisplayMonitors and printing the LPRECT param of the callback:
1440x900 at (0, 0)
1280x800 at (2880, 0)
1920x1080 at (4800, 0)

It seems like you need 3 displays to reproduce this, and the left two need DPI scaling, and the 3rd display needs to have a different scale factor than the others.

Related: https://bugzilla.libsdl.org/show_bug.cgi?id=3709

SDL: current hg (11235:6a587b9e0ec8)
Windows 10, Version 10.0.15063 Build 15063
Tested with testdraw2 and testgl2, and pressing alt+enter to enter fullscreen desktop.

This patch reworks SDL_windowsmodes.c to use EnumDisplayMonitors instead of EnumDisplayDevices, so we always have an HMONITOR for each SDL display.

With access to an HMONITOR, we can get the monitor bounds in virtual screen coordinates the proper way, by calling GetMonitorInfo. (whereas the original code was doing some calculations - e.g. "data->DeviceMode.dmPosition.x * data->ScaleX" - to try to get virtual screen coordinates. These worked in simple cases, but failed in more complex cases like this bug)

The one potential problem with my patch is, the ChangeDisplaySettingsEx docs say that you're supposed to get the display name from EnumDisplayDevices, but I'm getting the display name from GetMonitorInfo now.
2017-08-11 10:18:45 -07:00
Sam Lantinga a05522a089 Fixed bug 3723 - Possible double free in kmsdrm init code on certain errors
Simon Hug

KMSDRM_VideoInit allocates and frees some connectors and encoders but doesn't set the pointer to NULL after freeing. The cleanup code at the end may free one of those garbage pointer should an error happen in the initialization.
2017-08-11 10:05:45 -07:00
Sam Lantinga d0b46f1bea Fixed bug 3681 - SDL_UpateTexture documentation not specific enough about format requirement
Simon Hug

The documentation of SDL_UpateTexture does not say that the pixel data has to be in the format of the texture.
2017-08-10 11:57:19 -07:00
Sam Lantinga 843293bed0 Fixed bug 3701 - WM_TOUCH message may cause calls to null if touch functions are not properly loaded
Simon Hug

When WIN_WindowProc processes the WM_TOUCH message, it doesn't check if the touch functions have been properly loaded and may call a NULL pointer. It's probably an extremely rare case, but here's a patch that adds some checks anyway.
2017-08-09 20:26:16 -07:00
Sam Lantinga a47bf37464 Fixed bug 3728 - [Android] crash when shared libraries are no loaded
Sylvain

On Android, when shared libraries are not correctly loaded (eg SDLActivity.mBrokenLibraries is true), there is a pop-up with an error message.

After user dismisses the pop-up, application crashes:
- because the native function "nativePause()" may no be loaded (if libSDL2.so is not loaded).
- because mSurface is null.
2017-08-09 20:23:48 -07:00
Sam Lantinga af44a5953a Fixed bug 3672 - Add joystick to controllerdb
Moritz M-H

The following entry needs to be added to the gamecontrollerdb for the Qanba fighter stick under linux
2017-08-09 20:20:35 -07:00
Ryan C. Gordon 73c6cebb80 cmake: Pacify warning about Policy CMP0042 not being set. 2017-08-09 22:43:16 -04:00
Ryan C. Gordon 80c6c2fa76 cmake: whoops, Sam and I both fixed this bug at the same time. :) 2017-08-09 22:34:45 -04:00
Sam Lantinga 496337b3cf Fixed bug 3651 - CMake build does not install CMake package configuration
tschwinger@elitemail.org

Most ironically, although autoconf/automake-based builds install (pretty half-assed) CMake package configuration files, they're missing in installations resulting from CMake-based builds entirely.

A proper configuration file typically also loads target exports (implemented in patch 3572, also fixing this issue - see my comment on that issue for details).

I believe it would be best to let the dinosaurs go extinct and redirect all build efforts to the CMake end for two reasons:

1. It potentially provides the best user experience, but you'd have to give it some love and ship with less quirky buildfiles.

2. It would force distros to build SDL via CMake and thus would ensure target exports are actually available everywhere.

Various CMake patches I submitted today in summary (directly converted from the HG commits and `am`d onto a fork of a git mirror that happened to be on `tip`).

    https://github.com/tschw/SDL/commits/patched

Fixing #2576 #3572, #3613, and this fresh ticket, which is almost entirely advertisement ;).

These already do to make SDL much less of a quirky fella to have in your dependency tree...
2017-08-09 19:03:10 -07:00
Sam Lantinga d3af447ee5 Fixed bug 3590 - CMAKE: typos in CheckMir
Martin Gerhardy

-            list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS})
+            list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CFLAGS} ${XKB_CFLAGS})

CFLAGS is spelled wrong in two different ways for EGL and XKB

And while you are on it...

sdl needs mir >= 0.24 afaik - it fails on travis-ci (ubuntu 14.04 LTS with 0.18 installed and in other environments, too (e.g. https://github.com/urho3d/Urho3D/issues/1685)

To fix this one should add a min version check to pkg_check_modules like this

-        pkg_check_modules(MIR_TOOLKIT mirclient mircommon)
+        pkg_check_modules(MIR_TOOLKIT mirclient>=0.24 mircommon)
2017-08-09 18:47:33 -07:00
Ryan C. Gordon 1b8117be21 cmake: Don't link directly against a libpthread on Android (thanks, Anthony!).
Android has pthreads, but it's just part of their C runtime instead of a
separate library like the usual Linux platforms.

Fixes Bugzilla #3675.
2017-08-09 19:50:18 -04:00
Olli Kallioinen 2b5a5c510b Android build fixes
-Enabling checking for GCC_ATOMICS also on clang by default. This way all Android ABIs build successfully
 -Android cmake: Threading was not enabled correctly
 -Android cmake: Timers and dynamic lib loading were not included in the sources
2017-06-08 22:07:55 +03:00
Sam Lantinga 53d4f5c9fc Fixed bug 3733 - Makefile sleeps for 3 seconds if configure is out of date 2017-08-09 16:20:04 -07:00
Ryan C. Gordon 2d67381a95 haiku: non-x86 spins use a normal libstdc++ filename. Handle the differences.
Fixes Bugzilla #3730.
2017-08-09 18:41:59 -04:00
Ryan C. Gordon 69092c7e47 haiku: Fixed compiler warning. 2017-08-09 18:30:48 -04:00
Sam Lantinga 03250690d6 Added a private hint for Steam to bypass the controller filtering for the Steam virtual gamepad 2017-08-09 12:38:20 -07:00
Sam Lantinga f15dbc8f63 Fixed Linux build 2017-08-09 12:11:59 -07:00
Sam Lantinga c49fa37c5b Added SDL hints to filter the set of game controllers reported by SDL 2017-08-09 11:59:29 -07:00
Sam Lantinga dc40018438 Added an API SDL_LoadFile_RW() to load all the data from an SDL data stream, and a convenience macro SDL_LoadFile() to load all the data from a file. 2017-08-09 11:58:38 -07:00
Ryan C. Gordon a412ba0d75 haiku: Patched SDL_bopengl.cc to compile on x86-64 Haiku.
Fixes Bugzilla #3729.
2017-08-09 01:01:41 -04:00
Ryan C. Gordon d5215d9df9 Fixed up some compile warnings and errors on x86-64 Haiku. 2017-08-09 00:56:05 -04:00
Ryan C. Gordon 64c2957735 Added a FIXME for 2.1 about an API change. 2017-08-09 00:55:27 -04:00
Sam Lantinga 4e43c631b8 Re-added missing entry for the Steam Virtual Gamepad (was Valve Streaming Gamepad) 2017-08-08 20:38:23 -07:00
Sam Lantinga ef54d5a8f0 Fixed building on various versions of GCC - YUV MMX code is disabled for now 2017-08-07 10:28:59 -07:00
Ryan C. Gordon 76306827ec README-linux.md: added libsndio-dev to the package list. 2017-08-07 00:36:45 -04:00
Ryan C. Gordon 9dde37eadb sndio: Fix for some platforms (Linux, for example) that don't define INFTIM.
Fixes Bugzilla #3712.
2017-08-07 00:25:18 -04:00
Philipp Wiesemann 27de835dd2 emscripten: Fixed compiler warnings about integer to pointer conversions.
Found by buildbot.
2017-08-05 22:10:55 +02:00
Philipp Wiesemann 711df8a989 emscripten: Fixed compiling without OpenGL support. 2017-08-05 22:10:48 +02:00
Philipp Wiesemann f216b446aa kmsdrm: Fixed crashes if allocating memory failed. 2017-08-05 22:10:36 +02:00
Philipp Wiesemann b8a7dd7788 nacl: Fixed freeing static memory on video quit. 2017-08-05 22:10:25 +02:00
Philipp Wiesemann 1f698469ae mir: Removed unnecessary function declaration. 2017-08-05 22:10:15 +02:00
Philipp Wiesemann e9ae411aee Updated generated configure script. 2017-08-04 23:01:01 +02:00
Philipp Wiesemann 4723943bc3 kmsdrm: Fixed compiling without OpenGL support. 2017-08-04 23:00:47 +02:00
Philipp Wiesemann 8aa147fa09 Fixed compiler warnings about type conversions.
Found by buildbot.
2017-08-04 23:00:30 +02:00
Ryan C. Gordon a09efc73d2 psp: Force audio channels to stereo if > 2 channels requested (thanks, Solra!).
Fixes Bugzilla #3726.
2017-08-04 16:18:34 -04:00
Sam Lantinga cc5ceb1165 Temporary hack to fix bug 3725 - Call made to glGetString before context creation
This breaks bugs 2570, 3145
2017-08-04 13:06:56 -07:00
Sam Lantinga 56cab6d452 Added a hint SDL_HINT_TOUCH_MOUSE_EVENTS to control whether touch events generate synthetic mouse events. 2017-08-03 09:48:44 -07:00
Brandon Schaefer 86e95a607b kmsdrm: Fix tearing in neverputt/ball
https://gfycat.com/FatalFarawayHeron
2017-08-02 17:45:15 -07:00
Patrice Mandin c544d2b954 Add support for Saitek P990 Dual Analog Pad 2017-08-02 23:42:08 +02:00
Brandon Schaefer fca91451ba kmsdrm: Fix leaking SDL_VideoDevice* 2017-08-02 13:51:14 -07:00
Sam Lantinga 9dbe5a9686 Fixed bug 3311 - Broken touch positions with SDL_RenderSetLogicalSize & HIGHDPI on iOS
Eric wing

Hi, I think I found a bug when using SDL_WINDOW_ALLOW_HIGHDPI with SDL_RenderSetLogicalSize on iOS. I use SDL_RenderSetLogicalSize for all my stuff. I just tried turning on SDL_WINDOW_ALLOW_HIGHDPI on iOS and suddenly all my touch/mouse positions are really broken/far-off-the-mark.

I actually don't have a real retina device (still) so I'm seeing this using the iOS simulator with a 6plus template.

Attached is a simple test program that can reproduce the problem. It uses RenderSetLogicalSize and draws some moving happy faces (to show the boundaries/space of the LogicalSize and that it is working correctly for that part).

When you click/touch, it will draw one more happy face where your button point is.

If you comment out SDL_WINDOW_ALLOW_HIGHDPI, everything works as expected. But if you compile with it in, the mouse coordinates seem really far off the mark. (Face appears far up and to the left.)


Alex Szpakowski on the mailing list suggests the problem is
"I believe this is a bug in SDL_Render?s platform-agnostic mouse coordinate scaling code. It assumes the units of the mouse coordinates are always in pixels, which isn?t the case where high-DPI is involved (regardless of whether iOS is used) ? they?re actually in ?DPI independent? coordinates (which matches the window size, but not the renderer output size)."

Additionally, if this is correct, the Mac under Retina is also probably affected too and "as well as any other platform SDL adds high-dpi support for in the future".
2017-08-02 13:38:46 -07:00
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
Sam Lantinga 4be066707d Fixed potential free of uninitialized memory (thanks Simon!) 2017-08-02 10:24:47 -07:00
Sam Lantinga 56363ebf61 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
Ryan C. Gordon 2ffd6d0208 x11: Make a separate unmapped window to own clipboard selections.
Now the clipboard isn't lost if you destroy a specific SDL_Window, as it
works on other platforms. You will still lose the clipboard data on
SDL_Quit() or process termination, but that's X11 for you; run a
Clipboard Manager daemon.

Fixes Bugzilla #3222.
Fixes Bugzilla #3718.
2017-07-31 13:49:22 -04:00
Sam Lantinga 997c69b9ef Fixed bug 3697 - Main thread gets stuck on left mouse down
Eric Wasylishen

I think I found a better fix.

The problem with https://hg.libsdl.org/SDL/rev/ebdc0738b1b5 is setting the styleMask to 0 clears the NSWindowStyleMaskFullScreen bit, which then confuses Cocoa later when you try to leave fullscreen. Instead I'm just clearing the NSWindowStyleMaskResizable bit, although SetWindowStyle(window, NSWindowStyleMaskFullScreen); seems to also work.
2017-08-01 20:16:10 -07:00
Sam Lantinga 6391cc3fef Backed out changeset ebdc0738b1b5 for bug 3697
Eric Wasylishen

Unfortunately this commit seems to have broken exiting desktop-fullscreen.
- Launch testgl2.
- Press alt+enter to go fullscreen-desktop
- Press alt+enter again. The spinning cube will freeze, and the window stays fullscreen desktop.
2017-08-01 20:09:23 -07:00
Sam Lantinga e10a98d2ad Fixed bug 3720 - SDL_GL_GetAttribute doesn't check for initialized video driver
Simon Hug

SDL_GL_GetAttribute doesn't check if a video driver has been initialized and will access the SDL_VideoDevice pointer, which is NULL at that point.

I think all of the attributes require an initialized driver, so a simple NULL check should fix it. Patch is attached.
2017-07-31 12:57:15 -07:00
Ryan C. Gordon ee3f11d545 Disable static builds for static analysis.
There's really no sense in analyzing everything twice, and this makes the
job finish significantly faster.
2017-07-30 14:36:01 -04:00
Ryan C. Gordon 1f016d4598 windows-buildbot-zipper.bat: Check the correct path. 2017-07-30 14:09:18 -04:00