Commit Graph

297 Commits

Author SHA1 Message Date
Steven Noonan
b15bbd4e3f SDL_udev: check for NULL return value from udev_device_get_action
Signed-off-by: Steven Noonan <steven@valvesoftware.com>
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
2021-04-22 16:39:22 -07:00
Sylvain
98a966d1c2
Android: don't need to set the SurfaceHolder format from java code
It's already set with ANativeWindow_setGeometry, and eventually set/changed also by eglCreateWindowSurface.
 - avoid issues with older device where SurfaceView cycle create/changed/destroy appears broken:
   calling create/changed/changed, and leading to "deuqueBuffer failed at server side, error: -19", with black screen.
 - re-read the format after egl window surface is created, to report the correct one (sometimes, changed from RGBA8888 to RGB24)
2021-04-22 18:06:17 +02:00
Ryan C. Gordon
4914199665
ibus: make sure we don't pass a NULL path string over D-Bus.
Fixes #2941.
2021-04-04 00:29:26 -04:00
Ethan Lee
5ceb674426 linux: Fix ibus support on Wayland/XWayland 2021-03-29 08:50:56 -07:00
Cameron Cawley
391bb80bb9 Replace duplicate functions and lstrlen/lstrcat with SDL string functions 2021-03-05 12:03:58 -08:00
Amir
1a924bc0bb add SDL_AndroidShowToast for https://developer.android.com/reference/android/widget/Toast 2021-02-20 23:05:09 -08:00
Cacodemon345
cf15faae68 Change "memset" to "SDL_zero" 2021-02-14 13:54:08 -05:00
Cacodemon345
c5f9e061b5 Disable FreeBSD console mouse when initializing evdev input
Enable it again after quitting evdev input.
2021-02-14 13:54:08 -05:00
Sam Lantinga
d95a9eaedc Added WIN_IsWindows8OrGreater() for internal use 2021-02-10 10:22:17 -05:00
Sam Lantinga
c265e73f3b Fixed bug 5473 - Add WSCONS support for NetBSD
wahil1976

This patch adds WSCONS support for NetBSD.
2021-01-24 00:51:24 -05:00
Sam Lantinga
82aafa9aa8 Fixed bug 5461 - Add rewritten WSCONS driver for OpenBSD
wahil1976

This patch adds a written-from-scratch WSCONS driver for OpenBSD. It does not have hardcoded keymaps, and it features mouse support when wsmux is available.

For this to work, it needs access to the /dev/wskbd* devices which are not available to non-root users by default. Access to those can be granted by changing /etc/fbtab to give the logging user the ownership of those devices.
2021-01-14 14:32:11 -08:00
Sam Lantinga
2f72535c62 Fixed joysticks generating SDL mouse events 2021-01-08 09:54:55 -08:00
Ozkan Sezer
5b14bbff5f make ANSI/UNICODE versions of WIN??UTF8 macros individually available. 2021-01-04 10:00:10 +03:00
Ozkan Sezer
f2bd861cd7 move SDL_tcsstr definition to core/windows/SDL_windows.h 2021-01-04 08:50:00 +03:00
Ozkan Sezer
01a2f27679 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle()
cf. bug #5435.
2021-01-04 01:23:50 +03:00
Sam Lantinga
9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Luca Weiss
040bd7a91b Fix udev not detecting ID_INPUT_KEY devices when udev is not running
https://bugzilla.libsdl.org/show_bug.cgi?id=5308

The udev code labels devices that are found by this code with
ID_INPUT_KEY which in turn gets used by SDL to label the devices as
SDL_UDEV_DEVICE_KEYBOARD.

This was missing for the code path when udev is not running and as such
devices such as the power button of a phone was not detected as keyboard
input and no devices were emitted.
2020-12-28 00:55:28 +03:00
Ozkan Sezer
90456670b5 more "'for' loop initial declarations are only allowed in C99 mode" fixes 2020-12-17 14:11:00 +03:00
Sam Lantinga
bfffa275ef Fixed bug 5397 - Fcitx input is truncated
sowfelicity

Split the long text input event into multiple shorten text input event.
2020-12-14 09:23:53 -08:00
Ozkan Sezer
15cbddf497 linux/SDL_threadprio.c: fix build on older systems:
SCHED_RESET_ON_FORK is in kernel >= 2.6.32.
2020-12-13 18:00:20 +03:00
Sam Lantinga
cb36189692 Fixed bug 5235 - All internal sources should include SDL_assert.h
Ryan C. Gordon

We should really stick this in SDL_internal.h or something so it's always available.
2020-12-09 07:16:22 -08:00
Sam Lantinga
5b3616c325 Generalized the raw input controller driver and moved XInput/WGI detection into it for XInput devices
This fixes bad report parsing for various newer Xbox controllers, and this driver is now preferred over XInput, since it handles more than 4 controllers.
2020-11-23 18:24:05 -08:00
Sam Lantinga
1822f97e5f Fixed bug 5346 - Add FreeBSD evdev KBIO keyboard input driver
wahil1976

This patch adds the KBIO text input driver for FreeBSD, which allows text input to fully work without text spilling out into the console. It also supports accented input, AltGr keys and Alt Lock combinations.

Tested with US accent keys layout and various AltGr layouts.
2020-11-11 19:37:47 -08:00
Simon McVittie
aae53d5972 evdev: Detect whether input devices are accelerometers
Anything with X, Y and Z axes but no buttons is probably an
accelerometer (this is the assumption made in udev).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-11 19:15:09 -08:00
Simon McVittie
fdd945f2af joystick: Use a better heuristic to guess what is a joystick
Previously we only checked for at least one button or key and at least
the X and Y absolute axes, but this has both false positives and false
negatives.

Graphics tablets, trackpads and touchscreens all have buttons and
absolute X and Y axes, but we don't want to detect those as joysticks.
On normal Linux systems ordinary users do not have access to these
device nodes, but members of the 'input' group do.

Conversely, some game controllers only have digital buttons and no
analogue axes (the Nintendo Wiimote is an example), and some have axes
and no buttons (steering wheels or flight simulator rudders might not
have buttons).

Use the more elaborate heuristic factored out from SDL's udev code path
to handle these cases.

In an ideal world we could use exactly the same heuristic as udev's
input_id builtin, but that isn't under a suitable license for inclusion
in SDL, so we have to use a parallel implementation of something
vaguely similar.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-11 19:14:52 -08:00
Simon McVittie
8db3171b98 udev: Factor out SDL_EVDEV_GuessDeviceClass
This works on capability bitfields that can either come from udev or
from ioctls, so it is equally applicable to both udev and non-udev
input device detection.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-11 19:14:34 -08:00
Sam Lantinga
07eae7d670 Fix process randomly getting killed when SDL_THREAD_PRIORITY_HIGH/TIME_CRITICAL is set
When we request realtime priority from rtkit, we have a rttime limit. If we exceed
that limit, the kernel will send SIGKILL to the process to terminate it.

This isn't something that most high priority processes will want, only processes
that selectively opt into SCHED_RR/FIFO through SDL_HINT_THREAD_PRIORITY_POLICY
should be subject to this level of scrutiny.

This change:
  * Switches non-apple posix OSs to use SCHED_OTHER instead of SCHED_RR
for SDL_THREAD_PRIORITY_HIGH/SDL_THREAD_PRIORITY_TIME_CRITICAL.
  * Fixes using a hardcoded RLIMIT_RTTIME, instead queries it from rtkit
  * Only sets RLIMIT_RTTIME for MakeRealtime rtkit requests
  * Adds a note regarding the possible SIGKILL with SDL_HINT_THREAD_PRIORITY_POLICY
  * Introduces SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL to allow apps to acquire realtime scheduling policies on Linux
2020-11-11 08:47:18 -08:00
Sam Lantinga
94924f012b Fix failing to set high priority for threads on Linux desktop.
Debugging inside rtkit showed we were failing the RLIMIT_RTTIME check, now that we're asking for realtime and not just high-priority due to a change in SDL.

Between that and the DBus code in SDL being wrong in previous changelist I'm not sure how this could have ever worked.
2020-11-09 10:11:55 -08:00
Sam Lantinga
abf9dfd5c2 Fix MakeThreadRealtime DBus method call on Linux, type mismatch due to copy paste.
Nov 02 20:34:15 redcore rtkit-daemon[2825]: Failed to parse MakeThreadRealtime() method call: Argument 1 is specified to be of type "uint32", but is actually of type "int32"
Nov 02 20:34:15 redcore rtkit-daemon[2825]: Failed to parse MakeThreadRealtime() method call: Argument 1 is specified to be of type "uint32", but is actually of type "int32"

Docs:

http://git.0pointer.net/rtkit.git/tree/README

CLIENTS:
        To be able to make use of realtime scheduling clients may
        request so with a small D-Bus interface that is accessible on
        the interface org.freedesktop.RealtimeKit1 as object
        /org/freedesktop/RealtimeKit1 on the service
        org.freedesktop.RealtimeKit1:

                void MakeThreadRealtime(u64 thread_id, u32 priority);

                void MakeThreadHighPriority(u64 thread_id, s32 priority);
2020-11-09 10:11:38 -08:00
Ozkan Sezer
a4040293dd os2: misc build fixes 2020-10-25 10:10:02 +03:00
Ozkan Sezer
cbadd1e380 geniconv/os2iconv.c: make it build correctly against os2tk headers. 2020-10-20 20:32:20 +03:00
Ozkan Sezer
a90f0400a5 os2: a _lot_ of coding style cleanup, sot that they match the SDL style.
also renamed the 'debug' macro to debug_os2: the former was dangerously
a common name.

the binary (dll) output is precisely the same as before.
2020-10-15 21:37:30 +03:00
Ozkan Sezer
b6965a1774 os2: Andrey Vasilkin agreed that his code to be put under Zlib license:
add SDL license headers to geniconv sources.
2020-10-14 23:01:05 +03:00
Ozkan Sezer
1d9cf23e4c os2: updated copyright dates for 2020. header guard fixes. 2020-10-14 23:01:05 +03:00
Ozkan Sezer
aa790837eb os2: several warning fixes.
mostly those "W007: '&array' may not produce intended result" warnings
from Watcom, visible only in C++ mode.  one or two others here & there.
2020-10-14 23:01:02 +03:00
Ozkan Sezer
861ac81b37 os2: changes to debug macros 2020-10-14 23:01:01 +03:00
Ozkan Sezer
110a0f7bb1 os2: update include paths. add missing libc includes to geniconv. 2020-10-14 23:01:01 +03:00
Ozkan Sezer
74cfb81dbb os2: add port files for SDL2-2.0.4 from Andrey Vasilkin
only geniconv/iconv.h (was from LGPL libiconv) is replaced with a generic
minimal iconv.h based on public knowledge.
2020-10-14 23:01:00 +03:00
Ryan C. Gordon
2d82cf78e1 url: put the Android bits in core/android 2020-10-05 13:59:03 -04:00
Ryan C. Gordon
efd665e2c7 Backed out changeset a43cb4e54949
Trying this a different way.
2020-10-05 13:56:45 -04:00
Ryan C. Gordon
5f68812249 url: patched to compile on Android. 2020-10-05 13:52:52 -04:00
Ryan C. Gordon
77c9d73b63 Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
2020-10-05 11:30:33 -04:00
Sylvain Becker
dd55bfe89c Android: add helper function to open an URL/URI (see bug 2783) 2020-10-01 14:41:09 +02:00
Sylvain Becker
97fad04551 Fixed bug 5278 - export SDL_AndroidRequestPermission() (Thanks Huki!) 2020-09-02 19:38:03 +02:00
Sylvain Becker
965b466ee8 Fixed bug 4297 - Android StrictMode policy. Remove APK expansion support
"In the second half of 2021, new apps will be required to publish with the Android App Bundle on Google Play"
(see https://developer.android.com/guide/app-bundle)
And "Android App Bundles don't support APK expansion (*.obb) files".
2020-08-17 19:50:20 +02:00
Ozkan Sezer
4ba0a84718 core/linux/SDL_threadprio.c: fix build against older glibc versions 2020-06-22 23:24:02 +03:00
Sam Lantinga
cced5eb937 Fixed bug 5169 - Can not build current sources because of recent thread management changes
Manuel Alfayate Corchete

I'm trying to build SDL2 with threads support here in GNU/Linux, both X86 and ARM, and it does not seem to be possible ATM:


/home/manuel/src/SDLLLL/src/core/linux/SDL_threadprio.c:233:26: error: 'rtkit_max_realtime_priority' undeclared (first use in this function)
2020-06-04 09:23:18 -07:00
Sam Lantinga
cc2fe84d73 Getting closer. 2020-05-26 13:19:48 -07:00
Sam Lantinga
0713c5790d More Linux fixes. 2020-05-26 13:19:44 -07:00
Sam Lantinga
abd5841850 Make some changes to SDL_SetThreadPriority to try and have SDL transparently handle more of the work.
1. Comment that SDL_SetThreadPriority will make any necessary system changes when applying priority.
2. Add a hint to override SDL's default behavior for scheduler policy.
3. Modify the pthreads SDL_SetThreadPriority so that instead of just using the current thread scheduler policy it will change it to a policy that should work best for the requested priority.
4. Add hint checks in SDL_SetThreadPriority so that #3 can be overridden if desired.
5. Modify the Linux SDL_SetThreadPriority so that in the case that policy, either by SDL defaults or from the hint, is a realtime policy it uses the realtime rtkit API.
6. Prior to calling rtkit on Linux make the necessary thread state changes that rtkit requires.  Currently this is done every time as it isn't expected that SDL_SetThreadPriority will be called repeatedly for a thread.
2020-05-26 13:19:19 -07:00