|
b2463a91
|
2022-03-06T15:02:53
|
|
events: Add logging support for several missing event types
|
|
6c531c43
|
2022-02-21T11:35:31
|
|
Correct handling of sentinel events when polling without removing events
Fixes https://github.com/libsdl-org/SDL/issues/5350
|
|
e2f70a2d
|
2022-01-19T12:51:26
|
|
cleanup SDL_EventState
|
|
84320266
|
2022-01-25T12:37:43
|
|
Fixed the queue filling up with sentinel events when the WaitEvent call is passed NULL for the event
The use case is an application that waits for events on the main thread and dispatches them on a separate thread.
|
|
d8129c56
|
2022-01-10T10:50:59
|
|
Mark internal function as static
|
|
dca281e8
|
2022-01-08T08:49:34
|
|
Fixed getting different results for SDL_PollEvent(NULL) and SDL_PollEvent(&event)
|
|
289c3fbb
|
2022-01-07T17:07:22
|
|
Revert "We only need to add the sentinel at the top of SDL_WaitEventTimeout()"
This reverts commit c477768e6f926c38d4cdc236cab8376faf9f6789.
We want to add the sentinel anytime we pump inside SDL_WaitEventTimeout() to avoid pumping again the next time through, as a performance optimization.
|
|
c477768e
|
2022-01-06T18:58:30
|
|
We only need to add the sentinel at the top of SDL_WaitEventTimeout()
|
|
e9134b04
|
2022-01-06T19:38:10
|
|
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.
|
|
95485884
|
2022-01-06T13:58:39
|
|
Move special sentinel handling inside SDL_PeepEvents()
|
|
2592e621
|
2022-01-06T13:30:26
|
|
Clarify that timeout == 0 is handled at the top of SDL_WaitEventTimeout()
|
|
8ff21668
|
2022-01-06T12:56:07
|
|
Only return from SDL_PollEvent() if the last sentinel is consumed
|
|
c9ff90b9
|
2022-01-06T12:03:09
|
|
Clarify comment
Co-authored-by: Simon McVittie <smcv@debian.org>
|
|
31f8c3ef
|
2022-01-06T11:27:44
|
|
Fixed event pump starvation if the application frequently pushes its own events
|
|
120c76c8
|
2022-01-03T09:40:00
|
|
Updated copyright for 2022
|
|
9ae56cb3
|
2021-12-06T21:18:23
|
|
events: Add logging for SDL_MOUSEWHEEL preciseX/Y fields
|
|
f73376ae
|
2021-11-02T00:31:25
|
|
events: Add logging for SDL_CONTROLLERTOUCHPAD*, SDL_CONTROLLERSENSORUPDATE, and SDL_SENSORUPDATE events
|
|
a5598649
|
2021-10-30T19:30:34
|
|
x11/wayland: Fix signal handling while blocking in WaitEventTimeout()
Add a new flag to avoid suppressing EINTR in SDL_IOReady(). Pass the
flag in WaitEventTimeout() to ensure that a SIGINT will wake up
SDL_WaitEvent() without another event coming in.
|
|
ac54d57a
|
2021-10-26T20:02:38
|
|
event: Check subsystem initialization before events or devices
SDL_WasInit() is cheaper SDL_NumJoysticks()/SDL_NumSensors().
|
|
1bc6dc3e
|
2021-10-26T20:02:04
|
|
event: Cap maximum wait time if sensor or joystick subsystems are active
Joystick and sensor subsystems require periodic polling to detect new devices.
|
|
d5700ed2
|
2021-10-15T00:01:39
|
|
Don't log SDL_POLLSENTINEL, it's purely for internal bookkeeping
|
|
dd5d8950
|
2021-10-14T23:53:25
|
|
Fixed whitespace
|
|
8bf32e12
|
2021-10-15T06:26:10
|
|
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>
|
|
1fa154fd
|
2021-10-13T09:33:54
|
|
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.
|
|
fbc36490
|
2021-08-14T22:29:05
|
|
Use the new SDL_clamp() macro where sensible
There were a few places throughout the SDL code where values were
clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp()
macro, use this instead.
|
|
7948c16d
|
2021-06-12T17:56:52
|
|
Pump events each time through the loop in SDL_WaitEventTimeout_Device()
Not only is it more efficient to batch process pending events, it is
necessary for correctness with the Win32 backend. WIN_PumpEvents() runs
periodic updates of the cursor clip region and disambiguation of
left and right shift keys in addition to standard event processing.
|
|
105de64c
|
2021-06-12T16:19:03
|
|
Only queue one wakeup event per wait
Queuing more than one can lead to a spurious wakeup on the next wait.
|
|
e13b43ac
|
2021-06-05T12:44:08
|
|
Don't skip sending wakeups for the current thread
We can be in a situation where we receive a win32 hook callback on the same
thread that is currently waiting. In that case, we do still need to trigger
a wakeup when an event is pushed because the hook itself won't necessarily
do that (depending on what we return from the hook).
|
|
b992b915
|
2021-06-05T11:57:30
|
|
Optimize SDL_WaitEventTimeout() for the SDL_PollEvent() case
There's no sense in doing all the setup for waiting if we're just polling.
|
|
85b51e6c
|
2021-06-05T11:46:47
|
|
Fall back to polling normally if not operating the win32 message loop
In this condition, we cannot safely wait/wake on events.
|
|
e13d5df0
|
2021-06-05T11:41:55
|
|
Call SDL_SendWakeupEvent() directly from SDL_PeepEvent()
SDL_PeepEvent() is a documented public API, so we must properly support
waking a waiting thread in SDL_WaitEventTimeout() with SDL_PeepEvent().
|
|
0dd7024d
|
2021-03-12T21:58:20
|
|
Modifies WaitEvent and WaitEventTimeout to actually wait instead of polling
When possible use native os functions to make a blocking call waiting for
an incoming event. Previous behavior was to continuously poll the event
queue with a small delay between each poll.
The blocking call uses a new optional video driver event,
WaitEventTimeout, if available. It is called only if an window
already shown is available. If present the window is designated
using the variable wakeup_window to receive a wakeup event if
needed.
The WaitEventTimeout function accept a timeout parameter. If
positive the call will wait for an event or return if the timeout
expired without any event. If the timeout is zero it will
implement a polling behavior. If the timeout is negative the
function will block indefinetely waiting for an event.
To let the main thread sees events sent form a different thread
a "wake-up" signal is sent to the main thread if the main thread
is in a blocking state. The wake-up event is sent to the designated
wakeup_window if present.
The wake-up event is sent only if the PushEvent call is coming
from a different thread. Before sending the wake-up event
the ID of the thread making the blocking call is saved using the
variable blocking_thread_id and it is compared to the current
thread's id to decide if the wake-up event should be sent.
Two new optional video device methods are introduced:
WaitEventTimeout
SendWakeupEvent
in addition the mutex
wakeup_lock
which is defined and initialized but only for the drivers supporting the
methods above.
If the methods are not present the system behaves as previously
performing a periodic polling of the events queue.
The blocking call is disabled if a joystick or sensor is detected
and falls back to previous behavior.
|
|
9130f7c3
|
2021-01-02T10:25:38
|
|
Updated copyright for 2021
|
|
5f7cd1fa
|
2020-12-18T10:08:59
|
|
Added hints to control whether SDL updates joystick and sensor state in the main event loop
|
|
fa23e3d0
|
2020-05-04T02:27:29
|
|
locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.
Fixes Bugzilla #2131.
|
|
d4f1b520
|
2020-04-08T19:16:31
|
|
Added support for press/release hardware keyboard events in iOS 13.4
|
|
1f4965c8
|
2020-03-08T21:24:06
|
|
Fixed warnings building with mingw64
|
|
997f3e9e
|
2020-03-02T09:03:55
|
|
Fixed build warnings
|
|
b5849daf
|
2020-02-01T09:23:04
|
|
Fixed build warnings on Android
|
|
a8780c6a
|
2020-01-16T20:49:25
|
|
Updated copyright date for 2020
|
|
526b9bdf
|
2019-10-14T22:41:27
|
|
Backed out changeset b0241180cdc5
Better commit incoming!
|
|
cd8652d8
|
2019-10-15T01:13:44
|
|
events: SDL_WaitEvent()'s polling loop now sleeps 1ms instead of 10ms.
Fixes Bugzilla #4356.
|
|
f3226457
|
2019-06-19T17:11:20
|
|
Fixed bug 4672 - Warnings in SDL_LogEvent()
|
|
12c5cda6
|
2019-03-16T00:08:19
|
|
Fix compiler warnings.
|
|
8a5a05c1
|
2019-03-15T15:51:05
|
|
events: Let arbitrary signals to simulate iOS/Android backgrounding events.
This lets you build a custom embedded device that roughly offers the "this
process is going to the background NOW" semantics of SDL on a mobile device.
|
|
911bf624
|
2019-03-15T14:08:30
|
|
events: Make debug logging of the event queue a hint instead of an #ifdef.
This makes it easy to toggle it on when debugging a new platform (or just
getting more visibility into an app) without having to rebuild SDL.
|
|
5e13087b
|
2019-01-04T22:01:14
|
|
Updated copyright for 2019
|
|
31ee4d3d
|
2018-11-03T15:46:42
|
|
Reduce delay to 1 ms in SDL_WaitEventTimeout() and SDL_WaitEvent()
The 10 ms delay effectively caps input polling at 100 Hz and rendering
at 100 FPS if applications use these functions in their event loop. The
delay may also lead to dropped frames even at 60 FPS due if they are
unlucky enough to hit the delay and rendering takes longer than 6 ms.
|
|
f8b4cd41
|
2018-09-30T19:53:26
|
|
Re-enable drag-and-drop events by default
|
|
7c3040e0
|
2018-08-21T12:11:34
|
|
First pass on the new SDL sensor API
|
|
e061a92d
|
2018-08-02T16:03:47
|
|
Some drag'and'drop improvements.
First: disable d'n'd events by default; most apps don't need these at all, and
if an app doesn't explicitly handle these, each drop on the window will cause
a memory leak if the events are enabled. This follows the guidelines we have
for SDL_TEXTINPUT events already.
Second: when events are enabled or disabled, signal the video layer, as it
might be able to inform the OS, causing UI changes or optimizations (for
example, dropping a file icon on a Cocoa app that isn't accepting drops will
cause macOS to show a rejection animation instead of the drop operation just
vanishing into the ether, X11 might show a different cursor when dragging
onto an accepting window, etc).
Third: fill in the drop event details in the test library and enable the
events in testwm.c for making sure this all works as expected.
|
|
e3cc5b2c
|
2018-01-03T10:03:25
|
|
Updated copyright for 2018
|
|
ca729766
|
2017-12-12T16:10:20
|
|
Fixed bug 3996 - Corrupted or over-released critical section on SDL_Quit (SDL_event_watchers_lock)
Andrew
This likely comes down to an additional 'unlock' being called before destroying it, without a matching 'lock'.
|
|
b53c35df
|
2017-10-11T13:26:58
|
|
Fixed size in realloc
|
|
8446d4a0
|
2017-10-10T20:11:05
|
|
Changed overlapping memcpy to memmove
|
|
eb9e6938
|
2017-10-10T19:44:33
|
|
Fixed potentially calling a callback after it has been removed (and userdata possibly deleted)
|
|
b647bd06
|
2017-10-10T17:41:41
|
|
The event filter and event watch functions are now thread-safe
|
|
50efbda7
|
2017-08-28T00:43:14
|
|
Fixed mingw Windows build, since SDL_vulkan_internal.h includes windows.h
|
|
45b774e3
|
2017-01-01T18:33:28
|
|
Updated copyright for 2017
|
|
062ca2b2
|
2016-11-05T21:22:39
|
|
Removed empty statement.
|
|
0f83ae0f
|
2016-11-03T01:29:56
|
|
Added some debug logging to print out every event added to the SDL queue.
|
|
5c2320f1
|
2016-10-07T17:58:02
|
|
Fixed bug 3022 - SDL_UnlockMutex(SDL_EventQ.lock) in SDL_PeepEvents can cause error when lock is null
|
|
6303941a
|
2016-03-08T13:55:50
|
|
Fixed infinite timeout in SDL_WaitEventTimeout() - thanks ?????????? ????????
|
|
1fb30db0
|
2016-01-31T11:29:11
|
|
Return the full number of events from SDL_PeepEvents() if NULL is passed in with SDL_PEEKEVENT
|
|
fa8c83c1
|
2016-01-03T06:50:50
|
|
Remove almost all instances of "volatile" keyword.
As Tiffany pointed out in Bugzilla, volatile is not useful for thread safety:
https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/
Some of these volatiles didn't need to be, some were otherwise protected by
spinlocks or mutexes, and some got moved over to SDL_atomic_t data, etc.
Fixes Bugzilla #3220.
|
|
42065e78
|
2016-01-02T10:10:34
|
|
Updated copyright to 2016
|
|
2b0140a9
|
2015-10-27T11:17:32
|
|
Add a new SDL_KEYMAPCHANGED SDL event to abstract notification of keyboard layout or input language changes.
|
|
0e45984f
|
2015-06-21T17:33:46
|
|
Fixed crash if initialization of EGL failed but was tried again later.
The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly
uninitialized data structure if loading the library first failed. A later try to
use EGL then skipped initialization and assumed it was previously successful
because the data structure now already existed. This led to at least one crash
in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was
dereferenced to make a call to eglBindAPI().
|
|
7232e51a
|
2015-06-08T01:52:43
|
|
Unix: Don't send quit events during signal handler.
Make note to send it, and send next time we SDL_PumpEvents().
Otherwise, we might be trying to use malloc() to push a new event on the
queue while a signal is interrupting malloc() elsewhere, usually causing a
crash.
Fixes Bugzilla #2870.
|
|
2c4a6ea0
|
2015-05-26T06:27:46
|
|
Updated the copyright year to 2015
|
|
b72938c8
|
2015-04-20T12:22:44
|
|
Windows: Always set the system timer resolution to 1ms by default.
An existing hint lets apps that don't need the timer resolution changed avoid
this, to save battery, etc, but this fixes several problems in timing, audio
callbacks not firing fast enough, etc.
Fixes Bugzilla #2944.
|
|
fe6c797c
|
2015-04-10T23:30:31
|
|
Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
|
|
87ef19c4
|
2015-03-25T10:19:10
|
|
Keep track of maximum number of events in-flight in the SDL queue at once.
|
|
b88ca1b4
|
2015-02-10T16:28:56
|
|
the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here.
Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture.
More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
|
|
b48e54aa
|
2015-01-26T22:00:29
|
|
Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation
Jonas Kulla
The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c.
I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
|
|
70438be2
|
2014-12-03T10:55:23
|
|
WinRT: fixed bug whereby SDL would override an app's default orientation
WinRT apps can set a default, preferred orientation via a .appxmanifest file.
SDL was overriding this on app startup, and making the app use all possible
orientations (landscape and portrait).
Thanks to Eric Wing for the heads up on this!
|
|
9c398852
|
2014-11-22T22:20:40
|
|
Corrected header file documentation comment.
|
|
24c86b55
|
2014-09-11T19:24:42
|
|
[X11] Reconcile logical keyboard state with physical state on FocusIn
since the window system doesn't do it for us like other platforms.
This prevents sticky keys and missed keys when going in and out
of focus, for example Alt would appear to stick if switching away
from an SDL app with Alt-Tab and had to be pressed again.
CR: Sam
|
|
553028c9
|
2014-06-22T11:02:56
|
|
Partial fix for bug 2556 - add compilation flag -Wshadow
I added -Wshadow and then turned it off again because of massive variable shadowing in the blit macros.
Feel free to go through that code and fix these if you want. Just uncomment CheckWarnShadow in configure.in if you want to try this.
|
|
446d19c4
|
2014-06-14T23:31:23
|
|
Removed SDL_SYS_JoystickNeedsPolling().
It was simpler to just have the polling (actually: hotplug detection)
functions return immediately if it's not an appropriate time to poll.
Note that previously, if any joystick/controller was opened, we would poll
every time anyhow, skipping this function.
|
|
52222db2
|
2014-05-31T11:33:25
|
|
Fixed SDL error when filtering events after shutdown.
This can happen when restoring video modes during video system shutdown
|
|
3dcb451f
|
2014-04-09T21:29:19
|
|
Added a README file regarding WinRT support
To note, this file is currently formatted with CRLF line endings, rather than
LF, to allow the file to be viewed with Notepad.
|
|
5512eac6
|
2014-02-22T15:27:11
|
|
Fixed bug 2414 - Execute event watchers in the order they were added
Leonardo
Event watchers are being executed on the inverse order they are added because they are added to the head of the SDL_event_watchers list.
Since watchers are allowed to change events before they are reported (they shouldn't, imo), this breaks code that rely on watcher execution order (such as distributed event handling).
An easy scenario to see this behaving weird to the user is if you add an event watcher to check mouse coordinates and check them again in your event loop. If you add the watcher after renderer's one (which always happens after you have initialized renderer), you get the same event but different coordinates.
The proposed patch adds the event watcher in the tail of the list, not in the beginning, and correctly fixes this problem.
|
|
58edac3e
|
2014-02-02T00:53:27
|
|
Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
|
|
f848adff
|
2013-11-29T10:06:08
|
|
Improve Android pause/resume behavior.
|
|
7e1289af
|
2013-11-24T23:56:17
|
|
Make internal SDL sources include SDL_internal.h instead of SDL_config.h
The new header will include SDL_config.h, but allows for other global stuff.
|
|
08fa8da7
|
2013-10-20T21:56:15
|
|
Fixed bug 2129 - fix for bug 2121 breaks linking for mingw and throws multiple warnings
Andreas Ertelt
The problem in question is caused by changeset 7771 (http://hg.libsdl.org/SDL/rev/5486e579872e / https://bugzilla.libsdl.org/show_bug.cgi?id=2121)
The redefinition of __inline__ (introduced by the addition of begin_code.h:128's "|| __STRICT_ANSI__") results in mingw's gcc throwing multiple
warning: always_inline function might not be inlinable [-Wattributes]
as well as a whole bunch of redefinitions of mingw internals which break linking of projects including the SDL2 headers.
|
|
f5fa492e
|
2013-10-20T20:42:55
|
|
Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values.
Went through the code and used the macro and fixed a couple places that were using incorrect timestamp comparisons.
|
|
f79fc33a
|
2013-08-29T08:29:21
|
|
Christoph Mallon: Remove pointless if (x) before SDL_free(x)
|
|
dad42067
|
2013-08-12T11:13:50
|
|
Fixes #2022, do not resume on Android when surfaceChanged
If the app is in landscape mode and the user presses the power button, a pause
is followed immediately by a surfaceChanged event because the lock screen
is shown in portrait mode. This triggers a "false" resume.
So, we just pause and resume following the onWindowFocusChanged events.
Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before
blocking the event pump.
|
|
1ad936eb
|
2013-08-11T19:56:43
|
|
Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow()
Rainer Deyke
I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.
|