mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-12 03:37:56 +02:00
wayland: Handle the toplevel export property as a string
xdg-toplevel export handles are strings, so treat the property as one. Avoids the need to manually manage the string pointer.
This commit is contained in:
@@ -285,7 +285,7 @@ static void DBus_OpenDialog(const char *method, const char *method_title, SDL_Di
|
||||
|
||||
handle_str = default_parent_window;
|
||||
if (props) {
|
||||
const char *parent_handle = SDL_GetProperty(props, SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_POINTER, NULL);
|
||||
const char *parent_handle = SDL_GetStringProperty(props, SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING, NULL);
|
||||
if (parent_handle) {
|
||||
size_t len = SDL_strlen(parent_handle);
|
||||
len += sizeof(WAYLAND_HANDLE_PREFIX) + 1;
|
||||
|
||||
@@ -1484,10 +1484,7 @@ static void exported_handle_handler(void *data, struct zxdg_exported_v2 *zxdg_ex
|
||||
SDL_WindowData *wind = (SDL_WindowData*)data;
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(wind->sdlwindow);
|
||||
|
||||
SDL_free(wind->export_handle);
|
||||
wind->export_handle = SDL_strdup(handle);
|
||||
|
||||
SDL_SetProperty(props, SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_POINTER, wind->export_handle);
|
||||
SDL_SetStringProperty(props, SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING, handle);
|
||||
}
|
||||
|
||||
static struct zxdg_exported_v2_listener exported_v2_listener = {
|
||||
@@ -1823,10 +1820,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
zxdg_exported_v2_destroy(wind->exported);
|
||||
wind->exported = NULL;
|
||||
|
||||
SDL_free(wind->export_handle);
|
||||
wind->export_handle = NULL;
|
||||
|
||||
SDL_SetProperty(props, SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_POINTER, NULL);
|
||||
SDL_SetStringProperty(props, SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
|
||||
@@ -105,7 +105,6 @@ struct SDL_WindowData
|
||||
SDL_Window *keyboard_focus;
|
||||
|
||||
char *app_id;
|
||||
char *export_handle;
|
||||
float windowed_scale_factor;
|
||||
|
||||
struct
|
||||
|
||||
Reference in New Issue
Block a user