src/video


Log

Author Commit Date CI Message
Cameron Gutman 8c921d82 2021-01-22T19:40:26 Implement keyboard grab support for Windows This is implemented via a low-level keyboard hook. Unfortunately, this is rather invasive, but it's how Microsoft recommends that it be done [0]. We want to do as little as possible in the hook, so we only intercept a few crucial modifier keys there, while leaving other keys to the normal event processing flow. We will only install this hook if SDL_HINT_GRAB_KEYBOARD=1, which is not the default. This will reduce any compatibility concerns to just the SDL applications that explicitly ask for this behavior. We also remove the hook when the grab is terminated to ensure that we're not unnecessarily staying involved in key event processing when it's not required anymore. [0]: https://docs.microsoft.com/en-us/windows/win32/dxtecharts/disabling-shortcut-keys-in-games
Cameron Gutman cf84ec44 2021-01-20T23:19:24 Improve reliability of cursor hiding on GNOME Wayland Hiding the cursor doesn't appear to work reliably on GNOME when another window steals mouse focus right as we call SDL_ShowCursor(SDL_DISABLE). This can happen when the keyboard shortcut inhibition permission prompt appears in response to a call to SDL_SetRelativeMouseMode() with SDL_HINT_GRAB_KEYBOARD=1. The result is that the default cursor is stuck locked in position and visible on screen indefinitely. By redrawing the cursor on pointer focus enter, the cursor now disappears upon the first mouse motion event. It's not perfect but it's way better than the current behavior.
Cameron Gutman 19236b46 2021-01-21T21:49:13 Implement support for minimizing windows on Wayland This required a bit of extra code to deal with the transition from minimized back to fullscreen
Ozkan Sezer b6ae9a7c 2021-01-21T21:20:10 renamed my_gradd.h to SDL_gradd.h
Cameron Gutman d789ba83 2021-01-19T18:20:07 Implement keyboard grab support for Wayland Use zwp_keyboard_shortcuts_inhibit_manager_v1 to allow SDL applications to capture system keyboard shortcuts like Alt+Tab when keyboard grab is enabled via SDL_HINT_GRAB_KEYBOARD.
Manuel Alfayate Corchete ee93f0ed 2021-01-19T15:35:43 [KMS/DRM] Revert unaproved fix for bug #5465.
Manuel Alfayate Corchete e1d932f8 2021-01-17T21:33:51 [KMS/DRM] Fix for bug #5468: corruption on dynamic cursor changing caused by wrong buffer size.
Manuel Alfayate Corchete 99facb1d 2021-01-17T21:17:01 [KMS/DRM] Fix for bug #5470: ratio correction for fullscreen windows with no matching resolution. Correct bracket position in else statements so they follow the coding style.
Manuel Alfayate Corchete 03665004 2021-01-15T15:00:17 [KMS/DRM] Small fix to KMSDRM_Waitpageflip(). More comments on how it works.
Sam Lantinga 6a342954 2021-01-14T14:42:53 Fixed bug 5451 - Can't create EGLSurface in Wayland from SDLWindow (no EGLNativeWindow pointer) sashikknox In some cases, need create EGLWindow with SDLWindow. In X11 i can get pointer to NativeWindow from **struct SDL_SysWMinfo wmInfo** ```C++ struct SDL_SysWMinfo wmInfo; SDL_GetWindowWMInfo(ptSDLWindow, &wmInfo) #if defined(__unix__) && defined(SDL_VIDEO_DRIVER_X11) nativeWindow=(EGLNativeWindowType)wmInfo.info.x11.window; nativeDisplay=(EGLNativeDisplayType)wmInfo.info.x11.display; #endif ``` than i can create EGLSurface ``` eglCreateWindowSurface(nativeDisplay, EGL_CONFIG, nativeWindow, SURFACE_ATTRIBUTES); ``` in Wayland i can do it with same way, just need pointer to **EGLWindow**, we already have pointer to **wl_display** from **SDL_sysWMInfo**, need add to **wl** struct in SDL_SysWMInfo another pointer to **struct wl_egl_window *egl_window;**. And in wayland backend, in function **Wayland_GetWindowWMInfo** return pointer to **egl_window** from **SDL_WindowData** Now i use patched statically built SDL2 in port of Quake 2 GLES2 for SailfishOS (it use QtWayland): link to SDL2 commit and changed string for patch: - https://github.com/savegame/lp-public/commit/6858a618cd179b766fe3cab36055f07cb03ad0ea - https://github.com/savegame/lp-public/blob/b1e29e87b9d15780e47f04918b329ac15554fc69/SDL2/src/video/wayland/SDL_waylandwindow.c#L463 link to use in Quake2 port: 1. here i get pointer to EGLNativeWindowType: https://github.com/savegame/lp-public/blob/6d94fedb1b720da24999ae6286a1809cd3d55ff5/Engine/Sources/Compatibility/OpenGLES/EGLWrapper.c#L319 2. then use it for create EGLSurface: https://github.com/savegame/lp-public/blob/6d94fedb1b720da24999ae6286a1809cd3d55ff5/Engine/Sources/Compatibility/OpenGLES/EGLWrapper.c#L391
Sam Lantinga 82aafa9a 2021-01-14T14:32:11 Fixed bug 5461 - Add rewritten WSCONS driver for OpenBSD wahil1976 This patch adds a written-from-scratch WSCONS driver for OpenBSD. It does not have hardcoded keymaps, and it features mouse support when wsmux is available. For this to work, it needs access to the /dev/wskbd* devices which are not available to non-root users by default. Access to those can be granted by changing /etc/fbtab to give the logging user the ownership of those devices.
Manuel Alfayate Corchete 1adadc77 2021-01-14T10:18:40 [KMS/DRM] Adjust come return values. Improve comments.
Manuel Alfayate Corchete 57661e42 2021-01-13T20:17:50 [KMS/DRM] Remove unused header.
Manuel Alfayate Corchete ead3c406 2021-01-13T20:11:01 [KMS/DRM] Refactor, improve and re-comment async pageflips code.
Manuel Alfayate Corchete aac74db6 2021-01-13T15:54:26 [KMS/DRM] Enable async pageflips.
Manuel Alfayate Corchete 9384e595 2021-01-12T20:15:37 [KMS/DRM] Add warning comentary to avoid future experiments with scaling.
Manuel Alfayate Corchete 84427549 2021-01-12T00:22:58 [KMS/DRM] Refactor KMSDR_CreateSurface to group all non-Vulkan stuff in a block.
Manuel Alfayate Corchete 87eb734c 2021-01-11T23:59:40 [KMS/DRM] Don't ask SDL to scale image when in Vulkan mode.
Manuel Alfayate Corchete 85e8adf7 2021-01-11T22:28:27 [KMS/DRM] Unused code cleaning.
Manuel Alfayate Corchete 5105ecf8 2021-01-11T21:02:07 [KMS/DRM] Move surface size info to window driverdata, for coherency.
Manuel Alfayate Corchete 2067a7db 2021-01-11T20:29:09 [KMS/DRM] Fix fullscreen to windowed transition. Fix aspect ratio correction without using planes.
Manuel Alfayate Corchete 850d9c8c 2021-01-09T02:25:13 [KMS/DRM] Cleanup remainings from plane/scaling usage.
Manuel Alfayate Corchete 2aeb3177 2021-01-08T22:00:28 [KMS/DRM] Fix vkQuake3 in OpenGL mode.
Sam Lantinga 8746788f 2021-01-08T11:08:23 KMSDRM_LEGACY is no longer legacy
Manuel Alfayate Corchete b2449473 2021-01-08T18:57:12 [KMS/DRM] Go back to the LEGACY interface only because using planes breaks compatibility with HW, so no advantage on using ATOMIC.
Manuel Alfayate Corchete 940e1b8d 2021-01-08T16:33:50 [KMS/DRM] Small readability changes.
Manuel Alfayate Corchete e5bf1850 2021-01-08T15:39:05 [KMS/DRM] Fix cpmpilation warnings. Thanks to Ozkan Sezer for pointing this out!
Manuel Alfayate Corchete cef1bd06 2021-01-08T13:14:42 [KMS/DRM] Prevent creating another default cursor everytime a window is created. Other fixes and cleanups.
Sam Lantinga e778881a 2021-01-07T11:49:28 Fixed bug 5449 - SDL_DROPFILE update mouse location of drop in Cocoa Dominik Reichardt Exult (http://exult.info) has an editor app that uses GTK+2. Up to now we were using X's drag'n'drop to allow dropping of assets from the editor onto Exult. There is now an experimental branch that makes use of SDL_DROPFILE. That works under X, dropping in Exult's SDL2 window puts the asset right at the spot you dropped at. On macOS with native Exult and Quartz GTK+2 this doesn't work, the location of the drop is where the mouse was last tracked before you left the window (usually one of the edges, unless you tabbed out). All we tried out pointed to the fact that the location update needs to be done by the dropfile event in SDL2, not by our own (which always only worked after the Exult window getting focus). This patch adds this to SDL_cocoawindow.m and it works perfectly, passing the correct coordinates to our code (SDL_GetMouseState()).
Manuel Alfayate Corchete d079130c 2021-01-07T18:44:34 [KMS/DRM] Don't use primary plane for scaling because that's unsupported on most LEGACY-only HW.
Manuel Alfayate Corchete e168d113 2021-01-07T14:40:24 [KMS/DRM] Correct drmModeSetCursor() dimensions.
Manuel Alfayate Corchete 335d78ff 2021-01-07T11:30:33 [KMS/DRM] Add the missing files for Vulkan support to the KMSDRM_LEGACY backend, had forgotted to do -hg add-.
Manuel Alfayate Corchete 661bacfe 2021-01-07T00:47:21 [KMS/DRM] Add Vulkan suport to the KMSDRM_LEGACY backend.Minor text spacing tweaks for better readability. Comment out unused function.
Ozkan Sezer dfb0afe3 2021-01-07T00:41:32 fix build after commit 5730b2005da1
Manuel Alfayate Corchete 67e0b1dd 2021-01-06T22:15:26 [KMS/DRM] Rewrite KMSDRM_LEGACY backend to accomodate Vulkan compatibility. Fix several bugs on that backend.
Ozkan Sezer 76295cec 2021-01-05T15:50:10 video/windows: ANSI/UNICODE updates (cf. bug 5435): - explicitly use UNICODE versions of DrawText, EnumDisplaySettings, EnumDisplayDevices, and CreateDC: the underlying structures have WCHAR strings. - change WIN_UpdateDisplayMode and WIN_GetDisplayMode() to accept LPCWSTR instead of LPCTSTR for the same reason. - change WIN_StringToUTF8 and WIN_UTF8ToString to the explicit 'W' versions where appropriate.
Ozkan Sezer 31751bdc 2021-01-05T15:15:37 wmmsg.h: constified wmtab
Ozkan Sezer 390fd14f 2021-01-04T01:23:50 SDL_windowswindow.c (SDL_HelperWindowCreate): adjust for ANSI/UNICODE: change SDL_HelperWindowClassName and SDL_HelperWindowName from WCHAR * to be const TCHAR* cf. bug #5435.
Ozkan Sezer 01a2f276 2021-01-04T01:23:50 consistently use TEXT() macro with LoadLibrary() and GetModuleHandle() cf. bug #5435.
Sam Lantinga 393c8c1f 2021-01-03T10:32:55 Fixed bug 5440 - MacCatalyst build failures C.W. Betts I tested building commit http://hg.libsdl.org/SDL/rev/7adf3fdc19f3 on Mac Catalyst and found some issues: * MTLFeatureSet_iOS_* enums aren't available under Mac Catalyst. * OpenGL ES is unavailable under Mac Catalyst. * Some Metal features are available under Catalyst but not iOS, such as displaySyncEnabled. * Set Metal as the default renderer on Mac Catalyst Attaching a patch that will make SDL2 build for Mac Catalyst.
Sylvain Becker fea49a3e 2021-01-03T15:24:47 SDL_stretch.c: compilation NEON on Windows 10
Sylvain Becker acccc71f 2021-01-02T22:31:44 Fixed bug 5436 - MSVC 2019 ARM64 build fails to compile SDL_stretch.c
Cameron Gutman 6cbd4417 2021-01-02T14:45:15 Add a hint for D3D9Ex to avoid having to choose at compile-time
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga 963c9495 2021-01-02T10:11:08 Fixed bug 5431 - SDL_Metal_GetDrawableSize is inaccurate for high dpi displays if a Metal view has not already been created Caleb Cornett For a window created with SDL_WINDOW_ALLOW_HIGHDPI, SDL_GL_GetDrawableSize will return the high-dpi drawable size even before any GL context creation happens. But SDL_Metal_GetDrawableSize will return the size of the window if the Metal view has not been created. This is confusing and inconsistent behavior. An easy way to test this is to build testgl2 and testvulkan on macOS with the SDL_WINDOW_ALLOW_HIGHDPI flag enabled during window creation. The GL2 program will report a drawable size of 2x window width and 2x window height, while the Vulkan program will report the window size. This patch addresses the issue by falling back to using the content view dimensions if no Metal view exists in the window. (The code for this was taken directly from Cocoa_GL_GetDrawableSize.) With this change, the testvulkan behavior matches that of testgl2. Note that I haven't tested for this issue on UIKit. It's possible a similar change will need to be made there too.
Sylvain Becker c005267f 2021-01-02T09:38:19 SDL_BlitScaled: better and safer fix clipping bug #2687 And re-use SDL_round(), since it's been re-added (remove in https://hg.libsdl.org/SDL/rev/34043108b7e4 )
Sylvain Becker 2127ed25 2021-01-02T09:28:16 SDL_SoftStretch: add a check for input pixel format and function re-naming
Manuel Alfayate Corchete 21003b7d 2020-12-31T14:31:29 [KMS/DRM] Small refactoring on the SwapWindow function.
Manuel Alfayate Corchete e1fb969b 2020-12-31T01:40:15 [KMS/DRM] Correct comments about last bugfix.
Manuel Alfayate Corchete e34caa97 2020-12-31T01:31:57 [KMS/DRM] Correct EGL/GL library loading on window creation, thus saving window re-creation.
Sylvain Becker d81fe923 2020-12-30T22:03:32 SDL_BlitScaled: remove un needed -1 +1 offset in calculation
Sylvain Becker 80cf8a8b 2020-12-29T17:29:31 SDL_BlitScaled: also prevent crash if dest width or height is negative
Sylvain Becker f08b9a5b 2020-12-29T16:02:52 SDL_BlitScaled: prevent crash if dest width or height is 0
Manuel Alfayate Corchete 427c96ec 2020-12-29T14:24:38 [KMS/DRM] Rework some functions.
Sam Lantinga 3cb0e840 2020-12-28T11:47:53 Fixed bug 5422 - KMSDRM_LEGACY: Add OpenBSD support wahil1976 This patch adds support for OpenBSD to KMSDRM_LEGACY. Note that the patch won't be ported to the atomic KMSDRM backend because OpenBSD does not support atomic KMS properly yet.
Manuel Alfayate Corchete 7539ac80 2020-12-28T18:22:07 [KMS/DRM] Restore hacky code to point to TTY buffer on surface destruction b/c I lack alternatives.
Manuel Alfayate Corchete 86b81abe 2020-12-28T16:19:19 [KMS/DRM_LEGACY] Prevent mouse cursor from staying onscreen after window destruction. Patch by Ozkan Sezer.
Manuel Alfayate Corchete 0feaf7d1 2020-12-28T14:37:58 [KMS/DRM][Vulkan] Correct non-existing property. Remove hacky surface destruction code (TTY buffer isn't there after a Vulkan window is created).
Sylvain Becker 7186584b 2020-12-28T10:41:37 fix indentation (bug 5313)
Sylvain Becker c2735c0b 2020-12-27T23:53:28 Better scaling fallbacks for the SW renderer (bug 5313)
Ozkan Sezer a6beb2d2 2020-12-28T01:10:02 SDL_PrivateLowerBlitScaled: remove unused local var 'a'
Sylvain Becker 30df2e4e 2020-12-27T23:00:11 Scaling fallbacks for the SW renderer (bug 5313)
Sylvain Becker f9b5f6cc 2020-12-27T20:28:24 Forward scale mode to SW renderer (Bug 5313)
Manuel Alfayate Corchete 46d31d57 2020-12-27T00:43:06 [KMS/DRM][Vulkan] Fix segfault when changing fullscren mode and permanent cursor when changing between Vulkan and GL renderers in vkQuake3. Tidy up window destruction code.
Sam Lantinga 9838611a 2020-12-23T15:52:12 Fixed compiler crash building for iOS with clang 11.0.3
Sylvain Becker 4aebad77 2020-12-23T22:50:50 SDL_SoftStretchLowerLinear: try to make xcode buildbot compile (Bug 5313)
Sam Lantinga 93ccdee8 2020-12-23T13:47:49 Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf Cameron Cawley stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf The default implementation is based on the one used in the Windows RT video driver.
Sylvain Becker 8e20376f 2020-12-23T22:09:01 SDL_SoftStretchLinear: use SDL_INLINE (bug 5313)
Sylvain Becker 7b8d5b7d 2020-12-23T22:02:28 SDL_SoftStretchLinear: fix implicit conversion (bug 5313)
Sylvain Becker ae8a270f 2020-12-23T21:37:40 Add SDL_SoftStretchLowerLinear() (Bug 5313)
Sylvain Becker 050ee9a4 2020-12-23T21:32:01 Split SDL_SoftStretch in Lower and Uppler functions (Bug 5313)
Manuel Alfayate Corchete 09fcc9ed 2020-12-23T16:45:23 [KMS/DRM][Vulkan] Fix small warning, thanks to Ozkan Sezer for spotting it.
Manuel Alfayate Corchete a6dc838d 2020-12-23T16:22:46 [KMS/DRM][Vulkan] Only try to create a display mode when no suitable mode is found.
Manuel Alfayate Corchete 2fc987c2 2020-12-22T14:15:33 [Buildsystem] Add guards for not building with KMSDRM support if EGL is not available.
Sam Lantinga 4cd98160 2020-12-21T09:44:25 Fixed whitespace
Manuel Alfayate Corchete 8766d604 2020-12-21T17:29:24 [Video/KMSDRM] Fix potetial access to freed structure and complete errorchecks.
Manuel Alfayate Corchete b06ef3a1 2020-12-21T01:53:11 [Video/KMSDRM] Manually re-show the cursor on window creation, if needed.
Ozkan Sezer 4198f0e5 2020-12-21T01:20:30 fix uninitialized warnings in KMSDRM_CreateCursor()
Manuel Alfayate Corchete a8dbcab1 2020-12-20T21:48:05 [Video/KMSDRM] Don't copy the cursor bitmap to the cursor GBM BO until we're showing it.
Manuel Alfayate Corchete 2756b0f3 2020-12-20T14:29:58 [Video/KMSDRM] Init and deinit mouse stuff at the same time that GBM stuff.
Manuel Alfayate Corchete cf71e017 2020-12-19T23:32:09 [Video/KMSDRM] Remove auxiliary AMDGPU compatibility workarounds not needed anymore.
Manuel Alfayate Corchete af1f91cb 2020-12-19T20:21:07 [Video/KMSDRM] Correct typo.
Manuel Alfayate Corchete cf489556 2020-12-19T20:15:50 [Video/KMSDRM] Honor the device index in Vulkan. Add notes about the display index.
Manuel Alfayate Corchete ab3a390e 2020-12-19T17:35:04 [Video/KMSDRM] Better ATOMIC caps testing: patch by Oskan Sezer.
Manuel Alfayate Corchete 436499f3 2020-12-19T02:08:59 [Video/KMSDRM] Comment out some debug info, adjust comments for future work.
Ozkan Sezer 6b81cac4 2020-12-19T01:25:50 remove duplicated SDL_SetError after calling check_atomic_modesetting()
Manuel Alfayate Corchete 8952a613 2020-12-18T23:17:42 [Video/KMSDRM] Re-arrange display members setup.
Manuel Alfayate Corchete f60f8d5d 2020-12-18T22:53:51 [Video/KMSDRM]: Add Vulkan support to the KMSDRM backend.
Ozkan Sezer 6ac0b23d 2020-12-18T21:37:20 SDL_DirectFB_video.c: DSPF_ABGR requires directfb >= 1.5.0 -- add guard.
Ozkan Sezer 6c4ab484 2020-12-18T17:50:02 SDL_kmsdrmvideo.c: check atomic modesetting in check_modesetting() .. so that KMSDRM_CreateDevice() can fail and SDL_VideoInit() would move on to next bootstrap member which is kmsdrm_legacy. hopefully fixes bug #5393.
Ozkan Sezer 10625f9d 2020-12-17T23:50:00 SDL_windowsmessagebox.c: go back to hg rev 14458 state. encountering a NULL caption in AddDialogString() is intended, i.e. AddDialogStaticIcon() sends it as NULL on purpose.
Ozkan Sezer 4d6eb305 2020-12-17T23:28:20 SDL_windowsmessagebox.c (AddDialogControl): add back NULL caption check. because AddDialogStaticIcon() sends a NULL caption -- fixes bug #5401.
Ozkan Sezer 90456670 2020-12-17T14:11:00 more "'for' loop initial declarations are only allowed in C99 mode" fixes
Ozkan Sezer ed4fcb2c 2020-12-16T03:24:10 kmsdrm_legacy build fixes: - add missing '_LEGACY' to symbol names - perform missing 2.0.14 portage - fix 'for' loop initial declarations are only allowed in C99 mode errors
Ozkan Sezer 9940e710 2020-12-16T00:10:30 Import two post-2.0.12 fixes to kmsdrm_legacy: Fix build breakage without EGL: https://hg.libsdl.org/SDL/rev/f2606fe53654e305ab9badb821d9d3afb7f92f49 Fix KMSDRM_CreateWindow segfault when starting L?VE2D engine (bug 5199) https://hg.libsdl.org/SDL/rev/d2e69a78939463d9ff9448a5f4efd1e208bb97b0
Sam Lantinga f8839289 2020-12-15T12:22:48 Potential fix for bug 5393 - KMSDRM: using atomic mode setting breaks GPU compatibility Substring I was trying the KMSDRM video backend with some very simple programs that were working ok on 2.0.12. The same code won?t work on the current dev branch and I get: DEBUG: check_modesetting: probing ?/dev/dri/card0? DEBUG: /dev/dri/card0 connector, encoder and CRTC counts are: 4 5 6 DEBUG: check_modesetting: probing ?/dev/dri/card0? DEBUG: /dev/dri/card0 connector, encoder and CRTC counts are: 4 5 6 DEBUG: KMSDRM_VideoInit() DEBUG: Opening device /dev/dri/card0 DEBUG: Opened DRM FD (3) DEBUG: no atomic modesetting support. DEBUG: Video subsystem has not been initialized INFO: Using SDL video driver: (null) DEBUG: Video subsystem has not been initialized After carefully checking, the radeon driver doesn?t support atomic modesetting. That?s not the only problem : the same happens with the amdgpu driver if we disable Display Core (kernel parameter amdgpu.dc=0, which is required to get analogue outputs working). This is a major regression in the KMSDRM driver. Using atomic mode setting is great, but having no fallback to the "standard KMS" is bad.
Sam Lantinga ee85a41a 2020-12-13T02:10:46 Fixed compile warning
Ozkan Sezer 5c212cb0 2020-12-10T12:24:24 remove a few stale NULL message/title checks after commit e2b729b1756a top-level guarantees non-NULL message / title passed in messageboxdata
Ozkan Sezer f1cab8ae 2020-12-10T11:20:56 fix bug #5253: handle NULL title or message fields in SDL_MessageBoxData - SDL_video.c (SDL_ShowMessageBox): replace messageboxdata, set title or message field to "" if either of them is NULL. - SDL_video.c (SDL_ShowSimpleMessageBox): set title or message to "" if either of them is NULL for EMSCRIPTEN builds. - SDL_bmessagebox.cc: add empty string check along with NULL check for title and message fields. - SDL_windowsmessagebox.c (AddDialogString): remove NULL string check - SDL_windowsmessagebox.c (AddDialogControl): add empty string check along with the NULL check. - SDL_x11messagebox.c: revert commit 677c4cd68069 - SDL_os2messagebox.c: revert commit 2c2a489d76e7 - test/testmessage.c: Add NULL title and NULL message tests.
Sam Lantinga d46dd103 2020-12-09T07:49:07 Fixed typo in Vulkan load logic