mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-23 10:12:47 +08:00
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:
@@ -79,6 +79,7 @@ struct SDL_VideoData
|
||||
struct wl_list output_list;
|
||||
|
||||
int relative_mouse_mode;
|
||||
SDL_bool display_externally_owned;
|
||||
};
|
||||
|
||||
struct SDL_DisplayData
|
||||
@@ -107,6 +108,10 @@ extern void SDL_WAYLAND_register_output(struct wl_output *output);
|
||||
extern SDL_bool SDL_WAYLAND_own_surface(struct wl_surface *surface);
|
||||
extern SDL_bool SDL_WAYLAND_own_output(struct wl_output *output);
|
||||
|
||||
extern SDL_WindowData *Wayland_GetWindowDataForOwnedSurface(struct wl_surface *surface);
|
||||
void Wayland_AddWindowDataToExternalList(SDL_WindowData *data);
|
||||
void Wayland_RemoveWindowDataFromExternalList(SDL_WindowData *data);
|
||||
|
||||
extern SDL_bool Wayland_LoadLibdecor(SDL_VideoData *data, SDL_bool ignore_xdg);
|
||||
|
||||
extern SDL_bool Wayland_VideoReconnect(SDL_VideoDevice *_this);
|
||||
|
||||
Reference in New Issue
Block a user