[client] wayland: marshal resize requests to the event-loop thread

setWindowSize is called from the render, frame and transport threads,
but shellResize issues shell requests and, with the libdecor GTK
plugin, renders the window decorations through pango, none of which is
thread safe. A frame thread exiting after such a call crashed in the
pango fontmap destructor during thread teardown.

Publish the requested size atomically and wake the event loop through
an eventfd registered in the epoll; the poll callback applies the size
on the event-loop thread. Concurrent requests coalesce into the most
recent one.
This commit is contained in:
Amit Mendapara
2026-08-11 18:11:03 +05:30
committed by Geoffrey McRae
parent 574e8edbae
commit c66a974f1d
3 changed files with 67 additions and 1 deletions

View File

@@ -119,6 +119,8 @@ static bool waylandInit(const LG_DSInitParams params)
atomic_init(&wlWm.cmCanDoHDR, false);
atomic_init(&wlWm.hdrPQWhiteLevel, 203);
atomic_init(&wlWm.hdrScRGBWhiteLevel, 80);
atomic_init(&wlWm.pendingResize, 0);
wlWm.resizeEventFd = -1;
wlWm.display = wl_display_connect(NULL);
if (!wlWm.display)
@@ -184,7 +186,10 @@ static bool waylandInit(const LG_DSInitParams params)
if (!waylandEGLInit(waylandScaleMulInt(wlWm.scale, width),
waylandScaleMulInt(wlWm.scale, height)))
{
waylandWindowFree();
return false;
}
app_handleResizeEvent(width, height, waylandScaleToDouble(wlWm.scale),
(struct Border) {0, 0, 0, 0});
@@ -193,7 +198,10 @@ static bool waylandInit(const LG_DSInitParams params)
#ifdef ENABLE_OPENGL
if (params.opengl && !waylandOpenGLInit())
{
waylandWindowFree();
return false;
}
#endif
return true;