opt: animations logic all use the int type

avoid the coordinates being forcibly limited to positive numbers
This commit is contained in:
DreamMaoMao
2026-01-03 09:37:34 +08:00
parent 0d13b1002e
commit 2771053ee6
21 changed files with 876 additions and 861 deletions

View File

@@ -6,7 +6,7 @@
*/
/* Leave these functions first; they're used in the others */
static inline int client_is_x11(Client *c) {
static inline int32_t client_is_x11(Client *c) {
#ifdef XWAYLAND
return c->type == X11;
#endif
@@ -21,14 +21,15 @@ static inline struct wlr_surface *client_surface(Client *c) {
return c->surface.xdg->surface;
}
static inline int toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc,
LayerSurface **pl) {
static inline int32_t toplevel_from_wlr_surface(struct wlr_surface *s,
Client **pc,
LayerSurface **pl) {
struct wlr_xdg_surface *xdg_surface, *tmp_xdg_surface;
struct wlr_surface *root_surface;
struct wlr_layer_surface_v1 *layer_surface;
Client *c = NULL;
LayerSurface *l = NULL;
int type = -1;
int32_t type = -1;
#ifdef XWAYLAND
struct wlr_xwayland_surface *xsurface;
#endif
@@ -88,7 +89,7 @@ end:
/* The others */
static inline void client_activate_surface(struct wlr_surface *s,
int activated) {
int32_t activated) {
struct wlr_xdg_toplevel *toplevel;
#ifdef XWAYLAND
struct wlr_xwayland_surface *xsurface;
@@ -113,7 +114,7 @@ static inline const char *client_get_appid(Client *c) {
: "broken";
}
static inline int client_get_pid(Client *c) {
static inline int32_t client_get_pid(Client *c) {
pid_t pid;
#ifdef XWAYLAND
if (client_is_x11(c))
@@ -169,7 +170,7 @@ static inline Client *client_get_parent(Client *c) {
return p;
}
static inline int client_has_children(Client *c) {
static inline int32_t client_has_children(Client *c) {
#ifdef XWAYLAND
if (client_is_x11(c))
return !wl_list_empty(&c->surface.xwayland->children);
@@ -189,7 +190,7 @@ static inline const char *client_get_title(Client *c) {
: "broken";
}
static inline int client_is_float_type(Client *c) {
static inline int32_t client_is_float_type(Client *c) {
struct wlr_xdg_toplevel *toplevel;
struct wlr_xdg_toplevel_state state;
@@ -229,12 +230,12 @@ static inline int client_is_float_type(Client *c) {
state.min_height == state.max_height));
}
static inline int client_is_rendered_on_mon(Client *c, Monitor *m) {
static inline int32_t 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;
int unused_lx, unused_ly;
int32_t unused_lx, unused_ly;
if (!wlr_scene_node_coords(&c->scene->node, &unused_lx, &unused_ly))
return 0;
wl_list_for_each(s, &client_surface(c)->current_outputs,
@@ -242,8 +243,8 @@ static inline int client_is_rendered_on_mon(Client *c, Monitor *m) {
return 0;
}
static inline int client_is_stopped(Client *c) {
int pid;
static inline int32_t client_is_stopped(Client *c) {
int32_t pid;
siginfo_t in = {0};
#ifdef XWAYLAND
if (client_is_x11(c))
@@ -267,7 +268,7 @@ static inline int client_is_stopped(Client *c) {
return 0;
}
static inline int client_is_unmanaged(Client *c) {
static inline int32_t client_is_unmanaged(Client *c) {
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->override_redirect;
@@ -299,7 +300,7 @@ static inline void client_set_border_color(Client *c,
wlr_scene_rect_set_color(c->border, color);
}
static inline void client_set_fullscreen(Client *c, int fullscreen) {
static inline void client_set_fullscreen(Client *c, int32_t fullscreen) {
#ifdef XWAYLAND
if (client_is_x11(c)) {
wlr_xwayland_surface_set_fullscreen(c->surface.xwayland, fullscreen);
@@ -379,7 +380,7 @@ static inline void client_set_tiled(Client *c, uint32_t edges) {
}
}
static inline void client_set_suspended(Client *c, int suspended) {
static inline void client_set_suspended(Client *c, int32_t suspended) {
#ifdef XWAYLAND
if (client_is_x11(c))
return;
@@ -388,7 +389,7 @@ static inline void client_set_suspended(Client *c, int suspended) {
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
}
static inline int client_should_ignore_focus(Client *c) {
static inline int32_t client_should_ignore_focus(Client *c) {
#ifdef XWAYLAND
if (client_is_x11(c)) {
@@ -403,7 +404,7 @@ static inline int client_should_ignore_focus(Client *c) {
return 0;
}
static inline int client_is_x11_popup(Client *c) {
static inline int32_t client_is_x11_popup(Client *c) {
#ifdef XWAYLAND
if (client_is_x11(c)) {
@@ -432,7 +433,7 @@ static inline int client_is_x11_popup(Client *c) {
return 0;
}
static inline int client_should_global(Client *c) {
static inline int32_t client_should_global(Client *c) {
#ifdef XWAYLAND
if (client_is_x11(c)) {
@@ -445,7 +446,7 @@ static inline int client_should_global(Client *c) {
return 0;
}
static inline int client_should_overtop(Client *c) {
static inline int32_t client_should_overtop(Client *c) {
#ifdef XWAYLAND
if (client_is_x11(c)) {
@@ -457,7 +458,7 @@ static inline int client_should_overtop(Client *c) {
return 0;
}
static inline int client_wants_focus(Client *c) {
static inline int32_t client_wants_focus(Client *c) {
#ifdef XWAYLAND
return client_is_unmanaged(c) &&
wlr_xwayland_surface_override_redirect_wants_focus(
@@ -468,7 +469,7 @@ static inline int client_wants_focus(Client *c) {
return 0;
}
static inline int client_wants_fullscreen(Client *c) {
static inline int32_t client_wants_fullscreen(Client *c) {
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->fullscreen;