Commit Graph

19813 Commits

Author SHA1 Message Date
Frank Praznik
c6362b4788 tests: Revert some leftover testing code 2025-05-05 11:08:15 -04:00
Frank Praznik
c91f9f6968 x11: #ifdef the XRandR path in the message box code
The runtime check isn't sufficient as the functions are undefined if built without XRandR.
2025-05-05 10:45:54 -04:00
A. Wilcox
7490471796 cpuinfo: Use auxv for AltiVec on Linux if possible
The SIGILL handler is not very reliable and can cause crashes.

Linux provides the CPU's AltiVec support status in getauxval.
2025-05-04 13:52:21 -07:00
Ozkan Sezer
17bba029ba don't prototype strdup() for __clang_analyzer__ case in windows builds.
Fixes:  https://github.com/libsdl-org/SDL/issues/12948.
2025-05-04 10:35:31 -07:00
Katharine Chui
15c6acf74f capture g27 shifter r input
ref: d97f782315/pico_lgff_wheel_adapter/reports.h (L265-L310)
2025-05-03 08:10:41 -07:00
Ryan C. Gordon
795d1ae1fb testmessage: Don't push the event if "Retry" was chosen.
Otherwise, the message box thread goes back to blocking, but the app's main
thread progresses to SDL_WaitThread and won't pump the event queue anymore.

On iOS, this means the messagebox won't pop back up (because it uses
SDL_RunOnMainThread, which needs the event loop to pump), but it's just bad
practice on any platform to stop pumping the event queue for indefinite
lengths of time.
2025-05-02 21:42:47 -04:00
Frank Praznik
d73fe0bc53 win32: Hide the borders when showing a fullscreen window
If it is known that the window will immediately enter fullscreen upon being shown, set the borderless style when showing the window to hide the borders, or they may linger in the background if the client takes some time to draw the first frame.

Unnecessarily calling ShowWindow with SW_RESTORE when applying the window flags must be suppressed in this case, or the borders can reappear in a weird, partial state.
2025-05-02 14:21:36 -04:00
Sam Lantinga
ab12b7cbba Added support for the share button on the GameSir-K1 FLUX controller 2025-05-02 10:15:16 -07:00
Sam Lantinga
1e6a25324c Added support for the PowerA Battle Dragon Advanced Wireless Controller 2025-05-02 10:01:13 -07:00
Ryan C. Gordon
57346f2ba8 dialog: Cocoa backend should reactivate the app after the modal dialog.
Otherwise the window won't have focus until you click on it again. Calling
makeKeyAndOrderFront isn't enough to fix it, either.

This trick comes from a similar problem we solve in our
applicationDidFinishLaunching implementation: activate (give app focus to) the
system Dock, as something that definitely exists that isn't us and is harmless
to activate, and then activate us right afterwards. This unconfuses whatever
is getting confused inside Cocoa.

Fixes #12684.
2025-05-02 01:52:42 -04:00
Sam Lantinga
caf269ce00 Added a link to the GIP documentation 2025-05-01 21:35:10 -07:00
Sam Lantinga
34c045aa39 Fixed paddles on the Xbox Elite controller using the GIP driver 2025-05-01 21:35:10 -07:00
Cameron Gutman
0447c2f3c3 events: Add integer wheel fields for sdl2-compat
It's way simpler to just add them back to SDL3 than emulate them purely in sdl2-compat.
2025-05-01 22:50:52 -05:00
Sam Lantinga
ae251a05be Fixed warning: no previous prototype for function 'GIP_ParseMetadata' 2025-05-01 15:39:49 -07:00
Ryan C. Gordon
193b0c8963 uikit: Use SDL_RunOnMainThread instead of dispatch_sync for message boxes.
Reference Issue #12741.
2025-05-01 18:28:53 -04:00
Ryan C. Gordon
691cc5bb5e dialog: Cocoa shouldn't crash if there's a '.' in the filters.
So something like "index.pb" will now accept any file with a ".pb" extension,
to make macOS happy. This seems like a reasonable tradeoff.

Other minor cleanups.

Fixes #12778.
2025-05-01 18:11:36 -04:00
Temdog007
4ef8b6ce1b X11: Center Message Box on Multi Monitor Displays (#12819)
Use XRandr to find the position of the current screen to center the message box on that window
2025-05-01 13:38:52 -07:00
Frank Praznik
c5d5967c3a video: Store the preferred fullscreen display in a property for sdl2-compat
sdl2-compat will call SDL_GetDisplayForWindow() when querying the display to use for fullscreen, which won't always be correct if the backend can't actually reposition the window. When calling this function, get the ideal fullscreen display and store it in a property for retrieval by sdl2-compat.
2025-05-01 11:24:34 -07:00
SDL Wiki Bot
11e1d4a145 Sync SDL3 wiki -> header
[ci skip]
2025-05-01 18:05:25 +00:00
Vicki Pfau
00f3a82ada Joystick: Add new GIP driver to replace old Xbox One wired driver
This new driver is based on official documentation released by Microsoft in
September, though it still lacks several important features, notably the
Security handshake for wireless dongles and audio support. It is, however, more
reliable and extensible than the old driver.
2025-05-01 11:04:33 -07:00
Sam Lantinga
48dfc03a87 Added the gamepad hint SDL_GAMECONTROLLER_USE_GAMECUBE_LABELS
This is for internal use to signal that a mapping uses positional GameCube buttons. It's set so we know whether a mapping uses the older style labeled buttons or the newer style positional buttons. If a positional mapping is used with SDL2, then it will be ignored, since the hint is marked as defaulting true and the mapping conditional is that the hint is false.
2025-05-01 10:54:16 -07:00
Sam Lantinga
21a7bbbf14 Restore compatibility with older GameCube mappings
Restore the original button values for GameCube controllers, but swap labeled mappings to positional while loading mappings

Fixes https://github.com/libsdl-org/SDL/issues/12847
2025-05-01 10:54:16 -07:00
Dimitriy Ryazantcev
3730128e33 Simplify WIN_CreateHCursor (#12933) 2025-05-01 08:32:12 -07:00
Frank Praznik
6a0505c090 wayland: Remove unnecessary function call 2025-05-01 11:30:16 -04:00
Frank Praznik
fdd8b5d630 wayland: Query the mouse global button states from the seats
Mouse button events that trigger a hit test are not passed to the client, but the client may still query the global mouse button state from within the hit test handler, so the reported buttons need to be accurate. Query the buttons directly from the seat instead of the higher global mouse state to match the behavior of other platforms.
2025-05-01 11:26:32 -04:00
Sam Lantinga
e3df61b070 Fixed right mouse button emulation when using a pen
Pen button 1 is typically used as right click. Pen button 2 (Wacom eraser) doesn't have a specific mapping, but we'll use middle click for now.
2025-04-30 11:07:31 -07:00
Sam Lantinga
106ccc722e Fixed missing simulated mouse events using a Wacom tablet
The low 16-bits of the message extra info is an event sequence number when using the Wacom tablet with Windows Ink disabled. The high bits of normal mouse motion when using touch input match the touch signature, 0xFF515700. The high bits of raw input mouse motion when using touch input do not match that signature, so we have to check for the touch bit in that case.

Fixes https://github.com/libsdl-org/SDL/issues/12927
2025-04-30 11:07:31 -07:00
Sam Lantinga
8ae962c904 Fixed build 2025-04-29 19:06:42 -07:00
Sam Lantinga
e04064350f Fixed right click mouse emulation for the Wacom tablet
The problems are two-fold. When this happens a WM_POINTERDOWN event is sent with IS_POINTER_INCONTACT_WPARAM() evaluating as true. So when SDL_SendPenButton() is sent for the barrel button, there is no pen in contact yet, so the right mouse button is sent. Then SDL_SendPenTouch() is sent, which generates a left button press event.

Fixes https://github.com/libsdl-org/SDL/issues/12926
2025-04-29 19:03:42 -07:00
Evan Hemsley
a163257295 GPU: Validate that textures are not bound for both read and write on render passes (#12925) 2025-04-29 16:52:52 -07:00
Ryan C. Gordon
ea67133e4f pen: Windows can't check WM_POINTER[DOWN|UP] for touches directly.
These events fire for other things, such as pressing a barrel button while
the pen is hovering.

The correct thing to do is check IS_POINTER_INCONTACT_WPARAM in the event.

If the pen is already touching or not, SDL_SendPenTouch() will do the right
thing, so it's safe to call it even if we're already in the right state.
2025-04-29 18:53:38 -04:00
SDL Wiki Bot
f131791005 Sync SDL3 wiki -> header
[ci skip]
2025-04-29 22:48:45 +00:00
Evan Hemsley
e1a41c1c97 GPU Vulkan: Add locks for layout object lookups (#12924) 2025-04-29 15:43:28 -07:00
SDL Wiki Bot
fd5380ffc6 Sync SDL3 wiki -> header
[ci skip]
2025-04-29 16:04:31 +00:00
Frank Praznik
b871ac0d97 Add support for non-constrained and non-grabbing popups
By default, popups are automatically constrained to be completely within display bounds, so as not to cut off information and result in an unusable menu, or unreadable tooltip. In some cases, however, this is not wanted, so a property to toggle this behavior is added.

There are also cases where the client may not want a popup menu to implicitly grab the keyboard focus, as is the default behavior, so popup menus now respect the focusable flag/property, as well as being able to toggle focus grabbing via SDL_SetWindowFocusable().
2025-04-29 12:02:14 -04:00
Sam Lantinga
8abcc27535 Removed timeout in SDL_RunOnMainThread()
Fixes https://github.com/libsdl-org/SDL/issues/12923
2025-04-29 08:56:56 -07:00
Sam Lantinga
ef54c3bf18 Always enable D3D12 GPU on Windows
This isn't dependent on the render subsystem

Fixes https://github.com/libsdl-org/SDL/issues/12922
2025-04-29 08:51:26 -07:00
Cameron Gutman
39d3148185 events: Fix undefined behavior when disabling some event types
Shifting a signed int left by 31 is UB.
2025-04-29 00:10:33 -05:00
expikr
510c7edd9b migrate usage of SetCursor(NULL) to RedrawCursor() 2025-04-28 09:41:44 -07:00
expikr
4779499048 Split the redraw effect to own function 2025-04-28 09:41:44 -07:00
expikr
6c172e5220 SDL_SetCursor should not skip focus check 2025-04-28 09:41:44 -07:00
Maia
cbf44700d8 bytepusher example: always render text to render target and remove unused variable 2025-04-28 09:40:07 -07:00
SDL Wiki Bot
faddff1bcc Sync SDL3 wiki -> header
[ci skip]
2025-04-27 18:02:41 +00:00
Sam Lantinga
31650d566c Added SDL_GAMEPAD_TYPE_GAMECUBE
The GameCube controller has a different face button layout than the Xbox or Nintendo Switch style controllers. It has the B button on the left and the X button on the right, so we should map those to SDL_GAMEPAD_BUTTON_WEST with SDL_GAMEPAD_BUTTON_LABEL_B and SDL_GAMEPAD_BUTTON_EAST with SDL_GAMEPAD_BUTTON_LABEL_X respectively.

Fixes https://github.com/libsdl-org/SDL/issues/12847
2025-04-27 11:01:50 -07:00
expikr
c4d5cc358f streamline boolean logic 2025-04-27 10:25:43 -07:00
expikr
441e7e488f invert cursor_visible to hide_cursor 2025-04-27 10:25:43 -07:00
expikr
d553372682 rename cursor_shown to cursor_visible 2025-04-27 10:25:43 -07:00
Ozkan Sezer
016ba86f93 tray, unix: make pointers g_object_ref and g_object_ref_sink static
Fixes:  https://github.com/libsdl-org/SDL/issues/12908.
2025-04-27 11:34:40 -04:00
Frank Praznik
6f5892e543 cocoa: Immediately update the mouse focus when showing/hiding a popup menu
When showing or hiding a popup menu, manually check and set the focus if the new topmost window under the cursor is an SDL window. Otherwise, the focus won't be updated until the cursor is actually moved.
2025-04-27 09:38:52 -04:00
Frank Praznik
8c733d1f7b x11: Better handle XInput2 mouse tracking outside the window
There is a quirk with XInput2 mouse capture that causes a leave event to be sent if the pointer moves out->in->out, which breaks mouse tracking outside the window. If the mouse leaves the window with buttons pressed, continue tracking it until the buttons are released.
2025-04-26 11:20:37 -04:00