Commit Graph

8090 Commits

Author SHA1 Message Date
Sylvain 76f9fb96d9 Use RenderGeometry to implement RenderCopy and RenderCopyEx at higher level 2021-10-24 22:27:56 -04:00
Ryan C. Gordon 08797adaef opengles2: Attempt to batch RenderCopy calls into a single glDrawArrays call. 2021-10-24 22:27:56 -04:00
Tanuj Bagaria 1f0eb03a76
Fix PS5 mapping with HID-PLAYSTATION driver (#4675)
* add missing PS5 Linux GUID for Bluetooth

* Fix PS5 Mapping to work with HID-Playstation driver
2021-10-24 17:54:26 -05:00
Cameron Gutman f499168c2c x11: Use SDL_IOReady() instead of calling select() directly
SDL_IOReady() properly handles EINTR and can use poll() if available.
2021-10-24 15:54:57 -05:00
Alex Szpakowski ba4ef461ea macOS: Fix implicit integer downcast warnings 2021-10-23 17:45:27 -04:00
Ryan C. Gordon d9d8f51eec
wikiheaders.pl: Add support for deprecated functions. 2021-10-23 14:41:23 -04:00
Ryan C. Gordon dbe55350ce
include: Improve doxygen text on SDL_GetRevisionNumber(). 2021-10-23 14:41:22 -04:00
David Gow a76b73dd2c kmsdrm: Use SDL_PremultiplySurfaceAlphaToARGB8888() for cursor surface
Instead of taking a direct copy of the mouse cursor surface, and then
premultiplying on every BO upload (using the custom
legacy_alpha_premultiply_ARGB8888 function), use the new
SDL_PremultiplySurfaceAlphaToARGB8888() function, which converts a whole
surface at a time, once and save the result.

The already-premultiplied data is then copied from that to the BO on
each upload, adjusting for the stride (which the previous implementation
required to be equal to the width), thereby making the extra copy
slightly useful..

This also adds support for non-SDL_PIXELFORMAT_ARGB8888 surfaces.
2021-10-22 05:50:00 -07:00
David Gow b528d48446 wayland: Wayland cursors should use premultiplied alpha
It turns out that Wayland's WL_SHM_FORMAT_ARGB8888 format (and, indeed,
all wayland RGBA formats) should be treated as premultiplied. SDL
surfaces tend not to be premultiplied, and this is assumed by other
backends when dealing with cursors.

This change premultiplies the cursor surface in Wayland_CreateCursor()
using the new SDL_PremultiplySurfaceAlphaToARGB8888(). In so doing, it
also adds support for a wider range of input surfaces, including those
with non-ARGB8888 pixel formats, and those which don't have
pitch==width.

This should fix #4856
2021-10-22 05:50:00 -07:00
David Gow 84808ea4bb video: Add SDL_PremultiplySurfaceAlphaToARGB8888()
A number of video backends need to get ARGB8888 formatted surfaces with
premultiplied alpha, typically for mouse cursors. Add a new function to
do this, based loosely on legacy_alpha_premultiply_ARGB8888() from the
KMSDRM backend.

The new function, SDL_PremultiplySurfaceAlphaToARGB8888() takes two
arguments:
- src: an SDL_Surface to be converted.
- dst: a buffer which is filled with premultiplied ARGB8888 data of the
  same size as the surface (assuming pitch = w).

This is not heavily optimised: it just repeatedly calls SDL_GetRGBA() to
do the conversion, but should do for now.
2021-10-22 05:50:00 -07:00
uyjulian 007b5463e8 video/uikit: Do not use setNeedsUpdateOfPrefersPointerLocked on iOS SDKs older than 14 2021-10-21 21:21:57 -07:00
Sam Lantinga 8f58bb9cf8 Added SDL_USE_BUILTIN_OPENGL_DEFINITIONS to avoid system OpenGL headers 2021-10-21 20:48:08 -07:00
Sam Lantinga b360965d0d Added a hint for alternate OpenGL NV12 data format 2021-10-21 20:48:05 -07:00
SDL Wiki Bot 6c134cf148 Sync wiki -> header 2021-10-22 00:39:04 +00:00
Cacodemon345 19dee1cd16
Add SDL_GetWindowICCProfile(). (#4314)
* Add SDL_GetWindowICCProfile

* Add new SDL display events

* Implement ICC profile change event for macOS

* Implement ICC profile notification for Windows

* Fix SDL_GetWindowICCProfile() for X11

* Fix compile errors
2021-10-21 17:37:20 -07:00
Sam Lantinga a34fe8161f Added the ability to bind NV12 textures in the OpenGL renderer 2021-10-21 12:28:35 -07:00
Sam Lantinga f3fd1ffb99 Fixed crash if SDL API functions are called on a disconnected controller on iOS 2021-10-20 15:18:03 -07:00
Sam Lantinga a43d3f6931 Don't detect the ROG Chakram mouse as a joystick 2021-10-20 15:19:22 -07:00
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