aboutsummaryrefslogtreecommitdiff
path: root/client.h
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-12-21 14:28:27 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-12-24 16:44:09 -0600
commit6ca011430a18980f12f7314cdeeff36051268a67 (patch)
tree460cdb3606acb99d33dfc8cc8c2f2201603d239a /client.h
parent7eaa01ac1f074511ae1013326172d51c6fdf8866 (diff)
do not skip frames if a client is stopped and have a pending resize
Diffstat (limited to 'client.h')
-rw-r--r--client.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/client.h b/client.h
index 064e093..295e8ff 100644
--- a/client.h
+++ b/client.h
@@ -256,6 +256,32 @@ client_is_rendered_on_mon(Client *c, Monitor *m)
}
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)
{
#ifdef XWAYLAND