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.
This commit is contained in:
@@ -288,9 +288,20 @@ if(APPLE)
|
||||
endif()
|
||||
elseif(WINDOWS)
|
||||
add_sdl_test_executable(testnative BUILD_DEPENDENT NEEDS_RESOURCES TESTUTILS SOURCES testnative.c testnativew32.c)
|
||||
elseif(HAVE_X11)
|
||||
add_sdl_test_executable(testnative BUILD_DEPENDENT NEEDS_RESOURCES TESTUTILS SOURCES testnative.c testnativex11.c)
|
||||
target_link_libraries(testnative PRIVATE X11)
|
||||
elseif(HAVE_X11 OR HAVE_WAYLAND)
|
||||
add_sdl_test_executable(testnative BUILD_DEPENDENT NO_C90 NEEDS_RESOURCES TESTUTILS SOURCES testnative.c)
|
||||
if(HAVE_X11)
|
||||
target_sources(testnative PRIVATE testnativex11.c)
|
||||
target_link_libraries(testnative PRIVATE X11)
|
||||
endif()
|
||||
if(HAVE_WAYLAND)
|
||||
set_property(SOURCE ${SDL3_BINARY_DIR}/wayland-generated-protocols/xdg-shell-protocol.c PROPERTY GENERATED 1)
|
||||
target_sources(testnative PRIVATE testnativewayland.c ${SDL3_BINARY_DIR}/wayland-generated-protocols/xdg-shell-protocol.c)
|
||||
|
||||
# Needed to silence the documentation warning in the generated header file
|
||||
target_compile_options(testnative PRIVATE -Wno-documentation-unknown-command)
|
||||
target_link_libraries(testnative PRIVATE wayland-client)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
find_package(Python3)
|
||||
|
||||
Reference in New Issue
Block a user