From 6ca011430a18980f12f7314cdeeff36051268a67 Mon Sep 17 00:00:00 2001 From: Leonardo Hernández Hernández Date: Wed, 21 Dec 2022 14:28:27 -0600 Subject: do not skip frames if a client is stopped and have a pending resize --- client.h | 26 ++++++++++++++++++++++++++ dwl.c | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/client.h b/client.h index 064e093..295e8ff 100644 --- a/client.h +++ b/client.h @@ -255,6 +255,32 @@ client_is_rendered_on_mon(Client *c, Monitor *m) return 0; } +static inline int +client_is_stopped(Client *c) +{ + int pid; + siginfo_t in = {0}; +#ifdef XWAYLAND + if (client_is_x11(c)) + return 0; +#endif + + wl_client_get_credentials(c->surface.xdg->client->client, &pid, NULL, NULL); + if (waitid(P_PID, pid, &in, WNOHANG|WCONTINUED|WSTOPPED|WNOWAIT) < 0) { + /* This process is not our child process, while is very unluckely that + * it is stopped, in order to do not skip frames assume that it is. */ + if (errno == ECHILD) + return 1; + } else if (in.si_pid) { + if (in.si_code == CLD_STOPPED || in.si_code == CLD_TRAPPED) + return 1; + if (in.si_code == CLD_CONTINUED) + return 0; + } + + return 0; +} + static inline int client_is_unmanaged(Client *c) { diff --git a/dwl.c b/dwl.c index 8a21342..43603db 100644 --- a/dwl.c +++ b/dwl.c @@ -1836,7 +1836,7 @@ rendermon(struct wl_listener *listener, void *data) /* Render if no XDG clients have an outstanding resize and are visible on * this monitor. */ wl_list_for_each(c, &clients, link) - if (client_is_rendered_on_mon(c, m) && (!c->isfloating && c->resize)) + if (client_is_rendered_on_mon(c, m) && (!c->isfloating && c->resize) && !client_is_stopped(c)) goto skip; if (!wlr_scene_output_commit(m->scene_output)) return; -- cgit v1.2.3