Commit Graph

6554 Commits

Author SHA1 Message Date
Sylvain
3e70553c48 Unneed test before calling SDL_FreeSurface 2022-11-18 06:58:34 -08:00
Sam Lantinga
78ea6af2cd Updated to version 2.25.1 for release candidate 2022-11-17 09:01:35 -08:00
Sylvain
89572af6a8
Fixed bug #6537 - AIX: use PAUDIO_WaitDevice 2022-11-17 11:43:46 +01:00
Sylvain
cd0d5a5fc5
Don't compare pointer against '0', but NULL 2022-11-17 11:23:15 +01:00
Sylvain
ddad901c0d
Remove unneeded semicolon 2022-11-17 10:43:45 +01:00
Sylvain
60c6cd554d
Fixed bug #6533 - PS2_JoystickUpdate: some invalid condition 2022-11-17 09:34:27 +01:00
Sam Lantinga
77bcd269be Allow creating an empty surface with pitch 0
This fixes Maelstrom, which creates an empty staging surface and then uses it for transfer to texture
2022-11-16 22:23:16 -08:00
Ryan C. Gordon
a1702d463c
ibus: Try to use org.freedesktop.portal.IBus first if available.
This should fix apps that want ibus support inside sandboxed environments
like FlatPak or Snaps.

Fixes #4706.
2022-11-16 23:39:41 -05:00
Ryan C. Gordon
bb0b8adacc mac: Fix handling of deprecated symbol.
This needs to check what our deployment target is, not what SDK
is available, since this is a linker symbol and not an enum
value or whatever.

Also removed a copy/paste error that mentioned CoreAudio in
the haptic subsystem.

Fixes #6534.
2022-11-16 22:04:04 -05:00
Sam Lantinga
913e403f2a Fixed error message when trying to create an OpenGLES2 renderer on macOS
Testing: testsprite2 --renderer opengles2

OpenGLES2 isn't available by default, and we want to see the error "Could not load EGL library"
2022-11-16 18:03:29 -08:00
Sam Lantinga
fcc994e132 ensure that SDL2 does not set conflicting window flags (thanks @pionere!) 2022-11-16 17:40:32 -08:00
Sylvain
ce5da5d579
Don't compare pointer against '0', but NULL 2022-11-16 21:47:43 +01:00
Sylvain
1d7966df15
Remove un-needed check for NULL pointer. They were previously checked just before. 2022-11-16 21:27:16 +01:00
Frank Praznik
8ea96f365f events: Remove X and XKB keysym constants and headers
The XKB_KEY_* and XK_* macros resolve to the same constant values, so use the raw values and note what keys they correspond to in the comments, as is done for the other keysym values in this file.

This completely eliminates the need for any X or XKB system headers along with the if/else defines.
2022-11-16 11:42:53 -08:00
Ryan C. Gordon
389ffab733 Code style fixes, etc.
Reference PR #6345.
2022-11-16 12:53:48 -05:00
ulatekh
ec58a817ef Fixes made in response to running a static code analyzer under MS Windows.
Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs.

SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision.
SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer.
SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used.
SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range.
SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it.
SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691).
SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen.
SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL.
SDL_pixels.c: Looks like the switch is genuinely missing a break!
SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons.
SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns.
2022-11-16 12:43:20 -05:00
Ryan C. Gordon
7ebdae5dc9 cocoa: Fix OpenGL deprecation warning. 2022-11-16 11:45:41 -05:00
Ryan C. Gordon
7c760f7f79 cocoa: Update CVDisplayLink timing when screen changes.
This handles both the window moving to a new display and
changing the current display's refresh rate in System
Preferences

Reference Issue #4918.
2022-11-16 11:35:27 -05:00
Ryan C. Gordon
1fd66cc890 Revert "cocoa: Backed out CVDisplayLink code for macOS vsync."
This reverts commit 04b50f6c6b.

It turns out OpenGL vsync has broken again in macOS 12, so
we're reintroducing our CVDisplayLink code to deal with it,
again.

Reference Issue #4918.
2022-11-16 11:34:25 -05:00
Ryan C. Gordon
9d67686a5b haptic: Deal with deprecated macOS symbol. 2022-11-16 10:08:40 -05:00
Ryan C. Gordon
6801d676c0
Revert "pulseaudio: Only use PA_STREAM_ADJUST_LATENCY if buffer isn't super small."
This reverts commit d8b1ef42ae.

This turned out to be unnecessary (it was a problem on the user's system,
not an SDL bug).

Reference Issue #6121.
2022-11-16 09:53:37 -05:00
Frank Praznik
903301c6aa wayland: Always use integer scaling for cursors.
Cursors don't get fractionally scaled, so always scale system cursor sizes to the next whole integer.
2022-11-16 06:15:17 -08:00
Ryan C. Gordon
d8b1ef42ae
pulseaudio: Only use PA_STREAM_ADJUST_LATENCY if buffer isn't super small.
Fixes #6121.
2022-11-15 22:44:31 -05:00
Sam Lantinga
02ab7f3745 Fixed release build using clang on Windows 2022-11-15 12:57:07 -08:00
Sam Lantinga
98f93d0aa1 Fixed building without xkbcommon support 2022-11-15 11:39:06 -08:00
Sam Lantinga
615901dbfe Removed unnecessary header
The xkbcommon-keysyms.h header isn't available on some older systems,
and we don't actually need it for this code.
2022-11-15 11:19:08 -08:00
Frank Praznik
c855184765 wayland: Handle virtual keyboards that don't fit the X mapping
SDL is built around the concept of keyboards having a fixed layout with scancodes that correspond to physical keys no matter what linguistic layout is used. Virtual keyboards don't have this concept and can present an arbitrary layout of keys with arbitrary scancodes and names, which don't fit the SDL model. When one of these keyboards is encountered, it requires special handling: use the keysym of the pressed keys to derive their ANSI keyboard scancode equivalents for control keys and ASCII characters. All other characters are passed through as text events only.
2022-11-15 11:00:39 -08:00
Frank Praznik
d1858eb124 events: Add a helper function to get the default keycode for a scancode
Add a helper function to get the keycode for a scancode from the default lookup table. Unlike SDL_GetKeyFromScancode(), this is not affected by the set keymap.
2022-11-15 11:00:39 -08:00
Frank Praznik
0e446c54bd events: Factor out the xkb keysym to scancode conversion from the X11 driver 2022-11-15 11:00:39 -08:00
Ryan C. Gordon
44d7b8b91d
egl: Check for a NULL pointer in SDL_EGL_GetProcAddress.
This happens on kmsdrm if you try to GetProcAddress before creating
a window.

Fixes #5399.
2022-11-15 13:59:24 -05:00
Ethan Lee
f3cc99fb93
x11: Minor style fixes for recent OSK changes 2022-11-15 13:56:44 -05:00
Sam Lantinga
70656b133c Don't recreate the window when creating a Metal renderer on an OpenGL window.
It turns out that we can safely create a Metal view on an existing window, and that avoids issues with the window being recreated with the wrong orientation in iOS 16.

Fixes https://github.com/libsdl-org/SDL/issues/6289
2022-11-15 10:21:07 -08:00
Pierre Wendling
80ff20f6fe N3DS: Set keyboard focus to newly created windows.
This fixes polling issues with Joystick subsystem where
`SDL_PrivateJoystickShouldIgnoreEvent` would always return true, thus
ignoring all inputs.
2022-11-14 21:24:10 -08:00
Pierre Wendling
491d0bcc3c N3DS: Refactor N3DS_FileOpen. 2022-11-14 21:24:10 -08:00
Pierre Wendling
de5fa89b50 N3DS: Prepend PrefPath with sdmc:. 2022-11-14 21:24:10 -08:00
Pierre Wendling
7d536d5240 N3DS: Put SDL_Log.txt in the proper directory.
The homebrew "user" directory should be `/3ds/`.
To avoid ambiguity, `sdmc:` is specified.
2022-11-14 21:24:10 -08:00
Pierre Wendling
bf4f9aaa63 N3DS: Use designated initialiser for drivers.
Just a sanity check that the functions are actually mapped correctly.
2022-11-14 21:24:10 -08:00
Sam Lantinga
a40b7cde10 Workaround for views being in portrait instead of landscape mode on iOS 16
Fixes https://github.com/libsdl-org/SDL/issues/6289
2022-11-14 13:03:52 -08:00
pionere
b886f4c6c9 events: eliminate redundant code in SDL_SendEditingText 2022-11-14 09:00:45 -08:00
pionere
dad8df3ed1 video: check graphics flags the same way in SDL_RecreateWindow as in SDL_CreateWindow
- single check to validate the graphics flags
- check it before tearing down the window
2022-11-14 07:53:41 -08:00
Frank Praznik
eef4d3c86a wayland: Clamp wl_seat version on older versions of libwayland
Clamp the wl_seat max version to 5 if being built against a version of libwayland below 1.21.0, or containers that bundle newer versions of SDL with older versions of libwayland can break if the compositor advertises support for a protocol version above 5.
2022-11-13 17:48:14 -06:00
Sam Lantinga
674989261d Fixed warning
Fixes https://github.com/libsdl-org/SDL/issues/5842
2022-11-13 11:09:39 -08:00
Ethan Lee
c4b9f62164 x11: Add support for the Steam Deck on-screen keyboard 2022-11-13 11:02:27 -08:00
pionere
5f2a1231dd video: check graphics flags the same way as the type flags 2022-11-13 08:31:50 -08:00
pionere
22354b4142 video: simplify window-type check in SDL_CreateWindow 2022-11-12 07:18:04 -08:00
Ryan C. Gordon
85aa9b8b6f
wasapi: Favor the system resampler again, for now.
Reference Issue #5538.
2022-11-11 13:48:11 -05:00
Sam Lantinga
9f8b68a278 Fixed building without linux/input.h
https://github.com/libsdl-org/SDL/issues/6169
2022-11-11 10:25:52 -08:00
Sam Lantinga
b7e65a81f1 Fixed incorrect WGI controller state when the application loses focus
Recenter the controller elements when WGI stops reporting valid state

Fixes https://github.com/libsdl-org/SDL/issues/5261
2022-11-11 08:58:27 -08:00
Michael Fitzmayer
875e9b35d7 N-Gage: additional cleanup 2022-11-11 05:04:28 -08:00
Michael Fitzmayer
afbafc2aef Remove redundant dependency to bitdraw.h, minor cleanup 2022-11-11 05:04:28 -08:00