Commit Graph

135 Commits (1e8b006d43166a77d8311d89938e2082b9febe22)

Author SHA1 Message Date
SDL Wiki Bot fbe7301aba Sync SDL3 wiki -> header 2024-02-25 23:55:23 +00:00
Sam Lantinga be51b7acea Use the maximum potential headroom if EDR content isn't currently being displayed.
Also document that the HDR properties can change dynamically at runtime.
2024-02-25 15:54:34 -08:00
SDL Wiki Bot 2132ba8985 Sync SDL3 wiki -> header 2024-02-22 03:26:22 +00:00
Sam Lantinga 4ba6aeee9d A second take on HDR support with an SDR white point and HDR headroom
This better reflects how HDR content is actually used, e.g. most content is in the SDR range, with specular highlights and bright details beyond the SDR range, in the HDR headroom.

This more closely matches how HDR is handled on Apple platforms, as EDR.

This also greatly simplifies application code which no longer has to think about color scaling. SDR content is rendered at the appropriate brightness automatically, and HDR content is scaled to the correct range for the display HDR headroom.
2024-02-21 19:25:49 -08:00
SDL Wiki Bot 317099b01f Sync SDL3 wiki -> header 2024-02-17 03:51:21 +00:00
Sam Lantinga cb38649490 Added SDL_PROP_DISPLAY_HDR_WHITE_LEVEL_FLOAT 2024-02-16 19:50:41 -08:00
Sam Lantinga 87c07a79c0 Changed property name from '-' to '_' 2024-02-12 09:55:40 -08:00
SDL Wiki Bot 59f1e66adc Sync SDL3 wiki -> header 2024-02-12 17:55:23 +00:00
Sam Lantinga dca2721b91 Removed SDL_HINT_VIDEO_EXTERNAL_CONTEXT
This is replaced with SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT in SDL_CreateWindowWithProperties()
2024-02-12 09:54:33 -08:00
Zack Middleton 5af7113842 Rename property define names to have a type suffix
Renamed the following property define names to have a type suffix to
match other property names.

SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET (number)
SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET (number)
SDL_PROP_WINDOW_CREATE_WAYLAND_SCALE_TO_DISPLAY (boolean)
SDL_PROP_WINDOW_RENDERER (pointer)
SDL_PROP_WINDOW_TEXTUREDATA (pointer)
2024-02-12 09:54:11 -08:00
SDL Wiki Bot 432ce3f167 Sync SDL3 wiki -> header 2024-02-10 15:09:26 +00:00
Sam Lantinga 416803b03b Clarify the lifetime of the shape surface in SDL_SetWindowShape() 2024-02-10 07:08:28 -08:00
Sam Lantinga f95b7ee4da Renamed SDL_HasWindowSurface to SDL_WindowHasSurface
Fixes https://github.com/libsdl-org/SDL/issues/9034
2024-02-09 17:42:18 -08:00
SDL Wiki Bot 9ff8df932a Sync SDL3 wiki -> header 2024-02-10 00:05:26 +00:00
Sam Lantinga f6b92c9b88 Re-added a simplified version of SDL_SetWindowShape()
In order to handle mouse click transparency this needs to be implemented inside SDL
2024-02-09 16:04:46 -08:00
SDL Wiki Bot 451dc41427 Sync SDL3 wiki -> header 2024-02-06 10:49:24 +00:00
Sam Lantinga 30e176d6ba Added HDR display properties and related event
Also added an HDR calibration stage to testcolorspace
2024-02-06 02:48:05 -08:00
SDL Wiki Bot 00a8ca403e Sync SDL3 wiki -> header 2024-01-28 18:32:23 +00:00
Frank Praznik 5b8ca05f1a wayland: Add a forced screen space scaling mode
Add a mode that forces Wayland windows to output with scaling that forces 1:1 pixel mapping.

This is intended to allow legacy applications to be displayed without desktop scaling being applied, and may have issues with some display configurations, as this forces the window to behave in a way that Wayland desktops were not designed to accommodate (rounding errors can result from certain combinations of window/scale values, the window may be unusably small, jump in size at times, or appear to be larger than the desktop space, and cursor precision may be reduced).

Windows flagged as DPI-aware are not affected by this.

The automated video test suite passes with the hint turned on.
2024-01-28 13:31:42 -05:00
SDL Wiki Bot aba3038353 Sync SDL3 wiki -> header 2024-01-27 21:01:19 +00:00
Sam Lantinga 3b55c7d1f4 Shortened SDL property names 2024-01-27 13:00:50 -08:00
SDL Wiki Bot 4e60fc9b2b Sync SDL3 wiki -> header 2024-01-18 12:07:19 +00:00
Sam Lantinga fb898d6df0 Clarify that desktop mode is the non-exclusive borderless fullscreen mode
Fixes https://github.com/libsdl-org/SDL/issues/8413
2024-01-18 04:06:32 -08:00
SDL Wiki Bot 3ca8cee874 Sync SDL3 wiki -> header 2024-01-16 20:27:25 +00:00
Ryan C. Gordon 8bf74280e0
docs: Note SDL_UpdateWindowSurfaceRects can update beyond specified areas.
Reference Issue #8825.
2024-01-16 15:26:13 -05:00
SDL Wiki Bot 464a41411e Sync SDL3 wiki -> header 2024-01-15 18:55:24 +00:00
Frank Praznik 4f3d4bd110 wayland: Add the ability to import and wrap external surfaces
Add the ability to import and wrap external surfaces from external toolkits such as Qt and GTK.

Wayland surfaces and windows are more intrinsically tied to the client library than other windowing systems, so it is necessary to provide a way to initialize SDL with an existing wl_display object, which needs to be set prior to video system initialization, or export the internal SDL wl_display object for use by external applications or toolkits. For this, the global property SDL_PROPERTY_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER is used.

A Wayland example was added to testnative, and a basic example of Qt 6 interoperation is provided in the Wayland readme to demonstrate the use of external windows with both SDL owning the wl_display, and an external toolkit owning it.
2024-01-15 13:54:35 -05:00
Frank Praznik 4b6df89238 wayland: Add a property to allow creation of a wl_egl_window object even if OpenGL is not enabled
Useful if the application handles OpenGL outside of SDL and wants to use the window without having to pull in Wayland as a dependency.
2024-01-08 14:54:47 -05:00
Frank Praznik f7dd0f9491 wayland: Allow the creation of roleless window surfaces for custom application use
Allow for the creation of SDL windows with a roleless surface that applications can use for their own purposes, such as with a windowing protocol other than XDG toplevel.

The property `wayland.surface_role_custom` will create a window with a surface that SDL can render to and handles input for, but is not associated with a toplevel window, so applications can use it for their own, custom purposes (e.g. wlr_layer_shell).

A test/minimal example is included in tests/testwaylandcustom.c
2024-01-08 14:54:47 -05:00
Frank Praznik 4417250d0d wayland: Remove the registry from the window properties
A Wayland registry object can only have one listener attached at a time, so an application attempting to use the backend SDL registry object for its own purposes will just result in an error. Remove this property, as it is of no use to applications and will only result in errors.

If an application needs the registry, it needs to get the wl_display object via `SDL.window.wayland.display` and use wl_display_get_registry() to create a new registry object that it can attach its own listeners to.
2024-01-08 14:54:47 -05:00
SDL Wiki Bot 4942027117 Sync SDL3 wiki -> header 2024-01-08 17:34:23 +00:00
Ryan C. Gordon e056f52f7d
include: Remove string literals from properties documentation.
I'm going to let the wiki bridge clean up the word wrapping for me, here. :)
2024-01-08 12:33:29 -05:00
SDL Wiki Bot e8c595af5c Sync SDL3 wiki -> header 2024-01-08 17:16:19 +00:00
Ryan C. Gordon adef35b9ec
include: Attempt to make new properties documentation wiki bridge friendly. 2024-01-08 12:14:08 -05:00
SDL Wiki Bot 4d5bffc323 Sync SDL3 wiki -> header 2024-01-08 01:02:25 +00:00
Sam Lantinga 1a13dae219 Added constant definitions for SDL properties
Fixes https://github.com/libsdl-org/SDL/issues/8622
2024-01-07 16:59:41 -08:00
Sam Lantinga 5b3ee51c6c Updated copyright for 2024 2024-01-01 13:15:26 -08:00
Sam Lantinga ebd7f9adbd Fixed warning C4245: 'initializing': conversion from 'int' to 'Uint32', signed/unsigned mismatch in SDL_video.c 2023-12-29 10:37:28 -08:00
SDL Wiki Bot 20250aecc5 Sync SDL3 wiki -> header 2023-12-07 18:27:25 +00:00
Frank Praznik 4fd778119b video: Implement asynchronous windowing
SDL window size, state, and position functions have been considered immediate, with their effects assuming to have taken effect upon successful return of the function. However, several windowing systems handle these requests asynchronously, resulting in the functions blocking until the changes have taken effect, potentially for long periods of time. Additionally, some windowing systems treat these as requests, and can potentially deny or fulfill the request in a manner differently than the application expects, such as not allowing a window to be positioned or sized beyond desktop borders, prohibiting fullscreen, and so on.

With these changes, applications can make requests of the window manager that do not block, with the understanding that an associated event will be sent if the request is fulfilled. Currently, size, position, maximize, minimize, and fullscreen calls are handled as asynchronous requests, with events being returned if the request is honored. If the application requires that the change take effect immediately, it can call the new SDL_SyncWindow function, which will attempt to block until the request is fulfilled, or some arbitrary timeout period elapses, the duration of which depends not only on the windowing system, but on the operation requested as well (e.g. a 100ms timeout is fine for most X11 events, but maximizing a window can take considerably longer for some reason). There is also a new hint 'SDL_VIDEO_SYNC_ALL_WINDOW_OPS' that will mimic the old behavior by synchronizing after every window operation with, again, the understanding that using this may result in the associated calls blocking for a relatively long period.

The deferred model also results in the window size and position getters not reporting false coordinates anymore, as they only forward what the window manager reports vs allowing applications to set arbitrary values, and fullscreen enter/leave events that were initiated via the window manager update the window state appropriately, where they didn't before.

Care was taken to ensure that order of operations is maintained, and that requests are not ignored or dropped. This does require some implicit internal synchronization in the various backends if many requests are made in a short period, as some state and behavior depends on other bits of state that need to be known at that particular point in time, but this isn't something that typical applications will hit, unless they are sending a lot of window state in a short time as the tests do.

The automated tests developed to test the previous behavior also resulted in previously undefined behavior being defined and normalized across platforms, particularly when it comes to the sizing and positioning of windows when they are in a fixed-size state, such as maximized or fullscreen. Size and position requests made when the window is not in a movable or resizable state will be deferred until it can be applied, so no requests are lost. These changes fix another long-standing issue with renderers recreating maximized windows, where the original non-maximized size was lost, resulting in the window being restored to the wrong size. All automated video tests pass across all platforms.

Overall, the "make a request/get an event" model better reflects how most windowing systems work, and some backends avoid spending significant time blocking while waiting for operations to complete.
2023-12-07 10:26:19 -08:00
SDL Wiki Bot e4582e6edc Sync SDL3 wiki -> header 2023-11-30 15:22:19 +00:00
Sam Lantinga 7203641597 Note that the SDL window properties are read-only 2023-11-14 06:06:51 -08:00
Sam Lantinga e0c45c6c98 Renamed SDL_WINDOW_FOREIGN to SDL_WINDOW_EXTERNAL 2023-11-14 06:06:51 -08:00
Sam Lantinga 229b7b9d50 SDL_CreateWindowWithPosition() and SDL_CreateWindowFrom() have been replaced with SDL_CreateWindowWithProperties()
This is a more general interface that can be extended in the future as needed.
2023-11-14 06:06:51 -08:00
Ryan C. Gordon 8766aa39d6
Sync wiki -> headers. 2023-11-13 13:03:42 -05:00
Sam Lantinga 1c4723ac66 SDL_CreateWindowFrom() now takes a set of properties that describe the native window and options. 2023-11-12 21:58:58 -08:00
Sam Lantinga 0907f345cb Added property types: pointer, string, number, float 2023-11-12 10:48:38 -08:00
Sam Lantinga d3e43668d0 Revert "Sync SDL3 wiki -> header"
This reverts commit 43571769f1.
2023-11-12 09:02:22 -08:00
SDL Wiki Bot 43571769f1 Sync SDL3 wiki -> header 2023-11-12 15:55:10 +00:00
Sam Lantinga b374105975 Replaced SDL_GetTextureDXGIResource() with texture properties
Fixes https://github.com/libsdl-org/SDL/issues/8529
2023-11-10 20:38:13 -08:00