src/video


Log

Author Commit Date CI Message
Sam Lantinga 942973dd 2021-11-28T09:27:28 Use mouse ID 0 for raw mouse events We don't track state for each mouse individually, so we should just use the global mouse ID for all events. Fixes https://github.com/libsdl-org/SDL/issues/5026
Sam Lantinga 11a9cd63 2021-11-27T08:14:50 Fixed building SDL on UWP
Sam Lantinga 4e5839a5 2021-11-26T13:45:08 Fixed compiling for Raspberry Pi
Sam Lantinga 57366285 2021-11-23T20:14:18 Only send display events for hotplugged displays, not the initial state
Sylvain 381f99a3 2021-11-23T10:58:04 Fix warnings: re-add enum forward declaration
Sylvain dd6817b3 2021-11-23T10:47:34 Fix warnings: static function, {} initializier, un-needed enum forward declaration
Sylvain fae70349 2021-11-23T10:33:12 Fix warnings: static, include, un-initialized vairables
Sylvain 9c72adc8 2021-11-23T09:41:01 More "Integer overflow generates Illegal instruction under sanitizers" (see bug #4995)
Sylvain 8dd6edec 2021-11-23T09:30:42 Fixed bug #3232 - Integer overflow generates Illegal instruction under sanitizers + see bug #4995
Sylvain 0445c13a 2021-11-22T16:49:17 Remove 'malloc' from comment
Sylvain c3633d2c 2021-11-22T16:44:48 Haiku: use SDL_malloc
Sylvain 79b37cc5 2021-11-22T16:43:49 Pandora: use SDL_malloc
Sylvain 10ffcbb1 2021-11-22T16:41:45 QNX: use SDL_malloc
Sylvain 9fcc630f 2021-11-22T16:37:34 X11: use SDL_malloc
Sylvain 19bf36db 2021-11-22T16:37:19 DirectFB: use SDL_malloc
Sylvain 5a7a7ba5 2021-11-22T11:25:59 Don't use "realloc" in comment so that it doesn't show up
Sylvain b4aeaa30 2021-11-22T11:20:52 Use SDL_calloc / SDL_free
Sylvain cb9f85e8 2021-11-22T11:18:01 Don't use "round", so that it's doesn't show up while searching for the function
Sylvain d31251b0 2021-11-21T22:30:48 use SDL's functions version inplace of libc version
Sylvain c878d9a0 2021-11-22T17:06:41 Haiku: comment this should not be SDL_free()
Sam Lantinga c97b7218 2021-11-21T12:18:10 Added SDL_PremultiplyAlpha() to premultiply alpha on a block of SDL_PIXELFORMAT_ARGB8888 pixels
Ryan C. Gordon ceb9e9a8 2021-11-21T00:21:41 cocoa: Removed a debug printf call.
Ryan C. Gordon 18715acb 2021-11-21T00:14:18 cocoa: Position non-left mouse button events in background windows correctly. Fixes #4828.
Ryan C. Gordon 23b7bdef 2021-11-20T14:11:30 offscreen: Don't fail to create a window because of driver_loaded politics. Fixes #4922.
Sam Lantinga 665865ed 2021-11-19T09:58:13 If the hardware is in an error state, the final page flip may not come. We should either put a timeout on the wait when destroying the window, or skip it entirely.
Ethan Lee a7a54e64 2021-11-18T00:43:55 wayland: Add support for display connect/disconnect events
Ethan Lee 5cc23868 2021-11-15T11:52:43 wayland: Add support for SDL_DisplayOrientation
Sam Lantinga cc094f4d 2021-11-14T20:15:48 Fixed building with the macOS 10.8 SDK
Zack Middleton 1cd3e837 2021-11-14T15:51:38 cocoa: Fix abort on touch event types without a subtype macOS 10.6 has some touch NSEvents which do not have a subtype (Begin/EndGesture, Magnify, Rotate, Swipe) and cause an uncaught exception which triggers SIGABRT and the program exits. As it is, none of the macOS 10.6 touch events are detected as a trackpad (including Gesture due to using different subtypes).
Ozkan Sezer 781caec2 2021-11-15T00:55:24 SDL_waylandevents.c (keyboard_handle_keymap): silenced -Wwrite-strings .
Ozkan Sezer 8a6e48d4 2021-11-14T04:40:50 constified SDL_RegisterApp()
Ozkan Sezer 7dfd22ac 2021-11-14T02:32:00 fix XGetDefault signature - its first and second params are _Xconst
Cameron Gutman 674f361d 2021-11-13T11:44:04 wayland: Fix memory leaks in clipboard code
Cameron Gutman eb3f1462 2021-11-12T18:26:15 x11: Fix memory leak in X11_CreatePixmapCursor()
Ozkan Sezer 3dc7813a 2021-11-12T20:47:02 more whitespace tidy-ups in SDL_os2messagebox.c
Sam Lantinga c2dd50a9 2021-11-12T08:28:02 Fixed whitespace
Sam Lantinga 074e613b 2021-11-12T03:03:56 Fixed typo
Sam Lantinga 35d90f17 2021-11-12T03:00:57 Better implementation of SDL_SetWindowMouseGrab() and SDL_SetWindowMouseRect() on macOS
Misa 3bf7994f 2021-09-27T14:38:12 Add and use `SDL_FALLTHROUGH` for fallthroughs Case fallthrough warnings can be suppressed using the __fallthrough__ compiler attribute. Unfortunately, not all compilers have this attribute, or even have __has_attribute to check if they have the __fallthrough__ attribute. [[fallthrough]] is also available in C++17 and the next C2x, but not everyone uses C++17 or C2x. So define the SDL_FALLTHROUGH macro to deal with those problems - if we are using C++17 or C2x, it expands to [[fallthrough]]; else if the compiler has __has_attribute and has the __fallthrough__ attribute, then it expands to __attribute__((__fallthrough__)); else it expands to an empty statement, with a /* fallthrough */ comment (it's a do {} while (0) statement, because users of this macro need to use a semicolon, because [[fallthrough]] and __attribute__((__fallthrough__)) require a semicolon). Clang before Clang 10 and GCC before GCC 7 have problems with using __attribute__ as a sole statement and warn about a "declaration not declaring anything", so fall back to using the /* fallthrough */ comment if we are using those older compiler versions. Applications using SDL are also free to use this macro (because it is defined in begin_code.h). All existing /* fallthrough */ comments have been replaced with this macro. Some of them were unnecessary because they were the last case in a switch; using SDL_FALLTHROUGH in those cases would result in a compile error on compilers that support __fallthrough__, for having a __attribute__((__fallthrough__)) statement that didn't immediately precede a case label.
Sam Lantinga abc12a83 2021-11-11T15:58:44 Revert "Add and use `SDL_FALLTHROUGH` for fallthroughs" This reverts commit 66a08aa3914a98667f212e79b4f0b9453203d656. This causes problems with older compilers: https://github.com/libsdl-org/SDL/pull/4791#issuecomment-966630997
Ethan Lee 63ae103c 2021-11-11T13:16:34 wayland: QTWAYLAND_CONTENT_ORIENTATION can support multiple values as bitmasks
Sam Lantinga 11ae43ca 2021-11-11T07:49:38 Only lock the pointer for mouse relative mode, there isn't really a concept of grab and confinement on iOS Locking the pointer prevents the on-screen cursor from moving, which isn't what we want with a grab behavior. Fixes https://github.com/libsdl-org/SDL/issues/4941
Misa 66a08aa3 2021-09-27T14:38:12 Add and use `SDL_FALLTHROUGH` for fallthroughs Case fallthrough warnings can be suppressed using the __fallthrough__ compiler attribute. Unfortunately, not all compilers have this attribute, or even have __has_attribute to check if they have the __fallthrough__ attribute. [[fallthrough]] is also available in C++17 and the next C2x, but not everyone uses C++17 or C2x. So define the SDL_FALLTHROUGH macro to deal with those problems - if we are using C++17 or C2x, it expands to [[fallthrough]]; else if the compiler has __has_attribute and has the __fallthrough__ attribute, then it expands to __attribute__((__fallthrough__)); else it expands to an empty statement, with a /* fallthrough */ comment (it's a do {} while (0) statement, because users of this macro need to use a semicolon, because [[fallthrough]] and __attribute__((__fallthrough__)) require a semicolon). Applications using SDL are also free to use this macro (because it is defined in begin_code.h). All existing /* fallthrough */ comments have been replaced with this macro. Some of them were unnecessary because they were the last case in a switch; using SDL_FALLTHROUGH in those cases would result in a compile error on compilers that support __fallthrough__, for having a __attribute__((__fallthrough__)) statement that didn't immediately precede a case label.
Sam Lantinga eda4c407 2021-11-10T12:46:54 Make sure the X event is an Xkb event before checking the Xkb event type
Sam Lantinga 98c98362 2021-11-10T11:04:51 Don't clobber the error in SDL_ShowMessageBox() if one has been set at the platform level Fixes https://github.com/libsdl-org/SDL/issues/4760
Sam Lantinga 6c4b4ee7 2021-11-10T09:41:43 Don't assert on API parameters This causes lots of spam in test automation and it's not clear it's useful to developers. If we need this level of validation, we should add a log category for it.
Sam Lantinga fed85778 2021-11-10T08:47:39 Update the orientation and display modes when the display settings change on Windows Fixes https://github.com/libsdl-org/SDL/issues/1061
Sam Lantinga c0f1109b 2021-11-10T06:03:01 Implemented querying the orientation of displays on Windows
Sam Lantinga 27ce9144 2021-11-09T20:51:42 Send absolute mouse motion when in normal mouse mode and relative mouse motion when in relative mode on iOS This keeps the SDL cursor in sync with the visible cursor when in normal mouse mode.
Sam Lantinga 19c129fa 2021-11-09T20:32:16 Added documentation that the UIApplicationSupportsIndirectInputEvents key must be set to true in your application's Info.plist in order to get real Bluetooth mouse events.
Sam Lantinga d2f75636 2021-11-09T11:53:59 When making the window centered it should use windowed mode size since it doesn't affect fullscreen windows Fixes bug https://github.com/libsdl-org/SDL/issues/4750
Susko3 1fc25bd8 2021-11-08T22:04:34 Properly position the IME window(s) on windows
Ethan Lee ae67c7d2 2021-11-09T01:30:00 Implemented SDL_SetWindowMouseRect() on Wayland
Sam Lantinga 18e69827 2021-11-08T22:29:02 Fixed Linux build
Yufei Huang 881f747d 2021-11-09T13:35:18 Always destroy icon
Yufei Huang 7fea557b 2021-11-09T12:03:09 SDL_windowsmouse.c: Remove LR_COPYDELETEORG flag
Sam Lantinga 67c42cb4 2021-11-08T22:16:01 Fixed Windows build
Sam Lantinga fd79607e 2021-11-08T21:34:48 Added SDL_GetWindowMouseRect() Also guarantee that we won't get mouse movement outside the confining area, even if the OS implementation allows it (e.g. macOS)
Sam Lantinga 4db546b0 2021-11-08T20:35:12 Implemented SDL_SetWindowMouseRect() on macOS
Cameron Gutman 9c95c249 2021-11-08T20:01:56 x11: Use XCheckIfEvent() instead of XNextEvent() for thread-safety A racing reader could read from our fd between SDL_IOReady()/X11_Pending() and our call to XNextEvent() which will cause XNextEvent() to block for more data. Avoid this by using XCheckIfEvent() which will never block. This also fixes a bug where we could poll() for data, even when events were already read and pending in the queue. Unlike the Wayland implementation, this isn't totally thread-safe because nothing prevents a racing reader from reading events into the queue between our XCheckIfEvent() and SDL_IOReady() calls, but I think this is the best we can do with Xlib.
Sam Lantinga 2d23d66a 2021-11-08T16:33:50 Fixed SetWindowMouseRect return value on Windows
Sam Lantinga 7d21322d 2021-11-08T16:29:19 Implemented SDL_SetWindowMouseRect() on Windows
Ethan Lee 4b42c05b 2021-11-08T13:52:48 video: Add SDL_SetWindowMouseRect. This API and implementation comes from the Unreal Engine branch of SDL, which originally called this "SDL_ConfineCursor". Some minor cleanup and changes for consistency with the rest of SDL_video, but there are two major changes: 1. The coordinate system has been changed so that `rect` is _window_ relative and not _screen_ relative, making it easier to implement without having global access to the display. 2. The UE version unset all rects when passing `NULL` as a parameter for `window`, this has been removed as it was an unused feature anyhow. Currently this is only implemented for X, but can be supported on Wayland and Windows at minimum too.
Sam Lantinga d95a52c9 2021-11-08T09:39:21 Fixed comment typo
Ethan Lee fc998b8e 2021-11-08T12:37:10 wayland: Return true for HasScreenKeyboardSupport only if no physical keyboard exists
Sam Lantinga 6c56e275 2021-11-08T07:05:17 Set both _NET_WM_NAME and WM_NAME so SDL windows can be shared in the browser. Fixes https://github.com/libsdl-org/SDL/issues/4924
Yufei Huang 301819cd 2021-11-08T20:34:20 SDL_windowsmouse.c: Fix WIN_CreateCursor does not scale with system cursor size preference
Thomas Ballinger 94c1276a 2021-11-07T20:49:32 emscripten: Decrease vertical scroll speed by using deltaMode Reference issue #4623.
Sam Lantinga 2248a549 2021-11-05T22:48:46 Update the focus in case we changed focus to a child window and then away from the application In this case we'll get WM_KILLFOCUS when the child window is focused, but we'll retain focus on the top level window, but when we Alt-Tab away, we won't get another WM_KILLFOCUS or WM_NCACTIVATE, we get WM_ACTIVATE instead, so we need to check for focus updates in response to that as well.
Sam Lantinga a01aaf05 2021-10-30T21:42:07 Fixed compiler warning
Cameron Cawley 4d3da5b7 2021-10-26T21:51:29 riscos: Disable the mouse pointer for now
Cameron Cawley 1c256b89 2021-10-26T13:42:34 riscos: Fix enumerating screen modes
Cameron Cawley 5a3c97f3 2021-10-25T22:55:02 riscos: Fix detection of the current mode
Cameron Cawley 53b3db0c 2021-09-28T17:59:16 Handle the KMOD_SCROLL modifier on RISC OS
Cameron Cawley 1268984e 2021-09-09T21:09:50 Implement mouse input on RISC OS
Cameron Cawley f7f54f0d 2021-08-06T23:38:46 Implement keyboard input on RISC OS Partially based on a patch from http://www.riscos.info/websvn/listing.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2Flibraries%2Fsdl%2Flibsdl2%2F&rev=7174#a6401c766f408f1ea356e6977894cc6a5 Currently lacks support for mapping scancodes to keycodes.
Cameron Cawley f8a8ca3e 2021-08-05T23:16:29 Support proper mode switching on RISC OS
Cameron Cawley fe9bb747 2021-02-12T23:46:11 riscos: Refactor framebuffer code
Cameron Cawley 25c71748 2020-02-13T21:55:08 Add a barebones RISC OS video driver
Cameron Gutman 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.
Cameron Gutman c97c4687 2021-10-30T15:56:54 core: Convert SDL_IOReady()'s 2nd parameter to flags
Cameron Gutman 2bf36bfa 2021-10-24T21:28:04 wayland: Implement WaitEventTimeout() and SendWakeupEvent() We can have spurious wakeups in WaitEventTimeout() due to Wayland events that don't end up causing us to generate an SDL event. Fortunately for us, SDL_WaitEventTimeout_Device() handles this situation properly by calling WaitEventTimeout() again with an adjusted timeout.
Ivan Epifanov 9c799802 2021-10-26T15:18:26 Vita: fix IME input languages
Cameron Gutman 408a93a1 2021-10-23T15:43:04 wayland: Use multi-thread event reading APIs Wayland provides the prepare_read()/read_events() family of APIs for reading from the display fd in a deadlock-free manner across multiple threads in a multi-threaded application. Let's use those instead of trying to roll our own solution using a mutex. This fixes an issue where a call to SDL_GL_SwapWindow() doesn't swap buffers if it happens to collide with SDL_PumpEvents() in the main thread. It also allows coexistence with other code or toolkits in our process that may want read and dispatch events themselves.
Sylvain 23e252bf 2021-10-02T14:57:40 DirectFB: provide RenderCopyEx via RenderGeometry
Cameron Gutman f499168c 2021-10-24T15:54:57 x11: Use SDL_IOReady() instead of calling select() directly SDL_IOReady() properly handles EINTR and can use poll() if available.
Alex Szpakowski ba4ef461 2021-10-23T15:28:13 macOS: Fix implicit integer downcast warnings
David Gow a76b73dd 2021-10-22T19:04:32 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.
David Gow b528d484 2021-10-22T16:59:46 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
David Gow 84808ea4 2021-10-22T17:48:32 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.
uyjulian 007b5463 2021-10-21T22:50:33 video/uikit: Do not use setNeedsUpdateOfPrefersPointerLocked on iOS SDKs older than 14
Cacodemon345 19dee1cd 2021-10-22T06:37:20 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
Sam Lantinga bfd2f899 2021-10-19T17:29:23 Fixed grab handling when focus changes between windows in the same application
James Howard d9c44b65 2021-10-19T10:49:17 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.
Sylvain 649a33ae 2021-10-18T23:00:43 X11: remove redundant 'wakeup_lock' mutex creation
Ozkan Sezer 0a0f6854 2021-10-18T14:10:56 SDL_os2video.c: missed replacing a use of libc function
Sam Lantinga 7fb43643 2021-10-17T13:56:31 Don't process WM_INPUT when handling relative mode by warping the mouse cursor
DomGries 06824b18 2021-10-17T19:50:39 Cleanup windows events after recent changes Improves clarity without any functional changes
Sylvain 50f969c1 2021-10-17T22:02:19 Fixed bug #4841 - Out of bounds read (by 1 byte) in yuvnv12_rgb24_sseu
Sam Lantinga 1c5b3e0e 2021-10-15T18:12:18 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.