4948 Commits

Author SHA1 Message Date
David Gow
25f9e32b0e wayland: Don't let multiple threads dispatch wayland events at once
wl_display_dispatch() will block if there are no events available, and
while we try to avoid this by using SDL_IOReady() to verify there are
events before calling it, there is a race condition between
SDL_IOReady() and wl_display_dispatch() if multiple threads are
involved.

This is made more likely by the fact that SDL_GL_SwapWindow() calls
wl_display_dispatch() if vsync is enabled, in order to wait for frame
events. Therefore any program which pumps events on a different thread
from SDL_GL_SwapWindow() could end up blocking in one or other of them
until another event arrives.

This change fixes this by wrapping wl_display_dispatch() in a new mutex,
which ensures only one thread can compete for wayland events at a time,
and hence the SDL_IOReady() check should successfully prevent either
from blocking.
2021-10-02 11:03:20 -04:00
Sam Lantinga
8b74575267 Added support for the gyro and accelerometer on Steam Controllers
Fixes https://github.com/libsdl-org/SDL/issues/4577
2021-10-01 21:32:21 -07:00
Sam Lantinga
db18764e41 Use correct relative include path 2021-10-01 16:27:59 -07:00
Sam Lantinga
632aca2945 Window input focus is based on WM_SETFOCUS and WM_KILLFOCUS as WM_ACTIVATE doesn't necessarily imply focus.
Hopefully resolves https://github.com/libsdl-org/SDL/issues/4450 and https://github.com/libsdl-org/SDL/pull/4293
2021-10-01 16:17:38 -07:00
Sam Lantinga
9706feacae Update length after shortening string (thanks mayraud705!)
Closes https://github.com/libsdl-org/SDL/pull/4698
2021-10-01 15:11:25 -07:00
Sylvain
77acd44f28
DirectFB: fixed creation of palette textures 2021-10-01 22:30:51 +02:00
Sylvain
83d600904b
DirectFB: add partial support for RenderGeometry
allow to fill triangles with color or texture
but only uniform vertex color is handled (not per vertex color)
2021-09-30 23:47:37 +02:00
Cameron Cawley
c270949b5e Add a fast path for ARGB888->(A)BGR888 blending with pixel alpha 2021-09-28 11:27:56 -07:00
Ryan C. Gordon
114d1d46ac
direct3d: Remove unnecessary render target support check.
Direct3D 9 dictates that caps.NumSimultaneousRTs must always be at least 1,
which is to say that Direct3D 9 level hardware must always support render
targets.

(caps.NumSimultaneousRTs is meant to show if you can draw to multiple render
targets in a single draw call.)

We had already hardcoded SDL_RENDERER_TARGETTEXTURE as available earlier in
the function anyhow.

Fixes #4781.
2021-09-27 23:18:25 -04:00
Ethan Lee
0fc43504a0 wayland: Add support for XCURSOR_THEME/SIZE 2021-09-27 16:41:43 -04:00
Martin Mauersics
7c050aa60a egl: Don't fail to create a context if KHR_create_context_no_error is unsupported 2021-09-27 13:53:16 -04:00
David Gow
35d045584d video: wayland: Support displays with a 0 refresh rate
Some wayland compositors report the refresh rate as 0. Since we want to
force a minimum refresh rate of 10 frames worth, we were dividing by the
reported refresh rate, causing a divide-by-zero.

If the refresh rate is 0, instead force a frame every second if no frame
callbacks are received.

This fixes bug #4785
2021-09-27 09:26:40 -04:00
Sam Lantinga
9672d58119 Need to check structure version before setting xdg_toplevel to NULL 2021-09-26 14:22:11 -07:00
Northfear
14f225198d Use SDL_calloc for allocation of gxm_texture 2021-09-26 14:16:35 -07:00
Cacodemon345
b592e78f93 wayland: Expose xdg_toplevel to SysWM 2021-09-26 05:53:21 -04:00
Sam Lantinga
477fcf52e9 Fixed whitespace 2021-09-24 10:49:46 -07:00
Sam Lantinga
db68af8032 Reduce the likelyhood that the mouse will hover over the taskbar or toast notification while in relative mode, which causes a mouse leave event.
This will still happen occasionally as the mouse is whipped around, if there is a window overlapping the game window, but it should happen less often now. This could even happen with the original code that warped the mouse every frame, so this should be a good compromise where we don't warp the mouse continously and we still keep the mouse in the safe area of the game window.

Note that notifications can be any size, so the safe area may need to be adjusted or even dynamically defined via a hint.
2021-09-24 10:49:44 -07:00
Ethan Lee
7ed415d2ed wayland: Reuse KeySymToUcs4 to replicate X11 keymap behavior 2021-09-23 11:50:47 -07:00
Ethan Lee
1a4e2e5ef7 wayland: For text, ignore key events when Ctrl is held
Fixes #4695
2021-09-23 14:34:39 -04:00
Ryan C. Gordon
0aff42a159
egl: Group data fields before function pointers in SDL_EGL_VideoData. 2021-09-23 00:03:26 -04:00
Ryan C. Gordon
0ad4956c06
egl: explicitly call eglBindAPI during SDL_GL_MakeCurrent.
The EGL API binding must be specified per-thread, per the docs.

Fixes #1820.
2021-09-23 00:03:25 -04:00
Ryan C. Gordon
3147716022
egl: make an int into an SDL_bool. 2021-09-23 00:03:25 -04:00
Sam Lantinga
4ec259a784 Fixed building on Visual Studio 2013 and older 2021-09-22 19:06:11 -07:00
Sam Lantinga
287571fb46 Limit effect of in_title_click and focus_click_pending to only blocking cursor warping; without this all relative mouse motion was getting ignored when a window was activated via a mouse button 2021-09-22 17:40:57 -07:00
Northfear
5292156398 End Scene on RunCommandQueue on Vita 2021-09-22 11:54:26 -07:00
Cameron Cawley
08ae790497 Replace calls to asprintf with SDL_asprintf 2021-09-22 11:53:46 -07:00
Cameron Cawley
25a614bc3e Add SDL_asprintf and SDL_vasprintf 2021-09-22 11:53:46 -07:00
Sam Lantinga
79b0aae86c The return value of SDL_snprintf is the number of characters that would have been written.
Fixes https://github.com/libsdl-org/SDL/issues/4762
2021-09-22 11:46:24 -07:00
Ethan Lee
9b74623be9 wayland: Woops, forgot to assign cursor theme size... 2021-09-22 13:52:36 -04:00
Ethan Lee
8e54698aa6 wayland: Add support for high-DPI cursors 2021-09-22 10:37:42 -07:00
Sam Lantinga
432ee7d8ad Fixed building SDL_dynapi.c without stdio support 2021-09-22 09:29:21 -07:00
Sam Lantinga
345c161feb Fixed some accidental uses of external C runtime functions 2021-09-22 09:06:45 -07:00
Sam Lantinga
5d455cabf9 Don't process raw input when the window is being dragged or clicked on. 2021-09-21 18:15:11 -07:00
Sam Lantinga
0fd54f91f4 Fixed using a tablet with raw input relative motion
Tested with a Wacom Cintiq Pro 16"
2021-09-21 18:15:11 -07:00
Sam Lantinga
8fee82d1fd Improve relative motion handling over RDP
CR and research: @danielj
2021-09-21 18:15:09 -07:00
Sam Lantinga
eb3bf80f9c Fixed compiler warnings using Visual Studio 2019 2021-09-21 18:15:09 -07:00
Ryan C. Gordon
ce11caa80f
alsa: Map 7.1 audio channels to match what Windows and macOS expect.
This matches what we did a long time ago for 5.1 audio.

Fixes #55.

(FIFTY FIVE. Bug reported 15 years, 3 months, and 11 days ago! lol)
2021-09-21 16:49:44 -04:00
pkubaj
9886d897e2 Fix AltiVec detection on FreeBSD
The previous code was not correct, because there's no PPC_FEATURE_HAS_ALTIVEC MIB.
Instead, elf vector check should be done.
2021-09-21 09:57:10 -07:00
Ryan C. Gordon
c45facf2ca
alsa: clean up macro salsa a little. 2021-09-21 11:13:46 -04:00
Northfear
3b2fbb1cb7 End current scene before destroying the texture on Vita 2021-09-20 15:55:36 -07:00
Northfear
fc4296c114 Use aligned stride in sceGxmColorSurfaceInit 2021-09-20 13:23:42 -07:00
Northfear
7080bc2a91 Fallback to SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE if CDRAM texture allocation fails 2021-09-20 13:23:42 -07:00
Ivan Epifanov
512355d7aa Vita: fix thread detach. Remove leftover KillThread 2021-09-20 11:03:02 -07:00
Ivan Epifanov
ddcd847c8e Vita: fix thread priority Add support for thread name and stack size 2021-09-20 08:59:25 -07:00
Ryan C. Gordon
478f9eed28
x11: Don't include X11/extensions/extutil.h
We don't use it, it was a leftover from 1.2, I think, and it doesn't exist
on Solaris, so this should hopefully fix the build there.

This also means we don't need the configure/cmake checks for
SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY, so that was removed also.

Fixes #1666.
2021-09-20 10:22:50 -04:00
Ryan C. Gordon
ca9a321715
render: GL/GLES now draw lines almost perfectly matching software renderer.
One place known to differ in a significant way is a single line segment that
starts and ends on the same point; the GL renderers will light up a single
pixel here, whereas the software renderer will not. My current belief is this
is a bug in the software renderer, based on the wording of the docs:

"SDL_RenderDrawLine() draws the line to include both end points."

You can see an example program that triggers that difference in Bug #2006.

As it stands, the GL renderers might _also_ render diagonal lines differently,
as the the Bresenham step might vary between implementations (one does three
pixels and then two, the other does two and then three, etc). But this patch
causes those lines to start and end on the correct pixel, and that's the best
we can do, and all anyone really needs here.

Not closing any bugs with this patch (yet!), but here are several that it
appears to fix. If no other corner cases pop up, we'll call this done.

Reference Bug #2006.
Reference Bug #1626.
Reference Bug #4001.
...and probably others...
2021-09-19 15:47:24 -04:00
Ryan C. Gordon
857cc7c0c9
render: constified some local variables in SDL_AllocateRenderVertices. 2021-09-19 00:38:06 -04:00
Ryan C. Gordon
5faea84c63
render: Mark viewport/cliprect dirty when window is resized.
Fixes #4751.
2021-09-18 11:54:25 -04:00
Cameron Gutman
5dccffd7e4 Allow usage of the new Condition Variable code with Critical Sections
Vista and later provide the SleepConditionVariableCS() function for this.

Since SDL_syscond_srw.c doesn't require SRW locks anymore, rename it to
SDL_syscond_cv.c which better reflects the implementation of condition
variables rather than the implementation of mutexes.

Fixes #4051.
2021-09-17 19:38:09 -04:00
Alex R
ebdfd0e175 atomic: detect clang separately 2021-09-16 17:33:52 -07:00