Commit Graph

7091 Commits (549cedfa88cf93b69f8ffb4dd2c1ef097d3eb25c)

Author SHA1 Message Date
Anonymous Maarten efdc92802f Fix -Wunused-function warning when configuring with -DSDL_X11_XINPUT2=OFF 2023-02-19 09:59:12 -08:00
Anonymous Maarten 0e2866f846 Fix -Wunused-variable warning when configuring with -DSDL_X11_XRANDR=OFF 2023-02-19 09:59:12 -08:00
Anonymous Maarten cfadb4c106 Fix -Wunused-variable warning when configuring with -DSDL_X11_XSHAPE=OFF 2023-02-19 09:59:12 -08:00
Sam Lantinga ced02319a6 Fixed typo (thanks @Iniquitatis!) 2023-02-19 09:57:35 -08:00
Lauri Kasanen 0123d6311d Fix GetGlobalMouseState when xi2 is not available at runtime 2023-02-19 09:56:08 -08:00
Ozkan Sezer 964a877eb3 SDL_x11dyn.h: include XInput2.h also for Xfixes
Fixes https://github.com/libsdl-org/SDL/issues/7343
2023-02-11 23:51:28 +03:00
Anonymous Maarten 18f38bef03 Remove include/SDL3/SDL_name.h 2023-02-18 12:33:54 -08:00
Le Philousophe a67ae8eed5 Fix window size in X11 when window manager refuses to resize 2023-02-18 12:31:46 -08:00
Ozkan Sezer b5a7bd72df minor tidy-up. 2023-02-18 11:29:10 +03:00
Sylvain c88becc87a Fix kmsdrm build 2023-02-18 08:12:52 +01:00
Alexandros Koutroulis a2251d1093
SDL_SetWindowIcon now reports errors. (#7081) 2023-02-17 16:17:27 -08:00
Sam Lantinga eede2066fb Added other names for the DragonRise Inc. Wired Wheel (thanks @felimwhiteley!) 2023-02-17 11:29:27 -08:00
Frank Praznik 39e6d4a891 Set the window width and height when moving 2023-02-17 09:25:01 -05:00
Sam Lantinga 630c23ce17 You can move fullscreen desktop windows between displays using SDL_SetWindowPosition() 2023-02-16 17:28:56 -08:00
Sam Lantinga 64b88115ec SDL_SetWindowFullscreen() now takes a boolean value 2023-02-16 17:28:35 -08:00
Sam Lantinga 6c04c6f090 Fixed SDL_SetWindowSize() and SDL_SetWindowPosition()
The backend code expected window->x,y,w,h to be set when updating size and position
2023-02-16 16:59:15 -08:00
Sam Lantinga ece8a7bb8e Hold the joystick lock while opening the HID device on non-Android platforms
On Windows the main thread can be enumerating DirectInput devices while the Windows.Gaming.Input thread is calling back with a new controller available, and in this case HIDAPI_IsDevicePresent() returned false since the controller initialization hadn't completed yet, creating a duplicate controller.

Fixes https://github.com/libsdl-org/SDL/issues/7304
2023-02-16 09:50:04 -08:00
Sylvain 03e69fbc0c Fix potential de-referencing null pointer in SDL_EVDEV_kbd_keycode() 2023-02-16 08:22:37 +01:00
Sylvain b44d3699b1 Fixed most small problems reported by cppcheck for src/core PR #7307 (from @kevin2kevin2) 2023-02-16 08:22:37 +01:00
Sam Lantinga bcd97b36d2 Fixed Steam Runtime sandbox detection
Fixes hotplug issues on Steam Deck for Proton and native games
2023-02-15 13:53:57 -08:00
Frank Praznik 4187c6c08c video: Select the closest mode for the target refresh rate accounting for small variations
Use the delta of the target refresh rate and the refresh rate of the mode to select the closest matching display mode, as the actual closest mode may have a slightly lower rate than the target by a small fraction of a hz (e.g 59.98 vs 60.0).
2023-02-15 10:07:46 -05:00
Frank Praznik 3f5ef7dd42 video: Handle moving exclusive fullscreen windows between displays
Desktops can move windows, even exclusive fullscreen windows, from one display to another. To handle this, windows now hold two fullscreen modes: the desired mode, which is considered mutable only to the application, and the current mode. When a fullscreen request is made, the current mode is initially set to the desired mode for the initial fullscreen transition. If an exclusive fullscreen window is moved to a new display, the new display is checked to see if it has a mode compatible with the desired mode. If it does, the compatible mode is used so the windows will have the same properties on the new display. If no compatible mode is found, the window becomes desktop fullscreen. This occurs whenever the window is moved to ensure that an attempt will always be made to use the application's requested mode, if possible.

Exiting and reentering fullscreen results in the desired mode being restored on the display specified by it.
2023-02-15 10:07:46 -05:00
Sam Lantinga beb6a2afdc Map the Android MENU button back to the SDL MENU key
Thanks to @AntTheAlchemist for the investigation!

Fixes https://github.com/libsdl-org/SDL/issues/7318
2023-02-14 18:02:12 -08:00
Sam Lantinga 5925cd4ef3 Fixed handling simple mode PS4 reports
Fixes https://github.com/libsdl-org/SDL/issues/7270
2023-02-14 17:51:16 -08:00
Frank Praznik 9370f9ca85 wayland: Deduplicate calls to position fullscreen windows already on the correct output 2023-02-13 13:25:16 -05:00
Sylvain 93ed3148ba Fixed bug #7302 - Memory 'leak' in SDL_SetMouseSystemScale() 2023-02-13 09:42:12 +01:00
Sylvain eea4711110 gendynapi.py: add option to check doc formating (eg \param \returns \since) 2023-02-12 20:43:30 +01:00
Francisco Javier Trujillo Mata b728de788e Fixed audio 2023-02-11 13:23:08 -08:00
Frank Praznik 4a6f3cf47e x11: Set the window position when entering fullscreen
Set the window position when entering fullscreen as both real Xorg and XWayland need this in order for the window to be on the correct display.
2023-02-11 14:44:02 -05:00
Frank Praznik d6a19c8cc6 video: Use the explicit fullscreen display for a window unless the window was moved
When an exclusive fullscreen display is specified, it overrides any positioning, including from driver specific functions. Allows for the proper placement of fullscreen windows on macOS and Windows when the floating window is on a display that differs from the one specified by the exclusive fullscreen mode.

 A specific position-only function has been split out for use when a window has been moved.
2023-02-11 14:44:02 -05:00
Sam Lantinga 68e2f23066 Sorted controller list 2023-02-10 17:18:02 -08:00
Alfredo Escobar 76552e4780 Add Hori Pokken Tournament DX Pro Pad 2023-02-10 17:16:26 -08:00
Sam Lantinga e4face7c1d Fixed the share button on the ThrustMaster eSwap PRO Controller Xbox 2023-02-10 16:46:21 -08:00
Sam Lantinga b55bb02723 Constrain the mouse position before it's used to generate mouse deltas
Also clamp the mouse position to the maximum of *max and the last mouse position

Fixes https://github.com/libsdl-org/SDL/issues/7221#issuecomment-1426054481
2023-02-10 09:08:12 -08:00
Sylvain 7c4ec1867b Remove some vim config lines 2023-02-10 11:00:48 +01:00
Sylvain a2f3711c80 SDL_AndroidGetExternalStorageState(): return 0 on success, and fills *state with flags 2023-02-10 09:30:31 +01:00
Bruce Mitchener a8e89f2567 emscripten: Update deprecated calls to EM_ASM*.
`EM_ASM_` and `EM_ASM_INT_V` are calls that have been deprecated
for a long time.

Since the return value isn't used for the call to `EM_ASM_`, it
can be replaced with `EM_ASM`.

`EM_ASM_INT_V` is now (for the last few years) `EM_ASM_INT`.
2023-02-09 23:10:17 -08:00
Sam Lantinga b9773be3b3 Don't clamp mouse coordinates until they're fully outside the containing area
A window 1920x1080 pixels wide at 125% scaling will have a width and height of 1536x864, but at pixel (1919,1079) the mouse coordinate will be (1535.2,863.2), which is within the bounds of 1536x864, but larger than (1535,863).
2023-02-09 18:29:47 -08:00
Sam Lantinga 5b77ad54c4 Fixed order and constness of parameters to SDL_ConvertAudioSamples() 2023-02-09 17:49:35 -08:00
Sam Lantinga e65e2c8ed7 SDL_CloseJoystick() should return void, not int 2023-02-09 17:26:16 -08:00
Sam Lantinga a9650d440a Fixed MFI controller being opened while HIDAPI controller was being opened
This was the callstack:
    frame #3: 0x00000001004e1930 libSDL3.1.0.0.dylib`IOS_AddJoystickDevice(controller=0x0000600003b0c000, accelerometer=SDL_FALSE) at SDL_mfijoystick.m:528:14
    frame #4: 0x00000001004e1a54 libSDL3.1.0.0.dylib`__IOS_JoystickInit_block_invoke(.block_descriptor=0x0000000100547760, note=@"GCControllerDidConnectNotification") at SDL_mfijoystick.m:673:45
    frame #5: 0x000000018601e578 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 128
    frame #6: 0x00000001860bc074 CoreFoundation`___CFXRegistrationPost_block_invoke + 88
    frame #7: 0x00000001860bbfbc CoreFoundation`_CFXRegistrationPost + 440
    frame #8: 0x0000000185fefbac CoreFoundation`_CFXNotificationPost + 708
    frame #9: 0x0000000186edc72c Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 88
    frame #10: 0x000000019b054a18 GameController`__60-[_GCControllerManagerAppClient _onqueue_publishController:]_block_invoke + 156
    frame #11: 0x0000000185dc19dc libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #12: 0x0000000185dc3504 libdispatch.dylib`_dispatch_client_callout + 20
    frame #13: 0x0000000185dd1d1c libdispatch.dylib`_dispatch_main_queue_drain + 928
    frame #14: 0x0000000185dd196c libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #15: 0x000000018606ad6c CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #16: 0x00000001860287ec CoreFoundation`__CFRunLoopRun + 2036
    frame #17: 0x00000001860278a4 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #18: 0x00000001003b1194 libSDL3.1.0.0.dylib`process_pending_events at hid.c:509:9
    frame #19: 0x00000001003aebe8 libSDL3.1.0.0.dylib`PLATFORM_hid_open_path(path="USB_054c_05c4_0x11a104290", bExclusive=0) at hid.c:823:2
    frame #20: 0x00000001003b051c libSDL3.1.0.0.dylib`SDL_hid_open_path_REAL(path="USB_054c_05c4_0x11a104290", bExclusive=0) at SDL_hidapi.c:1419:19
    frame #21: 0x00000001004dabdc libSDL3.1.0.0.dylib`HIDAPI_SetupDeviceDriver(device=0x0000600003518000, removed=0x000000016fdfee3c) at SDL_hidapijoystick.c:399:19
    frame #22: 0x00000001004da890 libSDL3.1.0.0.dylib`HIDAPI_AddDevice(info=0x000060000212c2d0, num_children=0, children=0x0000000000000000) at SDL_hidapijoystick.c:843:5
    frame #23: 0x00000001004d9148 libSDL3.1.0.0.dylib`HIDAPI_UpdateDeviceList at SDL_hidapijoystick.c:1000:21
    frame #24: 0x00000001004d9940 libSDL3.1.0.0.dylib`HIDAPI_JoystickDetect at SDL_hidapijoystick.c:1205:13
    frame #25: 0x00000001003bc6d8 libSDL3.1.0.0.dylib`SDL_UpdateJoysticks_REAL at SDL_joystick.c:1703:9
    frame #26: 0x00000001003a13a8 libSDL3.1.0.0.dylib`SDL_PumpEventsInternal(push_sentinel=SDL_FALSE) at SDL_events.c:855:9
    frame #27: 0x00000001003a1340 libSDL3.1.0.0.dylib`SDL_PumpEvents_REAL at SDL_events.c:879:5
    frame #28: 0x000000010038b380 libSDL3.1.0.0.dylib`SDL_PumpEvents at SDL_dynapi_procs.h:572:1
    frame #29: 0x0000000100004524 testgamepad`loop + 40
    frame #30: 0x00000001000063d8 testgamepad`main + 2140
2023-02-09 12:07:11 -08:00
Ozkan Sezer ae91dcbcf4 fix dynapi after commit dc74a67a 2023-02-09 22:50:00 +03:00
Sylvain dc74a67a57 SDL_UnlockTexture: change from 'int' to 'void' 2023-02-09 20:17:27 +01:00
Sylvain cee245b6a9 SDL_*SceenSaver(): change return value to int. // add SDL_Unsupported() errors 2023-02-09 08:16:46 -08:00
Sylvain e2e5e670bf Remove returns int from Destroy/Close/Unlock functions 2023-02-09 07:57:14 -08:00
Linus Probert 3bd737d44c Add error returns to void functions that can fail/set errors.
This takes care of the last set of void functions that could
potentially be shifted to instead return an int indicating success and
setting an error in case of an error.
2023-02-09 07:23:21 -08:00
Sylvain b305d9e3c0 Change return type from void to int for audio function. Eventually set invalid parameter error. 2023-02-08 17:43:44 -08:00
Sam Lantinga 824b9b0a58 Removed SDL_GetDisplayDPI()
This function wasn't consistently correct across platforms and devices.

If you want the UI scale factor, you can use display_scale in the structure returned by SDL_GetDesktopDisplayMode(). If you need an approximate DPI, you can multiply this value times 160 on iPhone and Android, and 96 on other platforms.
2023-02-08 17:35:54 -08:00
Sam Lantinga b7c6fec10a Make sure we synchronously re-enable USB reporting mode for Switch controllers (thanks @SortaCore!)
Fixes https://github.com/libsdl-org/SDL/issues/3450
2023-02-08 14:22:39 -08:00
Sam Lantinga 50575ed223 Note the Google Stadia controller doesn't support rumble over Bluetooth 2023-02-08 14:16:24 -08:00