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:
Frank Praznik
2024-03-18 11:39:11 -04:00
parent 9072b994f7
commit ebb6582534
4 changed files with 32 additions and 39 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -105,7 +105,6 @@ struct SDL_WindowData
SDL_Window *keyboard_focus;
char *app_id;
char *export_handle;
float windowed_scale_factor;
struct