From 36c209080cc3eae2cd81f63cebf22c0f40cec7a7 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Sun, 27 Oct 2024 15:56:35 -0400
Subject: [PATCH] wayland: Refactor some shell surface related names
---
src/video/wayland/SDL_waylandevents.c | 8 +-
src/video/wayland/SDL_waylandopengles.c | 6 +-
src/video/wayland/SDL_waylandwindow.c | 138 ++++++++++++------------
src/video/wayland/SDL_waylandwindow.h | 22 ++--
4 files changed, 87 insertions(+), 87 deletions(-)
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index f84aa40a587a3..1de96fbf2efcc 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -638,7 +638,7 @@ static bool ProcessHitTest(SDL_WindowData *window_data,
switch (window_data->hit_test_result) {
case SDL_HITTEST_DRAGGABLE:
#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) {
libdecor_frame_move(window_data->shell_surface.libdecor.frame,
seat,
@@ -646,7 +646,7 @@ static bool ProcessHitTest(SDL_WindowData *window_data,
}
} else
#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) {
xdg_toplevel_move(window_data->shell_surface.xdg.toplevel.xdg_toplevel,
seat,
@@ -664,7 +664,7 @@ static bool ProcessHitTest(SDL_WindowData *window_data,
case SDL_HITTEST_RESIZE_BOTTOMLEFT:
case SDL_HITTEST_RESIZE_LEFT:
#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) {
libdecor_frame_resize(window_data->shell_surface.libdecor.frame,
seat,
@@ -673,7 +673,7 @@ static bool ProcessHitTest(SDL_WindowData *window_data,
}
} else
#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) {
xdg_toplevel_resize(window_data->shell_surface.xdg.toplevel.xdg_toplevel,
seat,
diff --git a/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c
index 1e720e0e45c53..b2f320f5f99f4 100644
--- a/src/video/wayland/SDL_waylandopengles.c
+++ b/src/video/wayland/SDL_waylandopengles.c
@@ -115,8 +115,8 @@ bool Wayland_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
* FIXME: Request EGL_WAYLAND_swap_buffers_with_timeout.
* -flibit
*/
- if (data->surface_status != WAYLAND_SURFACE_STATUS_SHOWN &&
- data->surface_status != WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME) {
+ if (data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_SHOWN &&
+ data->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME) {
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
- 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;
struct wl_display *display = videodata->display;
// 20hz, so we'll progress even if throttled to zero.
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index ec8aa0a19a9e3..5beafb0a87092 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -176,7 +176,7 @@ static void SetMinMaxDimensions(SDL_Window *window)
}
#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) {
return; // Can't do anything yet, wait for ShowWindow
}
@@ -193,7 +193,7 @@ static void SetMinMaxDimensions(SDL_Window *window)
}
} else
#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) {
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
#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;
libdecor_frame_translate_coordinate(popup->parent->internal->shell_surface.libdecor.frame,
*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;
- 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 &&
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;
@@ -424,7 +424,7 @@ static bool ConfigureWindowGeometry(SDL_Window *window)
* aren't supported to avoid a potential protocol violation if a buffer
* 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);
}
@@ -455,7 +455,7 @@ static bool ConfigureWindowGeometry(SDL_Window *window)
*
* 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) ||
(!data->suspended && (window->flags & SDL_WINDOW_OCCLUDED))) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
@@ -474,7 +474,7 @@ static void CommitLibdecorFrame(SDL_Window *window)
#ifdef HAVE_LIBDECOR_H
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);
libdecor_frame_commit(wind->shell_surface.libdecor.frame, state, NULL);
libdecor_state_free(state);
@@ -566,7 +566,7 @@ static void Wayland_move_window(SDL_Window *window)
if (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_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;
#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) {
return; // Can't do anything yet, wait for ShowWindow
}
@@ -601,7 +601,7 @@ static void SetFullscreen(SDL_Window *window, struct wl_output *output)
}
} else
#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) {
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;
- if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME) {
- wind->surface_status = WAYLAND_SURFACE_STATUS_SHOWN;
+ if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME) {
+ wind->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_SHOWN;
// 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) {
- 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);
} else if (w->internal->reparenting_required) {
Wayland_SetWindowParent(SDL_GetVideoDevice(), w, w->parent);
@@ -953,8 +953,8 @@ static void handle_configure_xdg_toplevel(void *data,
window->tiled = tiled;
wind->resizing = resizing;
- if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
- wind->surface_status = WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME;
+ if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
+ 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);
- if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
- wind->surface_status = WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME;
+ if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
+ 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);
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);
}
@@ -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);
wind->shell_surface.libdecor.initial_configure_seen = true;
}
- if (wind->surface_status == WAYLAND_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
- wind->surface_status = WAYLAND_SURFACE_STATUS_WAITING_FOR_FRAME;
+ if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {
+ wind->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_FRAME;
}
/* 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.
*/
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);
}
}
@@ -1637,11 +1637,11 @@ static struct xdg_toplevel *GetToplevelForWindow(SDL_WindowData *wind)
* internally anyways).
*/
#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);
} else
#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;
}
}
@@ -1656,7 +1656,7 @@ bool Wayland_SetWindowParent(SDL_VideoDevice *_this, SDL_Window *window, SDL_Win
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.
child_data->reparenting_required = 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 *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.
data->reparenting_required = true;
return true;
@@ -1742,7 +1742,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_PropertiesID props = SDL_GetWindowProperties(window);
// 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;
}
@@ -1755,8 +1755,8 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
* be shown when the parent is in the shown state.
*/
if (window->parent) {
- if (window->parent->internal->surface_status != WAYLAND_SURFACE_STATUS_SHOWN) {
- data->surface_status = WAYLAND_SURFACE_STATUS_SHOW_PENDING;
+ if (window->parent->internal->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_SHOWN) {
+ data->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_SHOW_PENDING;
return;
}
}
@@ -1768,7 +1768,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
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
* 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
#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->surface,
&libdecor_frame_interface,
@@ -1816,13 +1816,13 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
} else
#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);
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);
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_WindowData *parent_data = parent->internal;
struct xdg_surface *parent_xdg_surface = NULL;
@@ -1830,12 +1830,12 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
// Configure the popup parameters
#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);
} else
#endif
- if (parent_data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL ||
- parent_data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) {
+ if (parent_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_TOPLEVEL ||
+ parent_data->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_XDG_POPUP) {
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.
*/
#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) {
while (!data->shell_surface.libdecor.initial_configure_seen) {
WAYLAND_wl_display_flush(c->display);
@@ -1923,7 +1923,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
} else
#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.
* libdecor will call this as part of their configure event!
* -flibit
@@ -1937,7 +1937,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
// 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);
zxdg_toplevel_decoration_v1_add_listener(data->server_decoration,
&decoration_listener,
@@ -1957,7 +1957,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
* them immediately afterward.
*/
#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.
if (window->windowed.w < data->system_limits.min_width ||
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));
// 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);
}
}
@@ -2050,7 +2050,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_PropertiesID props = SDL_GetWindowProperties(window);
// 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;
}
@@ -2061,7 +2061,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
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) {
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!
- 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_commit(wind->surface);
}
@@ -2088,7 +2088,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
#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) {
libdecor_frame_unref(wind->shell_surface.libdecor.frame);
wind->shell_surface.libdecor.frame = NULL;
@@ -2098,7 +2098,7 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
} else
#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);
} else if (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;
// 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;
}
@@ -2269,7 +2269,7 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_WindowData *wind = window->internal;
#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) {
return; // Can't do anything yet, wait for ShowWindow
}
@@ -2277,7 +2277,7 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
} else
#endif
// 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) {
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;
#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) {
libdecor_frame_set_visibility(wind->shell_surface.libdecor.frame, bordered);
}
} else
#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)) {
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);
@@ -2310,7 +2310,7 @@ void Wayland_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool
#ifdef HAVE_LIBDECOR_H
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) {
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
- if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
+ if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (!wind->shell_surface.libdecor.frame) {
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);
} else
#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) {
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
- if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
+ if (wind->shell_surface_type == WAYLAND_SHELL_SURFACE_TYPE_LIBDECOR) {
if (!wind->shell_surface.libdecor.frame) {
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);
} else
#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) {
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) {
#ifdef HAVE_LIBDECOR_H
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
#endif
if (c->shell.xdg) {
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 {
- 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
} else {
// Roleless and external surfaces are always considered to be in the shown state by the backend.
- data->shell_surface_type = WAYLAND_SURFACE_CUSTOM;
- data->surface_status = WAYLAND_SURFACE_STATUS_SHOWN;
+ data->shell_surface_type = WAYLAND_SHELL_SURFACE_TYPE_CUSTOM;
+ data->shell_surface_status = WAYLAND_SHELL_SURFACE_STATUS_SHOWN;
}
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;
// 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 &&
xdg_popup_get_version(wind->shell_surface.xdg.popup.xdg_popup) < XDG_POPUP_REPOSITION_SINCE_VERSION) {
return SDL_Unsupported();
@@ -2649,7 +2649,7 @@ bool Wayland_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
RepositionPopup(window, false);
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 y = window->floating.y;
@@ -2700,7 +2700,7 @@ void Wayland_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
FlushPendingEvents(window);
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) {
wind->requested.logical_width = window->floating.w;
wind->requested.logical_height = window->floating.h;
@@ -2770,11 +2770,11 @@ void Way
(Patch may be truncated, please check the link at the top of this post.)