Commit Graph

8972 Commits (dfbe1f7248649fdca86368bc51f3592931c8ebe5)

Author SHA1 Message Date
Sam Lantinga bfd2f8993f Fixed grab handling when focus changes between windows in the same application 2021-10-19 17:29:23 -07:00
James Howard d9c44b6537 Allow Cocoa_VideoInit to succeed when current display mode has invalid flags
This fixes a specific issue seen on macOS 10.14.6 where a DELL E248WFP
Display connected to a 2014 Mac Mini with a scaled 1920x1080 resolution
selected and SDL_Init(SDL_INIT_VIDEO) failed with the error: "The video
driver did not add any displays".

The underlying cause was that the current 1080p display mode did not
have the flag kDisplayModeSafeFlag, the check for which was added in
a963e36, with the idea that certain display modes should not be
candidates for switching to in fullscreen exclusive mode. That may well
be the right thing to do for filtering down a list of candidate modes,
but it doesn't pay to be so picky about the current mode. After all,
this current mode was set by System Preferences, the picture does appear
correctly on screen, and other non-SDL based applications launch and run
correctly in this mode.

Therefore the fix is to have GetDisplayMode only filter out a mode based
on flags if it's part of a candidate list, but if it's the current mode
and it can possibly be converted to an SDL_DisplayMode, do so.
2021-10-19 15:50:21 -07:00
Sylvain 649a33ae47
X11: remove redundant 'wakeup_lock' mutex creation 2021-10-18 23:00:43 +02:00
Ozkan Sezer c4bac66b74 os2, geniconv: replaced many uses of libc calls with SDL_ counterparts.
FIXME: figure out a way to handle errno checks properly.
2021-10-18 14:11:20 +03:00
Ozkan Sezer 0a0f685473 SDL_os2video.c: missed replacing a use of libc function 2021-10-18 14:10:56 +03:00
Ozkan Sezer 8e9ea2e362 SDL_os2joystick.c: missed replacing a use of libc function 2021-10-18 14:10:37 +03:00
Sylvain 8b1a2fe860
backout SDL_AndroidSetInputType() 2021-10-17 23:47:59 +02:00
Sylvain 6ef3bc5688
Add Dynapi for SDL_AndroidSetInputType() 2021-10-17 23:40:36 +02:00
Sylvain ccb12457f9
Fixed bug #4843 - Can not get the ime candidatelist like chinese/japaness input method 2021-10-17 23:17:54 +02:00
Sam Lantinga 7fb4364391 Don't process WM_INPUT when handling relative mode by warping the mouse cursor 2021-10-17 13:56:31 -07:00
DomGries 06824b18fd Cleanup windows events after recent changes
Improves clarity without any functional changes
2021-10-17 13:36:42 -07:00
Sylvain 50f969c1b2
Fixed bug #4841 - Out of bounds read (by 1 byte) in yuvnv12_rgb24_sseu 2021-10-17 22:02:19 +02:00
shaquan-omari ea97ab6164 Add mapping for HORI Fighting Commander OCTA controller on Linux 2021-10-16 15:25:38 -07:00
Sam Lantinga 1c5b3e0e16 Don't center the mouse when gaining focus unless we're using relative mode warping
This is necessary now that we actually change the mouse position when calling SDL_WarpMouseInWindow() in relative mode.
2021-10-15 18:12:18 -07:00
Sam Lantinga a70a94e0b3 Don't send a mouse leave event if the mouse is outside the window when gaining focus and in relative mode. 2021-10-15 18:11:19 -07:00
Ozkan Sezer c583055acb SDL_windowsevents.c (WIN_WindowProc): remove SAFE_AREA_X and SAFE_AREA_Y
Not used since commit a1fabca162
2021-10-15 10:11:24 +03:00
Sam Lantinga d5700ed20b Don't log SDL_POLLSENTINEL, it's purely for internal bookkeeping 2021-10-15 00:01:39 -07:00
Sam Lantinga dd5d89505d Fixed whitespace 2021-10-14 23:53:41 -07:00
Ozkan Sezer 7f728f3eb6 enabled os2 joystick code (if anyone has actually a use for it...) 2021-10-15 08:51:02 +03:00
SDL Wiki Bot 8a48ce00c8 Sync wiki -> header 2021-10-15 05:28:04 +00:00
Brick 8bf32e12d8
Improved SDL_PollEvent usage (#4794)
* Avoid unnecessary SDL_PumpEvents calls in SDL_WaitEventTimeout

* Add a sentinel event to avoid infinite poll loops

* Move SDL_POLLSENTINEL to new internal event category

* Tweak documentation to indicate SDL_PumpEvents isn't always called

* Avoid shadowing event variable

* Ignore poll sentinel if more (user) events have been added after

Co-authored-by: Sam Lantinga <slouken@libsdl.org>
2021-10-14 22:26:10 -07:00
Sam Lantinga 43da35b567 Back out documentation changes in favor of https://github.com/libsdl-org/SDL/pull/4794 2021-10-14 22:22:59 -07:00
Sam Lantinga 0dc57b0f08 Remove slightly misleading comment in the example code 2021-10-14 19:42:36 -07:00
Sam Lantinga ddf1d5c553 Update documentation to reflect that a single SDL_PumpEvents() each frame is the recommended way to handle events 2021-10-14 19:10:30 -07:00
Sam Lantinga 88e9f7765c Fixed relative mouse mode using warping after 82793ac279 2021-10-14 18:37:27 -07:00
Sam Lantinga a1fabca162 Removed mouse warping for local mice and improved warp handling for mouse over RDP 2021-10-14 16:52:21 -07:00
Sam Lantinga 82793ac279 Fixed mouse warping while in relative mode
We should get a mouse event with an absolute position and no relative motion and shouldn't change the OS cursor position at all
2021-10-14 14:26:21 -07:00
Sylvain 072e3fdfc4
Fixed bug #4534: NEON implementation of Convert51ToStereo (Thanks Ryan!) 2021-10-14 23:17:08 +02:00
Sam Lantinga 5e89b3c89e Don't need to use raw input to track the mouse during mouse capture (thanks Brick!) 2021-10-14 11:46:07 -07:00
Brick 0b6a821188 Messages posted on the same tick are not new 2021-10-14 09:05:38 -07:00
Rémy Tassoux 0789610cfb Add SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN 2021-10-14 08:39:48 -07:00
Sam Lantinga 227c33b8ec Add note about SDL_TICKS_PASSED hitting int overflow problems with large timeouts 2021-10-13 09:33:57 -07:00
Sam Lantinga 1fa154fda3 Fix weak enforcement of timeouts in SDL_WaitEventTimeout_Device. This will loop pumping events and waiting for a system event to come in. However not all system events will turn into an SDL event. It's not unusual for a Windows message to be some internal thing that SDL doesn't convert into a message. In that case the loop will simple circle but not exit. As long as such messages are coming in the loop will continue to run regardless of the timeout. When messages finally stop it'll still wait for the full timeout so you can have arbitrarily long delays.
Instead do an absolute elapsed time check since the start of the wait.  If that is exceeded during any iteration the routine exits as the timeout has elapsed.
2021-10-13 09:33:54 -07:00
Sam Lantinga 2423c51471 Work around hang in AAudioStream_write() during extended shared object loading while running in a debugger. Observed on a OnePlus 8T (KB2005) running Oxygen OS 11.0.10.10.KB05AA.
The observed behavior is that any nonzero timeout value would hang until the device was paused and resumed. And a zero timeout value would always return 0 frames written even when audio fragments could be heard. Making a manual timeout system unworkable.
None of the straightforward systems imply that there's a detectable problem before the call to AAudioStream_write(). And the callback set within AAudioStreamBuilder_setErrorCallback() does not get called as we enter the hang state.
I've found that AAudioStream_getTimestamp() will report an error state from another thread. So this change codifies that behavior a bit until a better fix or more root cause can be found.
2021-10-13 09:33:51 -07:00
Sylvain 325ae5c35d
Android: getCurrentOrientation uses getContext() to retrieve the activity (see bug #4825) 2021-10-13 08:35:56 +02:00
Erik Soma 0e294e90ae
Ensure that SDL_InitSubSystem quits subsystems after an error. (#4834)
* Ensure that SDL_InitSubSystem quits subsystems after an error.

* Fix unnecessary change.
2021-10-12 15:55:31 -07:00
Ozkan Sezer 6149e60136 remove IsWin10FCUorNewer() -- not used since commit 40ed9f75c9 2021-10-13 00:03:56 +03:00
Ozkan Sezer 311671a029 fixed build after commit 6e356e20ad 2021-10-12 23:50:02 +03:00
Rémy Tassoux 6e356e20ad Fix mouse focus being set to null when a captured mouse cursor leaves the window. 2021-10-12 13:30:46 -07:00
Cameron Cawley 9ee6942e79 Improve RISC OS implementations of SDL_GetBasePath and SDL_GetPrefPath 2021-10-12 13:07:52 -07:00
Cameron Cawley 3db898c5b6 riscos: Implement SDL_GetPrefPath() 2021-10-12 13:07:52 -07:00
Sylvain 723f5cea43
Fixed bug #4825 - NullPointerException on SDLActivity.getCurrentOrientation() (Thanks Benau!) 2021-10-12 20:58:58 +02:00
Ryan C. Gordon 1b49f09243
include: manually ran wikiheaders.pl and cleaned up the obvious issues. 2021-10-08 20:50:30 -04:00
Ryan C. Gordon 55f60847cb
wikiheaders.pl: Try to handle functions with multiple declarations better. 2021-10-08 20:50:30 -04:00
Ryan C. Gordon 3970a885a5
wikiheaders.pl: Migrate in docs that exist only in the wiki.
This is going to expose some docs that needs cleaning up once
the bridge imports those docs, though.
2021-10-08 15:58:02 -04:00
Ryan C. Gordon 194657a2c6
include: Fix indentation on SDL_SoftStretch doxygen comment.
Otherwise wikiheaders.pl doesn't think it's valid.
2021-10-08 15:58:01 -04:00
Sam Lantinga 40ed9f75c9 Workaround for Windows occasionally ignoring SetCursorPos() calls
Also, since we're flushing mouse motion before and including the warp, we don't need the isWin10FCUorNewer hack to simulate mouse warp motion.

Fixes https://github.com/libsdl-org/SDL/issues/4339 and https://github.com/libsdl-org/SDL/issues/4165
2021-10-08 10:05:27 -07:00
Sam Lantinga 373216ae5b Added support for touchpads in the Linux evdev code (thanks Francisco!) 2021-10-07 18:14:16 -07:00
Sam Lantinga 16aeb8d0f5 Guarantee that we don't dispatch any mouse motion from before or including the last mouse warp 2021-10-07 15:04:06 -07:00
Sam Lantinga 649466f491 Flush any pending mouse motion when warping the mouse cursor
Fixes https://github.com/libsdl-org/SDL/issues/4165
2021-10-07 13:28:44 -07:00