wayland: Refactor some shell surface related names

This commit is contained in:
Frank Praznik
2024-10-27 15:56:35 -04:00
parent 2b7dc55364
commit 36c209080c
4 changed files with 87 additions and 87 deletions

View File

@@ -638,7 +638,7 @@ static bool ProcessHitTest(SDL_WindowData *window_data,
switch (window_data->hit_test_result) { switch (window_data->hit_test_result) {
case SDL_HITTEST_DRAGGABLE: case SDL_HITTEST_DRAGGABLE:
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (window_data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (window_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (window_data->shell_surface.libdecor.frame) { if (window_data->shell_surface.libdecor.frame) {
libdecor_frame_move(window_data->shell_surface.libdecor.frame, libdecor_frame_move(window_data->shell_surface.libdecor.frame,
seat, seat,
@@ -646,7 +646,7 @@ static bool ProcessHitTest(SDL_WindowData *window_data,
} }
} else } else
#endif #endif
if (window_data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (window_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if (window_data->shell_surface.xdg.toplevel.xdg_toplevel) { if (window_data->shell_surface.xdg.toplevel.xdg_toplevel) {
xdg_toplevel_move(window_data->shell_surface.xdg.toplevel.xdg_toplevel, xdg_toplevel_move(window_data->shell_surface.xdg.toplevel.xdg_toplevel,
seat, seat,
@@ -664,7 +664,7 @@ static bool ProcessHitTest(SDL_WindowData *window_data,
case SDL_HITTEST_RESIZE_BOTTOMLEFT: case SDL_HITTEST_RESIZE_BOTTOMLEFT:
case SDL_HITTEST_RESIZE_LEFT: case SDL_HITTEST_RESIZE_LEFT:
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (window_data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (window_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (window_data->shell_surface.libdecor.frame) { if (window_data->shell_surface.libdecor.frame) {
libdecor_frame_resize(window_data->shell_surface.libdecor.frame, libdecor_frame_resize(window_data->shell_surface.libdecor.frame,
seat, seat,
@@ -673,7 +673,7 @@ static bool ProcessHitTest(SDL_WindowData *window_data,
} }
} else } else
#endif #endif
if (window_data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (window_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if (window_data->shell_surface.xdg.toplevel.xdg_toplevel) { if (window_data->shell_surface.xdg.toplevel.xdg_toplevel) {
xdg_toplevel_resize(window_data->shell_surface.xdg.toplevel.xdg_toplevel, xdg_toplevel_resize(window_data->shell_surface.xdg.toplevel.xdg_toplevel,
seat, seat,

View File

@@ -115,8 +115,8 @@ bool Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
* FIXME: Request EGL_WAYLAND_swap_buffers_with_timeout. * FIXME: Request EGL_WAYLAND_swap_buffers_with_timeout.
* -flibit * -flibit
*/ */
if (data->surface_status != WAYLAND_SURFACE_STATUS_SHOWN && if (data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_SHOWN &&
data->surface_status != WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME) { data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME) {
return true; return true;
} }
@@ -134,7 +134,7 @@ bool Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
// Control swap interval ourselves. See comments on Wayland_GLES_SetSwapInterval // Control swap interval ourselves. See comments on Wayland_GLES_SetSwapInterval
if (swap_interval != 0 && data->surface_status == WAYLAND_SURFACE_STATUS_SHOWN) { if (swap_interval != 0 && data->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_SHOWN) {
SDL_VideoData *videodata = _this->internal; SDL_VideoData *videodata = _this->internal;
struct wl_display *display = videodata->display; struct wl_display *display = videodata->display;
// 20hz, so we'll progress even if throttled to zero. // 20hz, so we'll progress even if throttled to zero.

View File

@@ -176,7 +176,7 @@ static void SetMinMaxDimensions(SDL_Window *window)
} }
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (!wind->shell_surface.libdecor.initial_configure_seen || !wind->shell_surface.libdecor.frame) { if (!wind->shell_surface.libdecor.initial_configure_seen || !wind->shell_surface.libdecor.frame) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -193,7 +193,7 @@ static void SetMinMaxDimensions(SDL_Window *window)
} }
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) { if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -247,7 +247,7 @@ static void AdjustPopupOffset(SDL_Window *popup, int *x, int *y)
{ {
// Adjust the popup positioning, if necessary // Adjust the popup positioning, if necessary
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (popup->parent->internal->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (popup->parent->internal->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
int adj_x, adj_y; int adj_x, adj_y;
libdecor_frame_translate_coordinate(popup->parent->internal->shell_surface.libdecor.frame, libdecor_frame_translate_coordinate(popup->parent->internal->shell_surface.libdecor.frame,
*x, *y, &adj_x, &adj_y); *x, *y, &adj_x, &adj_y);
@@ -261,7 +261,7 @@ static void RepositionPopup(SDL_Window *window, bool use_current_position)
{ {
SDL_WindowData *wind = window->internal; SDL_WindowData *wind = window->internal;
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP && if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP &&
wind->shell_surface.xdg.popup.xdg_positioner && wind->shell_surface.xdg.popup.xdg_positioner &&
xdg_popup_get_version(wind->shell_surface.xdg.popup.xdg_popup) >= XDG_POPUP_REPOSITION_SINCE_VERSION) { xdg_popup_get_version(wind->shell_surface.xdg.popup.xdg_popup) >= XDG_POPUP_REPOSITION_SINCE_VERSION) {
int x = use_current_position ? window->x : window->floating.x; int x = use_current_position ? window->x : window->floating.x;
@@ -424,7 +424,7 @@ static bool ConfigureWindowGeometry(SDL_Window *window)
* aren't supported to avoid a potential protocol violation if a buffer * aren't supported to avoid a potential protocol violation if a buffer
* with an old size is committed. * with an old size is committed.
*/ */
if (!data->viewport && data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL && data->shell_surface.xdg.surface) { if (!data->viewport && data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL && data->shell_surface.xdg.surface) {
xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, data->current.logical_width, data->current.logical_height); xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, data->current.logical_width, data->current.logical_height);
} }
@@ -455,7 +455,7 @@ static bool ConfigureWindowGeometry(SDL_Window *window)
* *
* The occlusion state is immediately set again afterward, if necessary. * The occlusion state is immediately set again afterward, if necessary.
*/ */
if (data->surface_status == WAYLAND_SURFACE_STATUS_SHOWN) { if (data->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_SHOWN) {
if ((buffer_size_changed || window_size_changed) || if ((buffer_size_changed || window_size_changed) ||
(!data->suspended && (window->flags & SDL_WINDOW_OCCLUDED))) { (!data->suspended && (window->flags & SDL_WINDOW_OCCLUDED))) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
@@ -474,7 +474,7 @@ static void CommitLibdecorFrame(SDL_Window *window)
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
SDL_WindowData *wind = window->internal; SDL_WindowData *wind = window->internal;
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR && wind->shell_surface.libdecor.frame) {
struct libdecor_state *state = libdecor_state_new(wind->current.logical_width, wind->current.logical_height); struct libdecor_state *state = libdecor_state_new(wind->current.logical_width, wind->current.logical_height);
libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL); libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL);
libdecor_state_free(state); libdecor_state_free(state);
@@ -566,7 +566,7 @@ static void Wayland_move_window(SDL_Window *window)
if (wind->last_displayID != displays[i]) { if (wind->last_displayID != displays[i]) {
wind->last_displayID = displays[i]; wind->last_displayID = displays[i];
if (wind->shell_surface_type != WAYLAND_SURFACE_XDG_POPUP) { if (wind->shell_surface_type != WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, display->x, display->y); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, display->x, display->y);
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_DISPLAY_CHANGED, wind->last_displayID, 0); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_DISPLAY_CHANGED, wind->last_displayID, 0);
} }
@@ -584,7 +584,7 @@ static void SetFullscreen(SDL_Window *window, struct wl_output *output)
SDL_VideoData *viddata = wind->waylandData; SDL_VideoData *viddata = wind->waylandData;
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (!wind->shell_surface.libdecor.frame) { if (!wind->shell_surface.libdecor.frame) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -601,7 +601,7 @@ static void SetFullscreen(SDL_Window *window, struct wl_output *output)
} }
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) { if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -681,12 +681,12 @@ static void surface_frame_done(void *data, struct wl_callback *cb, uint32_t time
wind->drop_interactive_resizes = false; wind->drop_interactive_resizes = false;
if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME) { if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME) {
wind->surface_status = WAYLAND_SURFACE_STATUS_SHOWN; wind->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_SHOWN;
// If any child windows are waiting on this window to be shown, show them now // If any child windows are waiting on this window to be shown, show them now
for (SDL_Window *w = wind->sdlwindow->first_child; w; w = w->next_sibling) { for (SDL_Window *w = wind->sdlwindow->first_child; w; w = w->next_sibling) {
if (w->internal->surface_status == WAYLAND_SURFACE_STATUS_SHOW_PENDING) { if (w->internal->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_SHOW_PENDING) {
Wayland_ShowWindow(SDL_GetVideoDevice(), w); Wayland_ShowWindow(SDL_GetVideoDevice(), w);
} else if (w->internal->reparenting_required) { } else if (w->internal->reparenting_required) {
Wayland_SetWindowParent(SDL_GetVideoDevice(), w, w->parent); Wayland_SetWindowParent(SDL_GetVideoDevice(), w, w->parent);
@@ -953,8 +953,8 @@ static void handle_configure_xdg_toplevel(void *data,
window->tiled = tiled; window->tiled = tiled;
wind->resizing = resizing; wind->resizing = resizing;
if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE) { if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
wind->surface_status = WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME; wind->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME;
} }
} }
@@ -1034,8 +1034,8 @@ static void handle_configure_xdg_popup(void *data,
SDL_SendWindowEvent(wind->sdlwindow, SDL_EVENT_WINDOW_MOVED, x, y); SDL_SendWindowEvent(wind->sdlwindow, SDL_EVENT_WINDOW_MOVED, x, y);
if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE) { if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
wind->surface_status = WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME; wind->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME;
} }
} }
@@ -1084,7 +1084,7 @@ static void handle_configure_zxdg_decoration(void *data,
Wayland_HideWindow(device, window); Wayland_HideWindow(device, window);
SDL_zero(internal->shell_surface); SDL_zero(internal->shell_surface);
internal->shell_surface_type = WAYLAND_SURFACE_LIBDECOR; internal->shell_surface_type = WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR;
Wayland_ShowWindow(device, window); Wayland_ShowWindow(device, window);
} }
@@ -1372,8 +1372,8 @@ static void decoration_frame_configure(struct libdecor_frame *frame,
LibdecorGetMinContentSize(frame, &wind->system_limits.min_width, &wind->system_limits.min_height); LibdecorGetMinContentSize(frame, &wind->system_limits.min_width, &wind->system_limits.min_height);
wind->shell_surface.libdecor.initial_configure_seen = true; wind->shell_surface.libdecor.initial_configure_seen = true;
} }
if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE) { if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
wind->surface_status = WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME; wind->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME;
} }
/* Update the resize capability if this config event was the result of the /* Update the resize capability if this config event was the result of the
@@ -1399,7 +1399,7 @@ static void decoration_frame_commit(struct libdecor_frame *frame, void *user_dat
* commit a frame to trigger an update of the decoration surfaces. * commit a frame to trigger an update of the decoration surfaces.
*/ */
SDL_WindowData *wind = (SDL_WindowData *)user_data; SDL_WindowData *wind = (SDL_WindowData *)user_data;
if (!wind->suspended && wind->surface_status == WAYLAND_SURFACE_STATUS_SHOWN) { if (!wind->suspended && wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_SHOWN) {
SDL_SendWindowEvent(wind->sdlwindow, SDL_EVENT_WINDOW_EXPOSED, 0, 0); SDL_SendWindowEvent(wind->sdlwindow, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
} }
} }
@@ -1637,11 +1637,11 @@ static struct xdg_toplevel *GetToplevelForWindow(SDL_WindowData *wind)
* internally anyways). * internally anyways).
*/ */
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR && wind->shell_surface.libdecor.frame) {
return libdecor_frame_get_xdg_toplevel(wind->shell_surface.libdecor.frame); return libdecor_frame_get_xdg_toplevel(wind->shell_surface.libdecor.frame);
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL && wind->shell_surface.xdg.toplevel.xdg_toplevel) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL && wind->shell_surface.xdg.toplevel.xdg_toplevel) {
return wind->shell_surface.xdg.toplevel.xdg_toplevel; return wind->shell_surface.xdg.toplevel.xdg_toplevel;
} }
} }
@@ -1656,7 +1656,7 @@ bool Wayland_SetWindowParent(SDL_VideoDevice *_this, SDL_Window *window, SDL_Win
child_data->reparenting_required = false; child_data->reparenting_required = false;
if (parent_data && parent_data->surface_status != WAYLAND_SURFACE_STATUS_SHOWN) { if (parent_data && parent_data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_SHOWN) {
// Need to wait for the parent to become mapped, or it's the same as setting a null parent. // Need to wait for the parent to become mapped, or it's the same as setting a null parent.
child_data->reparenting_required = true; child_data->reparenting_required = true;
return true; return true;
@@ -1678,7 +1678,7 @@ bool Wayland_SetWindowModal(SDL_VideoDevice *_this, SDL_Window *window, bool mod
SDL_WindowData *data = window->internal; SDL_WindowData *data = window->internal;
SDL_WindowData *parent_data = window->parent->internal; SDL_WindowData *parent_data = window->parent->internal;
if (parent_data->surface_status != WAYLAND_SURFACE_STATUS_SHOWN) { if (parent_data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_SHOWN) {
// Need to wait for the parent to become mapped before changing modal status. // Need to wait for the parent to become mapped before changing modal status.
data->reparenting_required = true; data->reparenting_required = true;
return true; return true;
@@ -1742,7 +1742,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
// Custom surfaces don't get toplevels and are always considered 'shown'; nothing to do here. // Custom surfaces don't get toplevels and are always considered 'shown'; nothing to do here.
if (data->shell_surface_type == WAYLAND_SURFACE_CUSTOM) { if (data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_CUSTOM) {
return; return;
} }
@@ -1755,8 +1755,8 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
* be shown when the parent is in the shown state. * be shown when the parent is in the shown state.
*/ */
if (window->parent) { if (window->parent) {
if (window->parent->internal->surface_status != WAYLAND_SURFACE_STATUS_SHOWN) { if (window->parent->internal->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_SHOWN) {
data->surface_status = WAYLAND_SURFACE_STATUS_SHOW_PENDING; data->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_SHOW_PENDING;
return; return;
} }
} }
@@ -1768,7 +1768,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
WAYLAND_wl_display_roundtrip(c->display); WAYLAND_wl_display_roundtrip(c->display);
} }
data->surface_status = WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE; data->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE;
/* Detach any previous buffers before resetting everything, otherwise when /* Detach any previous buffers before resetting everything, otherwise when
* calling this a second time you'll get an annoying protocol error! * calling this a second time you'll get an annoying protocol error!
@@ -1789,7 +1789,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
// Create the shell surface and map the toplevel/popup // Create the shell surface and map the toplevel/popup
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
data->shell_surface.libdecor.frame = libdecor_decorate(c->shell.libdecor, data->shell_surface.libdecor.frame = libdecor_decorate(c->shell.libdecor,
data->surface, data->surface,
&libdecor_frame_interface, &libdecor_frame_interface,
@@ -1816,13 +1816,13 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
} else } else
#endif #endif
if (data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL || data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { if (data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL || data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP) {
data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface); data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface);
xdg_surface_set_user_data(data->shell_surface.xdg.surface, data); xdg_surface_set_user_data(data->shell_surface.xdg.surface, data);
xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data); xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data);
SDL_SetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER, data->shell_surface.xdg.surface); SDL_SetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER, data->shell_surface.xdg.surface);
if (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { if (data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP) {
SDL_Window *parent = window->parent; SDL_Window *parent = window->parent;
SDL_WindowData *parent_data = parent->internal; SDL_WindowData *parent_data = parent->internal;
struct xdg_surface *parent_xdg_surface = NULL; struct xdg_surface *parent_xdg_surface = NULL;
@@ -1830,12 +1830,12 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
// Configure the popup parameters // Configure the popup parameters
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (parent_data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (parent_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
parent_xdg_surface = libdecor_frame_get_xdg_surface(parent_data->shell_surface.libdecor.frame); parent_xdg_surface = libdecor_frame_get_xdg_surface(parent_data->shell_surface.libdecor.frame);
} else } else
#endif #endif
if (parent_data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL || if (parent_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL ||
parent_data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { parent_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP) {
parent_xdg_surface = parent_data->shell_surface.xdg.surface; parent_xdg_surface = parent_data->shell_surface.xdg.surface;
} }
@@ -1914,7 +1914,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
* this surface will fail. This is a new rule for xdg_shell. * this surface will fail. This is a new rule for xdg_shell.
*/ */
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (data->shell_surface.libdecor.frame) { if (data->shell_surface.libdecor.frame) {
while (!data->shell_surface.libdecor.initial_configure_seen) { while (!data->shell_surface.libdecor.initial_configure_seen) {
WAYLAND_wl_display_flush(c->display); WAYLAND_wl_display_flush(c->display);
@@ -1923,7 +1923,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
} else } else
#endif #endif
if (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP || data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP || data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
/* Unlike libdecor we need to call this explicitly to prevent a deadlock. /* Unlike libdecor we need to call this explicitly to prevent a deadlock.
* libdecor will call this as part of their configure event! * libdecor will call this as part of their configure event!
* -flibit * -flibit
@@ -1937,7 +1937,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
// Create the window decorations // Create the window decorations
if (data->shell_surface_type != WAYLAND_SURFACE_XDG_POPUP && data->shell_surface.xdg.toplevel.xdg_toplevel && c->decoration_manager) { if (data->shell_surface_type != WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP && data->shell_surface.xdg.toplevel.xdg_toplevel && c->decoration_manager) {
data->server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(c->decoration_manager, data->shell_surface.xdg.toplevel.xdg_toplevel); data->server_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(c->decoration_manager, data->shell_surface.xdg.toplevel.xdg_toplevel);
zxdg_toplevel_decoration_v1_add_listener(data->server_decoration, zxdg_toplevel_decoration_v1_add_listener(data->server_decoration,
&decoration_listener, &decoration_listener,
@@ -1957,7 +1957,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
* them immediately afterward. * them immediately afterward.
*/ */
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
// Libdecor plugins can enforce minimum window sizes, so adjust if the initial window size is too small. // Libdecor plugins can enforce minimum window sizes, so adjust if the initial window size is too small.
if (window->windowed.w < data->system_limits.min_width || if (window->windowed.w < data->system_limits.min_width ||
window->windowed.h < data->system_limits.min_height) { window->windowed.h < data->system_limits.min_height) {
@@ -1997,7 +1997,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
wl_callback_add_listener(cb, &show_hide_sync_listener, (void*)((uintptr_t)window->id)); wl_callback_add_listener(cb, &show_hide_sync_listener, (void*)((uintptr_t)window->id));
// Send an exposure event to signal that the client should draw. // Send an exposure event to signal that the client should draw.
if (data->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME) { if (data->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
} }
} }
@@ -2050,7 +2050,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_PropertiesID props = SDL_GetWindowProperties(window); SDL_PropertiesID props = SDL_GetWindowProperties(window);
// Custom surfaces have nothing to destroy and are always considered to be 'shown'; nothing to do here. // Custom surfaces have nothing to destroy and are always considered to be 'shown'; nothing to do here.
if (wind->shell_surface_type == WAYLAND_SURFACE_CUSTOM) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_CUSTOM) {
return; return;
} }
@@ -2061,7 +2061,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
WAYLAND_wl_display_roundtrip(data->display); WAYLAND_wl_display_roundtrip(data->display);
} }
wind->surface_status = WAYLAND_SURFACE_STATUS_HIDDEN; wind->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_HIDDEN;
if (wind->server_decoration) { if (wind->server_decoration) {
zxdg_toplevel_decoration_v1_destroy(wind->server_decoration); zxdg_toplevel_decoration_v1_destroy(wind->server_decoration);
@@ -2069,7 +2069,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
// Be sure to detach after this is done, otherwise ShowWindow crashes! // Be sure to detach after this is done, otherwise ShowWindow crashes!
if (wind->shell_surface_type != WAYLAND_SURFACE_XDG_POPUP) { if (wind->shell_surface_type != WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP) {
wl_surface_attach(wind->surface, NULL, 0, 0); wl_surface_attach(wind->surface, NULL, 0, 0);
wl_surface_commit(wind->surface); wl_surface_commit(wind->surface);
} }
@@ -2088,7 +2088,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (wind->shell_surface.libdecor.frame) { if (wind->shell_surface.libdecor.frame) {
libdecor_frame_unref(wind->shell_surface.libdecor.frame); libdecor_frame_unref(wind->shell_surface.libdecor.frame);
wind->shell_surface.libdecor.frame = NULL; wind->shell_surface.libdecor.frame = NULL;
@@ -2098,7 +2098,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP) {
Wayland_ReleasePopup(_this, window); Wayland_ReleasePopup(_this, window);
} else if (wind->shell_surface.xdg.toplevel.xdg_toplevel) { } else if (wind->shell_surface.xdg.toplevel.xdg_toplevel) {
xdg_toplevel_destroy(wind->shell_surface.xdg.toplevel.xdg_toplevel); xdg_toplevel_destroy(wind->shell_surface.xdg.toplevel.xdg_toplevel);
@@ -2210,7 +2210,7 @@ SDL_FullscreenResult Wayland_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Win
struct wl_output *output = display->internal->output; struct wl_output *output = display->internal->output;
// Custom surfaces have no toplevel to make fullscreen. // Custom surfaces have no toplevel to make fullscreen.
if (wind->shell_surface_type == WAYLAND_SURFACE_CUSTOM) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_CUSTOM) {
return SDL_FULLSCREEN_FAILED; return SDL_FULLSCREEN_FAILED;
} }
@@ -2269,7 +2269,7 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_WindowData *wind = window->internal; SDL_WindowData *wind = window->internal;
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (!wind->shell_surface.libdecor.frame) { if (!wind->shell_surface.libdecor.frame) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -2277,7 +2277,7 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
} else } else
#endif #endif
// Note that xdg-shell does NOT provide a way to unset minimize! // Note that xdg-shell does NOT provide a way to unset minimize!
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) { if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -2291,13 +2291,13 @@ void Wayland_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, bool
const SDL_VideoData *viddata = (const SDL_VideoData *)_this->internal; const SDL_VideoData *viddata = (const SDL_VideoData *)_this->internal;
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (wind->shell_surface.libdecor.frame) { if (wind->shell_surface.libdecor.frame) {
libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, bordered); libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, bordered);
} }
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if ((viddata->decoration_manager) && (wind->server_decoration)) { if ((viddata->decoration_manager) && (wind->server_decoration)) {
const enum zxdg_toplevel_decoration_v1_mode mode = bordered ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE : ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; const enum zxdg_toplevel_decoration_v1_mode mode = bordered ? ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE : ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
zxdg_toplevel_decoration_v1_set_mode(wind->server_decoration, mode); zxdg_toplevel_decoration_v1_set_mode(wind->server_decoration, mode);
@@ -2310,7 +2310,7 @@ void Wayland_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
const SDL_WindowData *wind = window->internal; const SDL_WindowData *wind = window->internal;
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (!wind->shell_surface.libdecor.frame) { if (!wind->shell_surface.libdecor.frame) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -2341,7 +2341,7 @@ void Wayland_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (!wind->shell_surface.libdecor.frame) { if (!wind->shell_surface.libdecor.frame) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -2351,7 +2351,7 @@ void Wayland_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
libdecor_frame_set_maximized(wind->shell_surface.libdecor.frame); libdecor_frame_set_maximized(wind->shell_surface.libdecor.frame);
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) { if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -2375,7 +2375,7 @@ void Wayland_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
} }
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (!wind->shell_surface.libdecor.frame) { if (!wind->shell_surface.libdecor.frame) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -2383,7 +2383,7 @@ void Wayland_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MINIMIZED, 0, 0);
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) { if (wind->shell_surface.xdg.toplevel.xdg_toplevel == NULL) {
return; // Can't do anything yet, wait for ShowWindow return; // Can't do anything yet, wait for ShowWindow
} }
@@ -2594,20 +2594,20 @@ bool Wayland_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Proper
if (!custom_surface_role) { if (!custom_surface_role) {
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (c->shell.libdecor && !SDL_WINDOW_IS_POPUP(window)) { if (c->shell.libdecor && !SDL_WINDOW_IS_POPUP(window)) {
data->shell_surface_type = WAYLAND_SURFACE_LIBDECOR; data->shell_surface_type = WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR;
} else } else
#endif #endif
if (c->shell.xdg) { if (c->shell.xdg) {
if (SDL_WINDOW_IS_POPUP(window)) { if (SDL_WINDOW_IS_POPUP(window)) {
data->shell_surface_type = WAYLAND_SURFACE_XDG_POPUP; data->shell_surface_type = WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP;
} else { } else {
data->shell_surface_type = WAYLAND_SURFACE_XDG_TOPLEVEL; data->shell_surface_type = WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL;
} }
} // All other cases will be WAYLAND_SURFACE_UNKNOWN } // All other cases will be WAYLAND_SURFACE_UNKNOWN
} else { } else {
// Roleless and external surfaces are always considered to be in the shown state by the backend. // Roleless and external surfaces are always considered to be in the shown state by the backend.
data->shell_surface_type = WAYLAND_SURFACE_CUSTOM; data->shell_surface_type = WAYLAND_SHELL_SURFACE_TYPE_CUSTOM;
data->surface_status = WAYLAND_SURFACE_STATUS_SHOWN; data->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_SHOWN;
} }
if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, false)) { if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, false)) {
@@ -2641,7 +2641,7 @@ bool Wayland_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
SDL_WindowData *wind = window->internal; SDL_WindowData *wind = window->internal;
// Only popup windows can be positioned relative to the parent. // Only popup windows can be positioned relative to the parent.
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP) {
if (wind->shell_surface.xdg.popup.xdg_popup && if (wind->shell_surface.xdg.popup.xdg_popup &&
xdg_popup_get_version(wind->shell_surface.xdg.popup.xdg_popup) < XDG_POPUP_REPOSITION_SINCE_VERSION) { xdg_popup_get_version(wind->shell_surface.xdg.popup.xdg_popup) < XDG_POPUP_REPOSITION_SINCE_VERSION) {
return SDL_Unsupported(); return SDL_Unsupported();
@@ -2649,7 +2649,7 @@ bool Wayland_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
RepositionPopup(window, false); RepositionPopup(window, false);
return true; return true;
} else if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR || wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { } else if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR || wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
const int x = window->floating.x; const int x = window->floating.x;
const int y = window->floating.y; const int y = window->floating.y;
@@ -2700,7 +2700,7 @@ void Wayland_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
FlushPendingEvents(window); FlushPendingEvents(window);
if (!(window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED)) || if (!(window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED)) ||
wind->shell_surface_type == WAYLAND_SURFACE_CUSTOM) { wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_CUSTOM) {
if (!wind->scale_to_display) { if (!wind->scale_to_display) {
wind->requested.logical_width = window->floating.w; wind->requested.logical_width = window->floating.w;
wind->requested.logical_height = window->floating.h; wind->requested.logical_height = window->floating.h;
@@ -2770,11 +2770,11 @@ void Wayland_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
const char *title = window->title ? window->title : ""; const char *title = window->title ? window->title : "";
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR && wind->shell_surface.libdecor.frame) {
libdecor_frame_set_title(wind->shell_surface.libdecor.frame, title); libdecor_frame_set_title(wind->shell_surface.libdecor.frame, title);
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL && wind->shell_surface.xdg.toplevel.xdg_toplevel) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL && wind->shell_surface.xdg.toplevel.xdg_toplevel) {
xdg_toplevel_set_title(wind->shell_surface.xdg.toplevel.xdg_toplevel, title); xdg_toplevel_set_title(wind->shell_surface.xdg.toplevel.xdg_toplevel, title);
} }
} }
@@ -2809,11 +2809,11 @@ bool Wayland_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surfa
xdg_toplevel_icon_v1_add_buffer(wind->xdg_toplevel_icon_v1, wind->icon.wl_buffer, 1); xdg_toplevel_icon_v1_add_buffer(wind->xdg_toplevel_icon_v1, wind->icon.wl_buffer, 1);
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR && wind->shell_surface.libdecor.frame) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR && wind->shell_surface.libdecor.frame) {
toplevel = libdecor_frame_get_xdg_toplevel(wind->shell_surface.libdecor.frame); toplevel = libdecor_frame_get_xdg_toplevel(wind->shell_surface.libdecor.frame);
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL && wind->shell_surface.xdg.toplevel.xdg_toplevel) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL && wind->shell_surface.xdg.toplevel.xdg_toplevel) {
toplevel = wind->shell_surface.xdg.toplevel.xdg_toplevel; toplevel = wind->shell_surface.xdg.toplevel.xdg_toplevel;
} }
@@ -2845,13 +2845,13 @@ void Wayland_ShowWindowSystemMenu(SDL_Window *window, int x, int y)
} }
#ifdef HAVE_LIBDECOR_H #ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (wind->shell_surface.libdecor.frame) { if (wind->shell_surface.libdecor.frame) {
libdecor_frame_show_window_menu(wind->shell_surface.libdecor.frame, wind->waylandData->input->seat, wind->waylandData->input->last_implicit_grab_serial, x, y); libdecor_frame_show_window_menu(wind->shell_surface.libdecor.frame, wind->waylandData->input->seat, wind->waylandData->input->last_implicit_grab_serial, x, y);
} }
} else } else
#endif #endif
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL) { if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL) {
if (wind->shell_surface.xdg.toplevel.xdg_toplevel) { if (wind->shell_surface.xdg.toplevel.xdg_toplevel) {
xdg_toplevel_show_window_menu(wind->shell_surface.xdg.toplevel.xdg_toplevel, wind->waylandData->input->seat, wind->waylandData->input->last_implicit_grab_serial, x, y); xdg_toplevel_show_window_menu(wind->shell_surface.xdg.toplevel.xdg_toplevel, wind->waylandData->input->seat, wind->waylandData->input->last_implicit_grab_serial, x, y);
} }

View File

@@ -71,20 +71,20 @@ struct SDL_WindowData
} shell_surface; } shell_surface;
enum enum
{ {
WAYLAND_SURFACE_UNKNOWN = 0, WAYLAND_SHELL_SURFACE_TYPE_UNKNOWN = 0,
WAYLAND_SURFACE_XDG_TOPLEVEL, WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL,
WAYLAND_SURFACE_XDG_POPUP, WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP,
WAYLAND_SURFACE_LIBDECOR, WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR,
WAYLAND_SURFACE_CUSTOM WAYLAND_SHELL_SURFACE_TYPE_CUSTOM
} shell_surface_type; } shell_surface_type;
enum enum
{ {
WAYLAND_SURFACE_STATUS_HIDDEN = 0, WAYLAND_SHELL_SURFACE_STATUS_HIDDEN = 0,
WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE, WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE,
WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME, WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME,
WAYLAND_SURFACE_STATUS_SHOW_PENDING, WAYLAND_SHELL_SURFACE_STATUS_SHOW_PENDING,
WAYLAND_SURFACE_STATUS_SHOWN WAYLAND_SHELL_SURFACE_STATUS_SHOWN
} surface_status; } shell_surface_status;
enum enum
{ {
WAYLAND_WM_CAPS_WINDOW_MENU = 0x01, WAYLAND_WM_CAPS_WINDOW_MENU = 0x01,