aboutsummaryrefslogtreecommitdiff
path: root/client.h
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-12-24 18:04:41 -0600
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-12-24 18:04:41 -0600
commitb39d270b9f6b6e6533524b3acbd565a540887506 (patch)
tree69b0f3ae6c2f01ca781e11705f0cdbaf4981fc70 /client.h
parent98c7adfb3dbd6fbcb9011ef155f0a015c3558092 (diff)
parent05f4e23c43aa0d6e8fb8673a3b0d71653dc6dbbd (diff)
Merge branch 'main' into wlroots-next
Diffstat (limited to 'client.h')
-rw-r--r--client.h46
1 files changed, 45 insertions, 1 deletions
diff --git a/client.h b/client.h
index dbf018f..5a45edc 100644
--- a/client.h
+++ b/client.h
@@ -141,7 +141,7 @@ client_set_bounds(Client *c, int32_t width, int32_t height)
return 0;
#endif
if (c->surface.xdg->client->shell->version >=
- XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION)
+ XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION && width >= 0 && height >= 0)
return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width, height);
return 0;
}
@@ -241,6 +241,47 @@ client_is_mapped(Client *c)
}
static inline int
+client_is_rendered_on_mon(Client *c, Monitor *m)
+{
+ /* This is needed for when you don't want to check formal assignment,
+ * but rather actual displaying of the pixels.
+ * Usually VISIBLEON suffices and is also faster. */
+ struct wlr_surface_output *s;
+ if (!c->scene->node.enabled)
+ return 0;
+ wl_list_for_each(s, &client_surface(c)->current_outputs, link)
+ if (s->output == m->wlr_output)
+ return 1;
+ 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)
{
#ifdef XWAYLAND
@@ -304,6 +345,9 @@ client_set_size(Client *c, uint32_t width, uint32_t height)
return 0;
}
#endif
+ if (width == c->surface.xdg->toplevel->current.width
+ && height ==c->surface.xdg->toplevel->current.height)
+ return 0;
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, width, height);
}