Sam Lantinga
4b71962031
Prevent overdraw with connected line segments
2022-01-08 12:02:30 -08:00
Sam Lantinga
09ece861d1
Added the hint SDL_HINT_RENDER_LINE_METHOD to select the line rendering method
2022-01-08 11:36:52 -08:00
Sam Lantinga
c1e6079836
As an optimization, draw horizontal and vertical lines using rectangles
2022-01-08 11:09:11 -08:00
Sam Lantinga
3da7c6305a
Assert that we have drawn the expected number of points
2022-01-08 11:07:03 -08:00
Sam Lantinga
9f56faeedc
Added line drawing using Bresenham's line algorithm (thanks @rtrussell!)
2022-01-08 10:59:31 -08:00
Sam Lantinga
fe3a33a092
Use RenderGeometry for drawing lines at all scales
2022-01-08 10:10:18 -08:00
Sam Lantinga
1694782b2a
Remove redundant work when render scale is 1.0
2022-01-08 09:32:23 -08:00
Sam Lantinga
2026a78dc2
Don't flush in RenderDraw*WithRects()
...
This allows these functions to be reused in the future for other primitives
2022-01-08 09:23:58 -08:00
Sam Lantinga
18e4d9fed1
Re-enable line drawing path in render drivers
...
This is still used for scaled line drawing in RenderDrawLinesWithRects()
2022-01-08 09:02:25 -08:00
Sam Lantinga
dca281e810
Fixed getting different results for SDL_PollEvent(NULL) and SDL_PollEvent(&event)
2022-01-08 08:49:34 -08:00
Ozkan Sezer
4472b83129
PSP_RunCommandQueue: fix argument to PSP_SetBlendState()
...
src/render/psp/SDL_render_psp.c: In function 'PSP_RunCommandQueue':
src/render/psp/SDL_render_psp.c:1200: warning: passing argument 1 of 'PSP_SetBlendState' from incompatible pointer type
2022-01-08 11:56:56 +03:00
Ozkan Sezer
df1474b46e
psp/SDL_sysfilesystem.c: fixed a minor compiler warning.
...
src/filesystem/psp/SDL_sysfilesystem.c: In function 'SDL_GetPrefPath':
src/filesystem/psp/SDL_sysfilesystem.c:71: warning: passing argument 1 of 'free' discards qualifiers from pointer target type
2022-01-08 11:55:10 +03:00
Sam Lantinga
9294634840
Updated to version 2.0.20 for release
2022-01-07 18:29:40 -08:00
Ryan C. Gordon
cc2013378d
render: Fixed some compiler warnings.
...
Fixes #5197 .
2022-01-07 20:22:51 -05:00
Sam Lantinga
289c3fbb64
Revert "We only need to add the sentinel at the top of SDL_WaitEventTimeout()"
...
This reverts commit c477768e6f
.
We want to add the sentinel anytime we pump inside SDL_WaitEventTimeout() to avoid pumping again the next time through, as a performance optimization.
2022-01-07 17:07:22 -08:00
Sam Lantinga
1085c317a5
Use the requested cursor size instead of the default cursor size
...
CopyImage() will scale based on the system accessibility settings automatically.
Fixes https://github.com/libsdl-org/SDL/issues/5198
2022-01-07 16:45:18 -08:00
Ryan C. Gordon
6d3b5d66cd
psp: draw lines with RenderGeometry, same as with the other renderers.
2022-01-07 18:18:53 -05:00
Sylvain
9cb2c549fa
Remove QueueDrawLines from D3D, D3D11
2022-01-07 14:10:23 -08:00
Sylvain
b88b6b3c23
Remove QueueDrawLines from METAL
2022-01-07 14:10:23 -08:00
Sylvain
9aac55317d
Remove QueueDrawLines from GL, GLES, GLES2
2022-01-07 14:10:23 -08:00
Sylvain
8ea8b2e697
Use QueueDrawLine if provided, otherwise use RenderGeometry
2022-01-07 14:10:23 -08:00
Sylvain Becker
c498727471
render: Use RenderGeometry to draw lines
...
This patch is from @1bsyl
Fixes #5061 .
2022-01-07 16:14:28 -05:00
Sam Lantinga
4b38d4c96b
Leave the Metal view active on the window when recreating the Metal renderer
...
Fixes https://github.com/libsdl-org/SDL/issues/5140
Also move the metal tag definition to SDL_syswm.h so it can be used by applications
2022-01-07 12:38:45 -08:00
Ryan C. Gordon
88ac517df0
opengles2: Fix point drawing.
2022-01-07 15:04:04 -05:00
Sam Lantinga
957c48b4c7
Fixed detecting focus change to child dialogs
...
Fixes https://github.com/libsdl-org/SDL/issues/5157
2022-01-07 10:58:04 -08:00
Sam Lantinga
c477768e6f
We only need to add the sentinel at the top of SDL_WaitEventTimeout()
2022-01-06 18:58:30 -08:00
Cameron Gutman
e9134b045a
events: Only add sentinels for pumping done inside SDL_WaitEventTimeout()
...
We don't want to catch explicit SDL_PumpEvents() calls by the application with
our polling check to avoid stale data. If the call to SDL_PumpEvents() produced
no events, there will be a sentinel sitting in the queue that will cause
SDL_PollEvent() to immediately return 0 next time it is called.
Our SDL_WaitEventTimeout() implementation avoids this issue by always popping
an event after calling SDL_PumpEvents(). This will remove the new sentinel if
we didn't get any new events.
2022-01-06 18:35:23 -08:00
Sam Lantinga
954858846d
Move special sentinel handling inside SDL_PeepEvents()
2022-01-06 14:05:22 -08:00
Sam Lantinga
2592e6219b
Clarify that timeout == 0 is handled at the top of SDL_WaitEventTimeout()
2022-01-06 14:05:22 -08:00
Sam Lantinga
8ff2166855
Only return from SDL_PollEvent() if the last sentinel is consumed
2022-01-06 14:05:22 -08:00
Sam Lantinga
c9ff90b949
Clarify comment
...
Co-authored-by: Simon McVittie <smcv@debian.org>
2022-01-06 14:05:22 -08:00
Sam Lantinga
31f8c3ef44
Fixed event pump starvation if the application frequently pushes its own events
2022-01-06 14:05:22 -08:00
Wouter Wijsman
515b5f2a39
Fix build errors in PSP port
2022-01-06 10:17:05 -08:00
Wouter Wijsman
34e34ad5a5
Remove debug code from PSP renderer
2022-01-06 10:17:05 -08:00
stdgregwar
520c89a00a
cleaning
2022-01-06 10:17:05 -08:00
stdgregwar
09f4711f40
Fix LRU when destroying texture.
2022-01-06 10:17:05 -08:00
stdgregwar
c3ec62d6a6
PSP lazier blend states, display mode report with 16bit option
2022-01-06 10:17:05 -08:00
stdgregwar
0f5368fe11
PSP cached blending and texturing state, ABGR1555 stencil hack
2022-01-06 10:17:05 -08:00
stdgregwar
fe405eb27b
fixed LRU cache code
2022-01-06 10:17:05 -08:00
stdgregwar
c1f152292b
Spill render targets to ram on PSP
2022-01-06 10:17:05 -08:00
stdgregwar
77d874e3c0
Attempt to make render to texture work on PSP
2022-01-06 10:17:05 -08:00
Francisco Javier Trujillo Mata
f3255df9c0
Improve audio compatibility in PSP. Now it supports more formats and frequencies
2022-01-05 19:15:41 -05:00
Sam Lantinga
16f5b9e3c3
Filter jitter on Xbox One controllers when using raw input reports
2022-01-05 11:07:52 -08:00
Wouter Wijsman
6d46e30fed
Remove extra / in PSP GetPrefPath
2022-01-05 08:29:35 -08:00
Wouter Wijsman
33dccbb381
Make sure GetPrefPath also works without org
2022-01-05 08:29:35 -08:00
Cameron Gutman
419ae29d90
joystick: Move WGI driver initialization after Windows driver
...
WGI calls SDL_DINPUT_JoystickPresent() so we need to be sure DInput remains
initialized for the lifetime of the WGI driver to avoid a crash or duplicated
joysticks between DInput and WGI.
2022-01-04 15:53:39 -08:00
Cameron Gutman
d73bd0d2f6
dinput: Don't crash in SDL_DINPUT_JoystickPresent if DInput init failed
...
The WGI driver will call this regardless of whether our init succeeded.
2022-01-04 15:53:39 -08:00
Ozkan Sezer
565ef63873
SDL_rwops.c: simplify `foo <= 0` checks to `!foo` with unsigned types.
2022-01-04 11:40:04 +03:00
Cameron Gutman
8f924b82d9
kmsdrm: Remove gbm_bo_get_offset()
...
It is not present on some older libgbm versions that we still
support and has been unused since 85e8adf
.
2022-01-03 16:41:03 -06:00
Sam Lantinga
120c76c84b
Updated copyright for 2022
2022-01-03 09:40:21 -08:00
Sylvain
8622eda9e9
SDL_RenderGeometry / software: TRIANGLE_GET_TEXTCOORD interpolates up to the max values included, so reduce by 1
2022-01-02 22:34:56 +01:00
Ozkan Sezer
4b112620a3
SDL_cocoamodes.m (Cocoa_GetDisplayDPI): fix build using older toolchains
...
Fixes https://github.com/libsdl-org/SDL/issues/5162
2022-01-02 19:11:50 +03:00
Francisco Javier Trujillo Mata
13a9cd4797
Adding sysfilesystem driver to PSP
2022-01-02 08:06:04 -08:00
rohlem
0403fa8aa6
X11_WaitEventTimeout: remove unreachable return
...
If that condition was reachable, the return value should be negative to indicate that waiting for the timeout failed.
Otherwise, SDL_WaitEventTimeout would incorrectly return early.
2022-01-02 08:04:13 -08:00
e
d0de4c625a
Android: fixes build NDK 21d
2021-12-31 11:12:21 -08:00
Sam Lantinga
8f81699868
Only clear IME display options if SDL_HINT_IME_SHOW_UI is off (thanks opxdo!)
...
Fixes https://github.com/libsdl-org/SDL/issues/5153
2021-12-31 08:49:28 -08:00
Ryan C. Gordon
e4000c0284
video: SDL_GL_GetAttribute needs to operate on FBO 0.
...
If a different FBO is bound, this would return incorrect results.
Fixes #5082 .
2021-12-31 10:32:39 -05:00
Sam Lantinga
ab6d0d4d50
Fixed undefined behavior in SDL_memset() (thanks andrewrk!)
...
Fixes https://github.com/libsdl-org/SDL/issues/5147
2021-12-28 15:58:15 -08:00
shinyquagsire23
6a7b63802c
Fix macOS cursor jumping to corner on first titlebar click
2021-12-28 13:38:23 -08:00
Edward Li
a35a7d2507
Fix SigSegV from displayInfoInvalidate when changing resolution
2021-12-28 09:33:44 -08:00
Edward Li
1c41b53551
macOS: Calculate correct DPI by not using backingScaleFactor
2021-12-28 09:33:44 -08:00
Alex Szpakowski
724468ae2c
GL renderer uses glDrawArrays instead of glBegin/glEnd.
...
Also change internal colors sent to GL to use unorm8 components instead of float, for improved performance.
2021-12-27 10:52:47 -05:00
Sylvain
a1e992b110
Fixed bug #5118 - [Android] PointerIcon leak in Cursor API
2021-12-21 22:07:17 +01:00
Ozkan Sezer
840339c49d
SDL_utf8strlcpy: store trailing_bytes explicity as unsigned type.
2021-12-18 14:01:02 +03:00
Ozkan Sezer
507d4bcd68
SDL_utf8strlen: run bit-test explicitly on unsigned char
2021-12-18 14:01:02 +03:00
Ozkan Sezer
82fc67ae4d
SDL_joystick.c: cast the arguments to nibble() to unsigned char.
2021-12-18 14:01:02 +03:00
Ozkan Sezer
47d3e96b43
SDL_joystick.c: (unsigned char) cast to SDL_tolower() parameters.
2021-12-18 14:01:02 +03:00
Sam Lantinga
c31a40246d
Fix audio memory leaks due to invalid init (thanks Janiszewski!)
...
SDL_Init(SDL_INIT_AUDIO) did not take into account that functions like
SDL_AddAudioDevice do register events, which will need final cleanup
and only gets fired when events were actually initialised.
Sample call stack of a malloc missing its free (Linux + PA):
SDL_malloc_REAL (SDL_malloc.c:5328)
SDL_AddEvent (SDL_events.c:445)
SDL_PeepEvents_REAL (SDL_events.c:531)
SDL_PushEvent_REAL (SDL_events.c:762)
SDL_AddAudioDevice (SDL_audio.c:443)
SourceInfoCallback (SDL_pulseaudio.c:681)
context_get_source_info_callback (introspect.c:534)
run_action (pdispatch.c:288)
pa_pdispatch_run (pdispatch.c:341)
pstream_packet_callback (context.c:349)
do_read (pstream.c:1012)
Fixes https://github.com/libsdl-org/SDL/issues/3005
2021-12-17 19:04:39 -08:00
Erik Soma
71e3998d6c
Make SDL_VideoInit cleanup when errors occur before video driver creation.
2021-12-17 18:55:49 -08:00
Francisco Javier Trujillo Mata
8ed0cc4300
Fix wrong value for thread priorities following official PSP Docs
2021-12-17 13:57:22 -08:00
Sylvain
44c84c0d8e
GLES2/Big-endian: don´t swap datas for yuv textures (Thanks 0x1F9F1 !)
2021-12-17 17:44:34 +01:00
Sylvain
3a69828e87
Fixed GLES2 back-end on Big Endian Platform (see #5093 )
2021-12-17 13:15:39 +01:00
Ozkan Sezer
61107494a1
SDL_gamecontroller.c: (unsigned char) cast to SDL_isdigit() parameters.
2021-12-17 07:40:02 +03:00
Ozkan Sezer
ced442cd38
SDL_test_common.c: (unsigned char) cast to SDL_isdigit() parameter.
2021-12-17 07:33:10 +03:00
Ozkan Sezer
48d1ef8fad
another unsigned char cast in os2cp.c. code clean-up in os/2 geniconv.
2021-12-17 07:33:10 +03:00
Ozkan Sezer
dac6516057
os2iconv.c (_createUconvObj): cast to unsigned char, to be safe.
2021-12-17 02:50:40 +03:00
Ozkan Sezer
2052b5bc3e
os2messagebox: use proper UCHAR* typecast in assignment, just in case.
2021-12-17 01:10:10 +03:00
Sam Lantinga
ca18bf11ee
Don't compare raw mouse button state with windows message button state
...
When mouse buttons are swapped, right mouse button down is the same value as raw mouse button up, and conceptually the two systems use different button masks, so never cache state between the two.
Fixes https://github.com/libsdl-org/SDL/issues/5108
2021-12-16 12:01:18 -08:00
Sylvain
3d5fcb5da6
Fix warning
2021-12-16 09:19:53 -08:00
Sylvain
4342e6bd21
SDL_render.c: lighten the cast syntax
2021-12-16 09:19:53 -08:00
Sylvain
50d49c63ed
GLES2 backend: cast with SDL_Vertex and SDL_VertexSolid
2021-12-16 09:19:53 -08:00
Ethan Lee
4c9966eed6
wayland: Add a note for why we check 0,0 for fullscreen configurations
2021-12-16 10:22:27 -05:00
Sylvain
6101499c7c
BigEndian: fix code that generates illegal instruction with gcc-4.9.2 on powerpc
...
Program received signal SIGILL, Illegal instruction.
X11_InitKeyboard (_this=0x1001f8f0)
at /home/sdl/SDL_git/src/video/x11/SDL_x11keyboard.c:273
273 XKeyboardState values = { .global_auto_repeat = AutoRepeatModeOff };
2021-12-16 09:07:31 +01:00
stdgregwar
0b7b0977fc
fix PSP texure artifacts
2021-12-15 18:00:28 -08:00
Francisco Javier Trujillo Mata
996f30b0e4
Use lightweight mutex
2021-12-15 13:59:08 -08:00
Francisco Javier Trujillo Mata
0341ec93fe
Improve performance when vsync is enabled and the game is not reaching the 60 FPS
2021-12-15 11:29:49 -08:00
Sam Lantinga
67c4b99639
Fixed enabling udev hotplug detection on Linux
2021-12-15 10:39:42 -08:00
Sam Lantinga
c326ff7c6f
Re-enabled the O_CLOEXEC definition so config headers can be fixed
2021-12-14 12:42:39 -08:00
Alex Szpakowski
3a5e148b13
Renderer backends use SDL_Color instead of int for geometry colors.
2021-12-14 12:19:16 -08:00
Sam Lantinga
086c74556d
Fixed build warning on iOS
2021-12-14 12:08:36 -08:00
Sam Lantinga
b08e57e926
Don't try to create a vbo if we aren't using any vertices
2021-12-14 09:32:05 -08:00
Sylvain
b7885abc44
Fixed bug #5087 : SDL_RenderGeometryRaw() passes colors as int* instead of SDL_Color*
2021-12-14 10:31:55 +01:00
Alex Szpakowski
323ba6c008
d3d11 renderer: reduce vertex bandwidth and calculations.
2021-12-13 15:14:33 -08:00
thfrwn
2b6b69fb12
fix assertion failure in sndio audio caused by the recent hotplugging support
2021-12-13 11:26:35 -08:00
Sylvain
8927d73b1c
RenderGeometry: simplify casting (Thanks Daniel Gibson)
2021-12-12 09:55:23 +01:00
Sylvain
d7f66ba1ec
Remove strict aliasing warning in opengles2 backend
2021-12-11 20:04:53 +01:00
Sylvain
3e43d6e34b
SDL_RenderGeometry: remove some warning "dereferencing type-punned pointer might break strict-aliasing"
2021-12-11 17:19:00 +01:00
David Redondo
e2ade2bfc4
Fix build against wayland 1.20
...
Fixes #5088
2021-12-10 08:59:20 -08:00
David Gow
9da93d074b
video: x11: Set XImage's byte_order field ( fix #5081 )
...
If the X server's byte order is different from the client, things might
display in the wrong colour.
Apparently we can just set the byte_order field to the client's byte
order, and the X server will adjust everything automatically:
https://xorg.freedesktop.narkive.com/GbSD1aPq/ximage-s-byte-order-field
2021-12-09 20:40:12 -08:00
Hanseul Jun
e7f84c20bc
Fix a typo in comment.
2021-12-09 11:05:23 -08:00
Hanseul Jun
66fbf00e7d
Temporarily ignore gl_config.driver_loaded check in Cocoa_GLES_SetupWindow.
2021-12-09 11:05:23 -08:00
Valentin Hăloiu
cb8fa5f9c3
wayland: fix keycodes of swapped xkb modifier keys
2021-12-09 09:30:58 -08:00
Ozkan Sezer
615f7b4453
more updates to os2 makefile for libiconv
2021-12-08 23:51:56 +03:00
Ozkan Sezer
8d14e6ea44
replaced use of _MAX_PATH with CCHMAXPATH in os/2 code,
...
it now compiles without HAVE_LIBC
2021-12-08 14:01:02 +03:00
Sylvain
1940d289bf
SW Renderer: fix invalid read if VSYNC hint is initially set with an empty value (eg "")
...
because:
- GeHint return a value pointer.
- SetHint free internally the pointer
- The -now invalid- pointer is re-read
==9363== Invalid read of size 1
==9363== at 0x4946860: SW_CreateRenderer (SDL_render_sw.c:1044)
==9363== by 0x48F0EC3: SDL_CreateRenderer_REAL (SDL_render.c:938)
==9363== by 0x48C5921: SDL_CreateRenderer (SDL_dynapi_procs.h:332)
==9363== by 0x401584: main (main.c:421)
==9363== Address 0x9c24040 is 0 bytes inside a block of size 1 free'd
==9363== at 0x484621F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==9363== by 0x494E403: SDL_free_REAL (SDL_malloc.c:5432)
==9363== by 0x48A6153: SDL_SetHintWithPriority_REAL (SDL_hints.c:76)
==9363== by 0x48A6254: SDL_SetHint_REAL (SDL_hints.c:101)
2021-12-08 09:41:33 +01:00
Ozkan Sezer
9409642e08
fix some warnings from vita builds (missing includes)
...
also some tidy-up to whitespace.
2021-12-07 21:24:24 +03:00
stdgregwar
21d46b7e0c
PSP renderer fixed
2021-12-07 20:55:04 +03:00
Sergio Padrino
6f6382f8d0
Fix SDL_GameController API for PSP ( #3 )
...
- Add missing mapping
- Make sure the only window has the keyboard focus (so no `SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS` is needed)
2021-12-07 09:04:05 -08:00
Cameron Gutman
da0f76de6d
cocoa: Don't round scroll deltas from trackpads
...
Rounding the scroll deltas from trackpads causes jerky scrolling behavior
by artificially amplifying the effects of very small scroll movements.
We should only round events from devices with discrete scroll wheels,
because we know the smallest unit of movement there is a single tick.
2021-12-07 09:02:35 -08:00
Ozkan Sezer
8cee50eea5
removed stdlib.h from SDL_psp_main.c now that exit() is gone.
2021-12-07 19:32:56 +03:00
Ozkan Sezer
00014dc2ac
fix some warnings from psp builds (missing includes.)
2021-12-07 18:47:10 +03:00
Wouter Wijsman
da5dbb4763
Fix SDL2main on PSP ( #5076 )
...
- Fix SDL2main on PSP
SDL2main was not working for PSP, because it wasn't being activated and
it wasn't unsetting the main. Besides that a debug screen being started
was causing issues with joystick input and the sceKernelExitGame calli
is no longer needed with the current PSPDEV SDK.
- Clean up imports in PSP main
- Set PSP GPU and user modes in main
- Fix exit callback in PSP main
2021-12-07 18:43:50 +03:00
Cameron Gutman
2d673e5b56
evdev: Add support for REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES
...
If supported, these come alongside the regular REL_WHEEL and REL_HWHEEL
events so it's important that we only process one or the other.
2021-12-07 07:00:31 -08:00
Ozkan Sezer
f266d92286
psp/SDL_sysjoystick.c: fix -Wshadow warnings.
2021-12-07 14:04:32 +03:00
Ozkan Sezer
801dcbc5ef
SDL_render_sw.c: fix -Wshadow warnings.
2021-12-07 14:04:10 +03:00
Wouter Wijsman
e17a3154ed
Fix build issue
2021-12-07 14:03:00 +03:00
Wouter Wijsman
7266cf66c7
Clean up PSP render code to fit C standard used better
2021-12-07 14:03:00 +03:00
Wouter Wijsman
07608bf45f
Fix ISO C90 violations in psp render code
2021-12-07 14:03:00 +03:00
Wouter Wijsman
a79b642638
Make SDL2 able to build or PSP with cmake
2021-12-07 14:03:00 +03:00
Wouter Wijsman
21fd0047e3
Initial for building PSP version with CMake
2021-12-07 14:03:00 +03:00
Sylvain
d09f80ef18
SDL_DrawPointsF: fix error message typo
2021-12-07 11:31:57 +01:00
Sylvain
6dafc85017
SDL_DrawLines: minor simpification:
...
- scale is 1.0f, don't need to multiply
- typo in error message
- remap SDL_DrawLines to SDL_DrawLinesF
2021-12-07 10:44:12 +01:00
Sylvain
a0818a63e3
Fixed bug #5071 - Float conversion warnings in SDL_render.c (see also #5003 )
2021-12-07 10:07:15 +01:00
Cameron Gutman
9ae56cb353
events: Add logging for SDL_MOUSEWHEEL preciseX/Y fields
2021-12-06 21:18:23 -06:00
Ozkan Sezer
03019c912a
autotools, cmake: tighten Xfixes check && explicitly test BarrierEventID
...
Apparently the older versions of libXi doesn't have it. Fixes the build
break issue reported at:
4b42c05ba1 (commitcomment-61427659)
2021-12-06 20:37:52 +03:00
David Gow
a709b5b602
video: wayland: Handle 0x0 xdg_toplevel_configure in fullscreen
...
The xdg_shell spec seems to state[1] that xdg_toplevel_configure events can
always provide a 0×0 width/height to signal that the compositor doesn't
care. SDL previously assumed the provided width/height was always valid
for fullscreen windows, and so applied it as-is.
This broke SDL applications on KDE/KWin 5.23, which now sends 0×0
configure events (and, in 5.23.3, 1×1 events for some reason), breaking
all SDL applications in fullscreen[2].
[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/6
[2]: https://bugs.kde.org/show_bug.cgi?id=444962#c6
2021-12-06 09:09:37 -08:00
ALittleDruid
2f0edc2906
IAudioClient::SetEventHandle Parameter eventHandle Should not be NULL
2021-12-06 09:02:31 -08:00
Ozkan Sezer
a887b8e28b
SDL_test_common.c: replaced all printf() calls with SDL_Log()
...
Otherwise, if one builds libSDL2_test using a new mingw but builds
the test programs using an older mingw, a link failure happens:
/opt/local/x86_64-w64-mingw32/lib/libSDL2_test.a(SDL_test_common.o): In function `printf':
/opt/local/x86_64-w64-mingw32/include/stdio.h:372: undefined reference to `__imp___acrt_iob_func'
collect2: ld returned 1 exit status
2021-12-03 20:03:10 +03:00
Weng Xuetian
5056b29b0f
Fix the wrong int size for fcitx capability.
2021-12-03 04:31:24 -08:00
Sylvain
e14d10263c
Change viewport and cliprect to float version: from SDL_Rect to SDL_FRect
2021-12-02 10:01:50 +01:00
Sylvain
7828362da9
SDL_Renderer software, D3D11: don't use "renderer->viewport" in back-ends, but use the one from SETVIEWPORT cmd
2021-12-02 10:01:50 +01:00
Ozkan Sezer
a2b13e585c
SDL_iconv_string: avoid memory leak if realloc() fails.
2021-12-02 02:28:24 +03:00
Ozkan Sezer
f14a8bfa4e
fix whitespace.
2021-12-01 21:33:02 +03:00
Ozkan Sezer
b71bfdaafb
SDL_iconv.c (encodings): mark "WCHAR_T" as ENCODING_UTF16LE for OS/2 too
...
whcar_t is unsigned short in os/2, like windows
2021-12-01 20:50:40 +03:00
Davis Mosenkovs
66b0a6ee15
workaround for libmali gbm_device_get_fd()
...
gbm_device_get_fd() in at least some libmali versions duplicates handle.
Other implementations do not do duplication. To prevent handle leak save
drm_fd in SDL_DisplayData.
2021-11-30 16:20:24 -08:00
Ozkan Sezer
662ea5abe4
minor correction after previous patch and minor tidy-up.
2021-12-01 01:40:24 +03:00
Ozkan Sezer
70c5e91d0f
os/2 optionally builds against libiconv.
2021-12-01 01:20:10 +03:00
Ozkan Sezer
b20484e803
minor os/2 reorganization for iconv
2021-12-01 01:20:02 +03:00
Sam Lantinga
8c91cf7dba
Always create a full 256-entry map in case color values are out of range
...
Fixes https://github.com/libsdl-org/SDL/issues/5042
2021-11-30 12:37:39 -08:00
Sam Lantinga
a4c04ad230
Fixed building with iOS SDK prior to 13.0
...
Fixes https://github.com/libsdl-org/SDL/pull/5045
2021-11-30 10:32:39 -08:00
Sam Lantinga
8589134f16
Fixed potential buffer overflow in YUV conversion
...
Fixes https://github.com/libsdl-org/SDL/issues/5043
2021-11-30 10:23:21 -08:00
Ozkan Sezer
09465a9083
hidapi, windows: replace a strncpy() with plain memcpy()
...
mainstream has a similar change, already.
2021-11-30 21:10:10 +03:00
Sam Lantinga
5fc901d4f3
Updated to version 2.0.19 for development
2021-11-30 09:58:21 -08:00
Cameron Gutman
715d481271
windows: Fix GUI key state when grabbing the keyboard
...
When our keyboard grab hook is installed, GetKeyState() will return 0 for the
GUI keys even when they are pressed. This leads to spurious key up events when
holding down the GUI keys and the inability to use any key combos involving
those modifier keys.
2021-11-29 20:07:19 -08:00
Sam Lantinga
b6bc3a6b0e
Added a mapping for the PS4 touchpad button on Windows
...
Fixes https://github.com/libsdl-org/SDL/issues/5035
2021-11-29 09:00:54 -08:00
David Gow
f6fdbc1e37
video: x11: Fix an invalid SDL_LogError() call
...
This fixes a compile warning — and possible invalid memory read —
introduced in 9c03d255
("Add back X11 legacy WM_NAME encodings"), which
was part of PR #5029 , fixing Bug #4924 .
The issue is with one of the added warnings in X11_GetWindowTitle().
Basically, the "title" variable passed to SDL_LogError() hasn't been
initialised yet: we could pass propdata in directly, but it's better to
move the SDL_LogError() call until after title is set, IMHO.
This fixes the following warning from gcc (SUSE Linux) 11.2.1:
In file included from /home/david/Development/SDL/src/video/x11/../../SDL_internal.h:45,
from /home/david/Development/SDL/src/video/x11/SDL_x11window.c:21:
/home/david/Development/SDL/src/video/x11/SDL_x11window.c: In function 'X11_GetWindowTitle':
/home/david/Development/SDL/src/video/x11/../../dynapi/SDL_dynapi_overrides.h:33:22: warning: '%s' directive argument is null [-Wformat-overflow=]
33 | #define SDL_LogDebug SDL_LogDebug_REAL
/home/david/Development/SDL/src/video/x11/SDL_x11window.c:720:13: note: in expansion of macro 'SDL_LogDebug'
720 | SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Failed to convert WM_NAME title expecting UTF8! Title: %s", title);
| ^~~~~~~~~~~~
2021-11-29 07:13:25 -08:00
Sam Lantinga
3ba9276aff
Don't fail the sensor init if we couldn't create a sensor manager (i.e. we're running on Wine)
...
Fixes https://github.com/libsdl-org/SDL/issues/5031
2021-11-28 21:14:02 -08:00
Sam Lantinga
6872cb12e6
null-terminate the message buffer if FormatMessage() fails
2021-11-28 21:10:46 -08:00
Fredrick Brennan
b5d47aa297
Fix comment style for old compilers (`//`⇒`/**/`)
2021-11-28 21:00:29 -08:00
Fredrick Brennan
367684b0c2
Add patches suggested by @slouken in round 1 review
2021-11-28 21:00:29 -08:00
Fredrick Brennan
9c03d25543
Add back X11 legacy WM_NAME encodings
...
Closes #4924 .
Based on patches of the past, such as this work by James Cloos in July
2010:
d7d98751b7
,
as well as code comments in the Perl module X11::Protocol::WM
(https://metacpan.org/pod/X11::Protocol::WM ) and even the code to Xlib
itself, which taught me that we should never have been using
`XStoreName`, all it does is call `XChangeProperty`, hardcoded to
`XA_STRING`!
What can I say, when the task is old school, the sources are too 😂
2021-11-28 21:00:29 -08:00
Ethan Lee
72e53e4b87
wayland: Clear driverdata before calling ResetDisplayModes
2021-11-28 19:25:22 -05:00
Sam Lantinga
942973dd86
Use mouse ID 0 for raw mouse events
...
We don't track state for each mouse individually, so we should just use the global mouse ID for all events.
Fixes https://github.com/libsdl-org/SDL/issues/5026
2021-11-28 09:27:28 -08:00
Sam Lantinga
dd2f91118e
Fixed warnings with Windows SDK 10.0.19041
...
Fixes https://github.com/libsdl-org/SDL/issues/4998
Also breaks https://github.com/libsdl-org/SDL/issues/4998 for older SDKs, but we're going to ignore them, they're just incorrect.
2021-11-27 20:18:29 -08:00
Sam Lantinga
c2904c8ce7
Fixed compile warnings and errors
...
Fixes https://github.com/libsdl-org/SDL/issues/4998
2021-11-27 11:16:15 -08:00
Ozkan Sezer
8f17af5e21
hidapi: mark libusb function pointers with LIBUSB_CALL.
2021-11-27 11:02:04 -08:00
Sam Lantinga
a6cbe0ab87
Controllers are always centered at zero using XInput and WGI
2021-11-27 10:58:12 -08:00
Sam Lantinga
09b7ca27d6
Get the current WGI controller list at startup
...
On Win32 this list is empty and we always get controller added events. On UWP, this list is populated and we don't get controlle added events for currently connected controllers.
2021-11-27 10:53:20 -08:00
Sam Lantinga
12895eca1a
Fixed WGI initialization on Win32
2021-11-27 10:52:58 -08:00
Sam Lantinga
110e4e1334
Use WGI instead of XInput for Windows 10 UWP apps
...
Fixes https://github.com/libsdl-org/SDL/issues/5017
2021-11-27 10:24:32 -08:00
Sam Lantinga
e04a0221e3
Fixed crash running SDL test programs on UWP
2021-11-27 10:22:37 -08:00
Ozkan Sezer
5a0ea7fb17
Check for O_CLOEXEC definition in fcntl.h at configuration time,
...
If not available, define it internally as 0 (in SDL_internal.h).
Define it as available for macOS >= 10.7 in SDL_config_macosx.h.
2021-11-27 19:23:10 +03:00
Cameron Gutman
f903a39e13
haptic: Fix SDL_MouseIsHaptic() always returning SDL_TRUE on Android
2021-11-27 19:18:41 +03:00
Sam Lantinga
11a9cd6344
Fixed building SDL on UWP
2021-11-27 08:14:50 -08:00
Mathieu Eyraud
02021ae753
Return capabitlities from RawInput joystick
2021-11-27 07:26:10 -05:00
Eric Wasylishen
b786c10013
SDL_render_gl.c: GL_RunCommandQueue: always set viewport_dirty on macOS
...
Without this, moving the window changes the viewport and causes contents
to render stretched.
Fixes #1504
2021-11-27 07:12:34 -05:00
Sam Lantinga
4f683f01d4
Fixed potentially truncated entry in stack trace
2021-11-26 17:27:07 -08:00
Sam Lantinga
4e5839a5f4
Fixed compiling for Raspberry Pi
2021-11-26 13:45:08 -08:00
Ryan C. Gordon
86c0cf2bb1
software: Draw a single pixel for a line with the same start/end point.
...
Otherwise it would drop it, which seems like a bug to me, as it normally
fills the endpoint on lines.
Reference #2006 .
2021-11-26 14:34:51 -05:00
Sam Lantinga
a2e8565230
The Google Pixel fingerprint sensor isn't actually a joystick
...
Fixes https://github.com/libsdl-org/SDL/issues/4971
2021-11-26 11:04:15 -08:00
Sam Lantinga
67b5de5b41
Fixed build warnings
2021-11-26 10:18:08 -08:00
Sam Lantinga
2ca2ad76da
Fixed build warnings
2021-11-26 10:13:45 -08:00
Sam Lantinga
f90164a62f
Fixed mapping for the G-Shark GS-GP702
...
Fixes https://github.com/libsdl-org/SDL/issues/5006
2021-11-26 09:02:12 -08:00
Sam Lantinga
7242075b2b
Updated version to 2.0.18 for release
2021-11-26 08:12:45 -08:00
Sam Lantinga
d861820465
SDL_JoystickGetAttached() doesn't need to be noisy for NULL joystick
...
Fixes https://github.com/libsdl-org/SDL/issues/5008
2021-11-26 07:57:48 -08:00
Sam Lantinga
30f04d63e6
HIDAPI is only reliable on Android 4.3 and newer
...
Fixes https://github.com/libsdl-org/SDL/issues/4955
2021-11-26 07:15:46 -08:00
Ryan C. Gordon
d713a68071
pulseaudio: wait until at least 1/8th (!) of the mixbuffer is available.
...
This is to workaround systems where we hang in playback because the buffer
does not report the space for whatever reason. The system will instead block
in PlayDevice, which always immediately follows WaitDevice in modern times
so this works out, and it seems to keep the device moving forward.
For a future revision, we are either going to clean this up more properly,
or attempt to move to PulseAudio's pa_stream_set_write_callback() API, but
this will do for SDL 2.0.18.
Reference #4387 for discussion and further information.
2021-11-25 22:32:40 -05:00
Ozkan Sezer
53aa8eec5f
minor cleanup for watcom _inline keyword.
2021-11-25 17:00:24 +03:00
Sylvain
d5813776db
Release UDEV ressources
2021-11-25 07:24:18 -05:00
Cameron Gutman
b99510836e
SDL_mfijoystick.m: Fix -Wshadow warning
2021-11-24 13:04:50 -06:00
DarkContact
e77cfb9a11
Fixed d3d11 renderer creation
2021-11-24 10:11:35 -05:00
Sam Lantinga
57366285d8
Only send display events for hotplugged displays, not the initial state
2021-11-23 20:14:18 +00:00
Sam Lantinga
a3c05d2f34
Added debug output for display connect/disconnect events
2021-11-23 19:43:01 +00:00
Ozkan Sezer
f8900583e5
removed windows winmm joystick driver
2021-11-23 17:04:40 +03:00
Sylvain
381f99a3fd
Fix warnings: re-add enum forward declaration
2021-11-23 10:58:04 +01:00
Sylvain
dd6817b3b7
Fix warnings: static function, {} initializier, un-needed enum forward declaration
2021-11-23 10:47:34 +01:00
Sylvain
fae7034901
Fix warnings: static, include, un-initialized vairables
2021-11-23 10:33:12 +01:00
Sylvain
2a24418bd3
More "Integer overflow generates Illegal instruction under sanitizers" (see bug #4995 )
2021-11-23 09:44:37 +01:00
Sylvain
9c72adc86c
More "Integer overflow generates Illegal instruction under sanitizers" (see bug #4995 )
2021-11-23 09:41:01 +01:00
Sylvain
8dd6edec00
Fixed bug #3232 - Integer overflow generates Illegal instruction under sanitizers + see bug #4995
2021-11-23 09:30:42 +01:00
Ozkan Sezer
e18be04bc6
Fixed undefined behavior in QueueCmdSetDrawColor()
...
Fixes https://github.com/libsdl-org/SDL/issues/4995
Patch from Andrew Kelley
2021-11-23 08:01:02 +03:00
Sylvain
c878d9a0aa
Haiku: comment this should not be SDL_free()
2021-11-22 08:38:46 -08:00
Sylvain
aef7105408
Use SDL_free
2021-11-22 08:38:46 -08:00
Sylvain
2004aaf3bb
SDL_wave: use SDL_free
2021-11-22 08:38:46 -08:00
Sylvain
0445c13aae
Remove 'malloc' from comment
2021-11-22 08:38:46 -08:00
Sylvain
155db97d14
Remove 'malloc' from comment
2021-11-22 08:38:46 -08:00
Sylvain
c3633d2c99
Haiku: use SDL_malloc
2021-11-22 08:38:46 -08:00
Sylvain
79b37cc55f
Pandora: use SDL_malloc
2021-11-22 08:38:46 -08:00
Sylvain
10ffcbb115
QNX: use SDL_malloc
2021-11-22 08:38:46 -08:00
Sylvain
e72beeb2a0
Remove 'malloc' from comment
2021-11-22 08:38:46 -08:00
Sylvain
38cfe25bc5
Remove 'malloc' from comment
2021-11-22 08:38:46 -08:00
Sylvain
4d566e5d5d
VITA, PSP: use SDL_malloc
2021-11-22 08:38:46 -08:00
Sylvain
9fcc630fb3
X11: use SDL_malloc
2021-11-22 08:38:46 -08:00
Sylvain
19bf36db15
DirectFB: use SDL_malloc
2021-11-22 08:38:46 -08:00
Sylvain
8fb19d212e
Vita: unneeded include
2021-11-22 08:38:46 -08:00
Sylvain
e702a4e520
PSP: un needed include
2021-11-22 08:38:46 -08:00
Sylvain
8e851a277d
Remove malloc from comment
2021-11-22 08:38:46 -08:00
Sylvain
0ef9d26622
cpuinfo: remove malloc from comments
2021-11-22 08:38:46 -08:00
Sylvain
30338beb61
Minor comment
2021-11-22 08:38:46 -08:00
Sylvain
fb218e582a
PSP: use SDL_malloc/SDL_free
2021-11-22 08:38:46 -08:00
Sylvain
5a7a7ba570
Don't use "realloc" in comment so that it doesn't show up
2021-11-22 08:38:46 -08:00
Sylvain
b4aeaa30a1
Use SDL_calloc / SDL_free
2021-11-22 08:38:46 -08:00
Sylvain
cb9f85e8d0
Don't use "round", so that it's doesn't show up while searching for the function
2021-11-22 08:38:46 -08:00
Sylvain
6fb50bd0a6
Don't use "exp" as a name so that it's doesn´t show up with searching for the function
2021-11-22 08:38:46 -08:00
Sylvain
161dd83c9a
Don´t use "trunc" as var name, since it's also a function
2021-11-22 08:38:46 -08:00
Sylvain
d31251b014
use SDL's functions version inplace of libc version
2021-11-22 08:38:46 -08:00
Ozkan Sezer
ee2afa00ba
SDL_mfijoystick.m: fix build using older toolchains
...
Fixes https://github.com/libsdl-org/SDL/issues/4992
Fixes https://github.com/libsdl-org/SDL/issues/4958
2021-11-22 05:11:10 +03:00
Sam Lantinga
c97b721868
Added SDL_PremultiplyAlpha() to premultiply alpha on a block of SDL_PIXELFORMAT_ARGB8888 pixels
2021-11-21 12:18:10 -08:00
Sylvain
49369142bd
Fixed bug #4625 : with integer scale, viewport (as reported by SDL_RenderGetViewport) becomes -2147483648x-2147483648
...
0 isn't valid scale. Min integer scale is 1.0f
2021-11-21 17:40:48 +01:00
Sylvain
a0cb079a42
Fixed bug #4982 - Failed to open audio_device on OpenSLES / Android 5.x with freq 96khz+
2021-11-21 15:45:08 +01:00
Ryan C. Gordon
ceb9e9a809
cocoa: Removed a debug printf call.
2021-11-21 00:21:41 -05:00
Ryan C. Gordon
18715acb55
cocoa: Position non-left mouse button events in background windows correctly.
...
Fixes #4828 .
2021-11-21 00:14:18 -05:00
Cameron Gutman
343fa61215
hid: fix inconsistent indentation
2021-11-20 13:17:59 -06:00
Cameron Gutman
db60b27188
hid: Only enumerate IOHIDDevices that are likely to be joysticks
...
Touching HID devices with keyboard usages will trigger a keyboard capture
permission prompt on macOS 11+. See #4887
Like the IOKit joystick backend, we accept HID devices that have joystick,
gamepad, or multi-axis controller usages. We also allow the Valve VID for
the Steam Controller, just like the Windows HIDAPI implementation does.
2021-11-20 13:13:17 -06:00
Ryan C. Gordon
23b7bdef87
offscreen: Don't fail to create a window because of driver_loaded politics.
...
Fixes #4922 .
2021-11-20 14:12:11 -05:00
Ozkan Sezer
504e7aa59b
minor tidy-up for ifdefs & co.
2021-11-20 21:51:10 +03:00
Sylvain
b6e8651ae9
Audio 6.1 should be allowed now (see #4974 )
2021-11-20 15:31:21 +01:00
Ozkan Sezer
990fb668f7
tests: several -Wwrite-strings fixes.
2021-11-20 01:02:02 +03:00
Sam Lantinga
665865eda2
If the hardware is in an error state, the final page flip may not come.
...
We should either put a timeout on the wait when destroying the window, or skip it entirely.
2021-11-19 09:58:13 -08:00
Sam Lantinga
6828955ddf
Trim any extra platform strings from mappings when they're returned to the application
2021-11-19 09:58:11 -08:00
Cameron Gutman
881a674926
rawinput: Only access SDL_RAWINPUT_mutex if initialized
...
We can also ditch the lock in RAWINPUT_JoystickQuit() now that the joystick
subsystem quits drivers in reverse order. There's no chance of a racing call
to RAWINPUT_WindowProc() anymore.
2021-11-19 08:19:30 -06:00
Cameron Gutman
1237142be3
joystick: Quit drivers in reverse order to ensure dependencies are not broken
...
SDL_WINDOWS_JoystickDriver depends on callbacks in SDL_RAWINPUT_JoystickDriver
and SDL_HIDAPI_JoystickDriver being available. It also manages the common
WindowProc used for joystick detection in both WINDOWS and RAWINPUT drivers.
If we don't tear them down backwards, there's a window of time where we could
invoke RAWINPUT_WindowProc() after RAWINPUT_JoystickQuit() was called.
2021-11-19 08:19:30 -06:00
Ozkan Sezer
b67965979a
SDL_hidapi.c: fix SDL_udev.h include path
...
fixes https://github.com/libsdl-org/SDL/issues/4981
2021-11-19 11:55:50 +03:00
Ethan Lee
a7a54e6452
wayland: Add support for display connect/disconnect events
2021-11-18 00:44:08 -05:00
Sylvain
5be8a22113
Add audio conversion from/to 61
2021-11-17 16:04:54 -08:00
Ozkan Sezer
d2cf191936
hidapi, linux: merged a minor warning + code style fix from mainstream.
2021-11-17 10:00:10 +03:00
Ethan Lee
5cc23868ed
wayland: Add support for SDL_DisplayOrientation
2021-11-16 11:58:23 -08:00
Sam Lantinga
40d808620d
SDL_classic_joysticks defaults off
2021-11-15 20:17:14 -08:00
Sam Lantinga
66058bbbd5
Fixed exception accessing Bluetooth devices on Android 12
...
Since accessing Bluetooth prompts the user for permission on both Android and iOS, and we only need it for Steam Controller support, we'll leave it off by default. You can enable it by setting the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM to "1" before calling SDL_Init()
Fixes https://github.com/libsdl-org/SDL/issues/4952
2021-11-15 16:52:56 -08:00
Sam Lantinga
be5b4d980d
Added nativeGetHintBoolean for Java code
2021-11-15 16:52:54 -08:00
Sam Lantinga
9ec2b35147
Fixed the GLES2 shader count to be in sync with the enum
2021-11-15 13:45:53 -08:00
Sylvain
b649314d62
Add comment to audio clipping (see bug #4104 )
2021-11-15 13:43:40 +01:00
Sylvain
d4df5d33c5
GLES2: prevent batching if blend mode changes (see bug #4964 )
2021-11-15 09:43:44 +01:00
Sylvain
92f2fdfc84
GLES2: batch non joined lines (see #4964 )
2021-11-15 09:36:18 +01:00
Sylvain
17f156fae5
Fixed bug #4964 - opengles2 & batching = conjoined lines
...
put back the initial switch case because groups of joined lines cannot be batched.
2021-11-15 09:08:09 +01:00
Sylvain
d8888e468e
Fixed bug #4964 - opengles2 & batching = conjoined lines
2021-11-15 08:37:49 +01:00
Sam Lantinga
cc094f4d7c
Fixed building with the macOS 10.8 SDK
2021-11-14 20:15:48 -08:00
Cameron Gutman
d7d67af441
mouse: Fix Y value in motion events when confinement is active
2021-11-14 17:52:41 -06:00
Zack Middleton
1cd3e83756
cocoa: Fix abort on touch event types without a subtype
...
macOS 10.6 has some touch NSEvents which do not have a subtype
(Begin/EndGesture, Magnify, Rotate, Swipe) and cause an uncaught
exception which triggers SIGABRT and the program exits.
As it is, none of the macOS 10.6 touch events are detected as a
trackpad (including Gesture due to using different subtypes).
2021-11-14 15:21:51 -08:00
Ozkan Sezer
781caec2b2
SDL_waylandevents.c (keyboard_handle_keymap): silenced -Wwrite-strings .
2021-11-15 00:55:24 +03:00