Frank Praznik
2f276a2eea
video: Expose HDR metadata per-window
...
Moves the HDR properties from the display to be per-window, and adds the frog_color protocol to enable HDR under Wayland.
2024-06-20 15:55:07 -04:00
Sam Lantinga
cf2d8dac30
Reordered conditional for clarity
2024-06-16 06:25:41 -07:00
expikr
ee559d51be
Add SDL_MOUSE_RELATIVE_CURSOR_VISIBLE ( #7947 )
2024-06-16 06:21:29 -07:00
Ryan C. Gordon
38f0214e8a
audio: Refer to audio devices to "playback" and "recording".
...
Fixes #9619 .
2024-06-15 01:08:12 -04:00
Ozkan Sezer
d6da494c1c
un-revert commit 65d911a:
...
SDL3 isn't using `long long` casts, so there are no issues there
SDL2 needs handling it right..
2024-06-14 18:37:50 +03:00
Ozkan Sezer
e25a7e88ce
revert commit 65d911a as it broke linux..
2024-06-14 14:56:24 +03:00
Ozkan Sezer
65d911aff0
SDL_events.c: override of SDL_PRIs64 for mingw is no longer needed
2024-06-14 14:50:50 +03:00
Sam Lantinga
44f66b5c8b
Show the cursor when relative mode is enabled and the app doesn't have focus
...
Testing:
* Run test/testwm
* Hit Ctrl-R to toggle relative mode
* Alt-tab away
* Move the mouse over testwm
* Note that the cursor is visible until testwm gains focus
2024-06-10 14:57:32 -07:00
Sam Lantinga
23db1062fc
Document that you can pass NULL to SDL_PeepEvents()
...
Fixes https://github.com/libsdl-org/sdlwiki/issues/547
2024-06-06 10:08:20 -07:00
Sam Lantinga
ce65f84fd8
Fixed Android warnings
2024-06-04 16:38:32 -07:00
Ryan C. Gordon
e23257307e
Introduce formal policy for APIs that return strings.
...
This declares that any `const char *` returned from SDL is owned by SDL, and
promises to be valid _at least_ until the next time the event queue runs, or
SDL_Quit() is called, even if the thing that owns the string gets destroyed
or changed before then.
This is noted in the headers as "the SDL_GetStringRule", so this will both be
greppable to find a detailed explaination in docs/README-strings.md and
wikiheaders will automatically turn it into a link we can point at the
appropriate documentation.
Fixes #9902 .
(and several FIXMEs, both known and yet-undocumented.)
2024-06-03 14:20:49 -04:00
Sam Lantinga
b0e93e4e63
Prevent crashes if freed objects are passed to SDL API functions
...
Instead of using the magic tag in the object, we'll actually keep track of valid objects
Fixes https://github.com/libsdl-org/SDL/issues/9869
Fixes https://github.com/libsdl-org/SDL/issues/9235
2024-06-03 08:54:46 -07:00
Hunter Kvalevog
8604847214
SDL_SetEventFilter: Don't flush when removing filter
...
Don't flush the event queue if the filter paramter is NULL.
2024-05-30 13:06:01 -07:00
Hunter Kvalevog
0136bf2f8f
SDL_SetEventFilter: Don't flush good events
...
Only cut events that don't pass the user filter instead of flushing the
entire list.
Fixes #9592
2024-05-30 13:06:01 -07:00
Ryan C. Gordon
cf2874080f
mouse: Move mouse button state from a Uint32 to a formal typedef.
...
Reference Issue #9812 .
2024-05-26 13:23:21 -04:00
Ryan C. Gordon
0f0570b060
pen: Change a Uint32 bitfield into a typedef.
...
Reference Issue #9812 .
2024-05-26 13:23:21 -04:00
Sam Lantinga
836e6c1531
Don't toggle modifier state for repeated keys (thanks @dalawren!)
...
Closes https://github.com/libsdl-org/SDL/pull/9387
2024-05-24 04:44:56 -07:00
Frank Praznik
b1061a3ec1
video: Rename 'state_not_floating' to the more descriptive 'tiled'
2024-05-23 10:35:58 -04:00
Susko3
9d03ff6c18
Decrement before as the code makes more sense
2024-05-20 11:08:19 -07:00
Susko3
9458dc07dc
Fix double-free on cleanup and general nonsense when deleting fingers
2024-05-20 11:08:19 -07:00
Sam Lantinga
92301ae8a3
Fixed whitespace
2024-05-13 21:52:42 -07:00
Sam Lantinga
84fa11f740
Added missing events in SDL event logging
...
Also improved formatting for unknown events
2024-05-13 21:01:01 -07:00
Sam Lantinga
c64d7ed0aa
Fixed warning C4244: '=': conversion from 'SDL_Keymod' to 'Uint16', possible loss of data
2024-05-10 16:07:17 -07:00
Sam Lantinga
537c62f4c1
Fixed memory leak cleaning up mouse and keyboard instances
...
Fixes https://github.com/libsdl-org/SDL/issues/9487
2024-05-07 09:26:18 -07:00
Sam Lantinga
63979f04c8
Don't pass the sentinel event to event callbacks
...
This is just for internal use and we don't need to incur the overhead of calling callback and watchers for this event.
2024-05-03 09:00:41 -07:00
Sam Lantinga
e56f05bac1
Fixed unclipping the mouse when a monitor is placed left of the primary one on Windows.
...
There is now a desktop bounds variable that could potentially be exposed in the API if we wanted.
2024-04-24 12:06:00 -07:00
Frank Praznik
b41699e9c4
event: Always clear the mouse capture flag, even if the backend capture function isn't implemented.
...
Some backends, such as Wayland, don't support explicit mouse capture, and thus don't implement the backend function to do so, but do set/unset the capture flag on button events to handle cases where a button is pressed and the pointer is dragged outside the window.
If the backend doesn't support explicitly setting the mouse capture mode, manually clear the capture flag when the window has had the focus forcibly removed, to avoid sending bogus motion events as well as an assert condition.
2024-04-24 12:40:56 -04:00
Sam Lantinga
dc13c08375
Use single line comment format
2024-04-15 13:42:28 -07:00
Sam Lantinga
1862a62b5d
Replaced SDL_GetNumTouchFingers() and SDL_GetTouchFinger() with SDL_GetTouchFingers()
...
Fixes https://github.com/libsdl-org/SDL/issues/9484
2024-04-15 09:22:41 -10:00
Ryan C. Gordon
9f6f4dfcb9
events: Fixed crash in SDL_SetEventEnabled.
...
This could happen if `enabled` was non-zero but not set to SDL_TRUE.
Static analysis tried to warn us!!
The added SDL_assert is meant to sanity check this, not pacify the analyzer;
this passes Clang's static analysis now, with or without the assert.
Fixes #9544 .
2024-04-15 12:44:04 -04:00
Petar Popovic
c8a066019b
Renaming SDL_eventaction to SDL_EventAction
2024-04-08 14:28:52 -04:00
Petar Popovic
1efadcc5d4
Revert renaming SDL_eventaction. adding it again in next commit with
...
scripts
This reverts commit f08c31060a .
2024-04-08 14:28:52 -04:00
Petar Popovic
f08c31060a
Renaming SDL_eventaction to SDL_EventAction
2024-04-07 12:04:32 -04:00
Christoph Reichenbach
6d37f4798e
SDL_pen.c: release pen mutex on error return
2024-03-28 20:37:54 +00:00
Sam Lantinga
f1f24b173c
Added support for multiple distinct keyboards
2024-03-25 20:41:05 -07:00
Sam Lantinga
6443c75eda
Removed SDL_TEXTINPUTEVENT_TEXT_SIZE
2024-03-25 13:26:23 -07:00
Sam Lantinga
fa236f169b
Only do work to process text events if text input is active
...
Fixes https://github.com/libsdl-org/SDL/issues/9353
2024-03-25 13:26:23 -07:00
Anonymous Maarten
beb52ed54a
pen: remove stray '#include <stdio.h>'
2024-03-24 16:58:59 +01:00
Christoph Reichenbach
615c7efd98
Fix #9279 : Memory leak in pen name handling
...
- Fixes a leak in pen name allocation that would trigger
for both X11 and Wayland for some non-pen input devices
when new devices are added/removed.
- SDL_PenQuit() now deallocates and resets the table of known pens
- testautomation_pen.c now uses PenInit and PenQuit as setup and
teardown, respectively
testautomation_pen.c was already triggering the leak, and it is
visible with --trackmem, so no new tests are added.
2024-03-24 05:04:53 -07:00
Sam Lantinga
72fc6f86e5
Text input is no longer automatically enabled when initializing video.
...
Fixes https://github.com/libsdl-org/SDL/issues/9309
Fixes https://github.com/libsdl-org/SDL/issues/9268
2024-03-23 16:31:00 -07:00
Sam Lantinga
361b7190df
Track unique button states between different mice
...
We were already halfway doing this, but now we make that information available to the Windows driver so it can cache the button state per-mouse
2024-03-23 16:31:00 -07:00
Sam Lantinga
35756593d6
Use the correct device ID (global or default or specific) based on context
2024-03-23 16:31:00 -07:00
Sam Lantinga
c0f4565552
Added SDL_GetKeyboardName() and SDL_GetMouseName()
2024-03-23 16:31:00 -07:00
Sam Lantinga
d1eb4adb16
Be explicit about the event mouse and keyboard ID
2024-03-23 16:31:00 -07:00
Sam Lantinga
2fe1a6a279
Initial support for hotplugging mice and keyboards
2024-03-23 16:31:00 -07:00
Cameron Gutman
d3a785e521
Improve event processing latency when gamepad/sensor is open
...
By using the SDL_WaitEventTimeout_Device() path even when polling is required,
we can still achieve sub-millisecond latency for non-gamepad/sensor events when
a gamepad or sensor is in use by the application.
2024-03-18 21:52:42 -07:00
Anonymous Maarten
f59dbf6a12
cmake: add -Wimplicit-fallthrough warning
2024-03-18 20:34:50 +01:00
Sam Lantinga
efbbafb3f1
Re-added balls to the SDL joystick API
...
It turns out these were being used on Linux and at least one virtual driver was making use of them (thanks @mrfixit2001!)
2024-03-10 21:30:14 -07:00
Sam Lantinga
790cd395f5
Make sure the type in the SDL_Event aligns properly across the union
2024-03-07 06:58:43 -08:00
Sam Lantinga
33eaddc565
Cleaned up various type conversion issues
...
This makes sure SDL_PixelFormatEnum flows through the internal code correctly, as well as fixing a number of other minor issues.
2024-03-07 06:58:43 -08:00