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

@@ -22,8 +22,9 @@ void set_size_per(Monitor *m, Client *c) {
}
}
void resize_tile_master_horizontal(Client *grabc, bool isdrag, int offsetx,
int offsety, uint32_t time, int type) {
void resize_tile_master_horizontal(Client *grabc, bool isdrag, int32_t offsetx,
int32_t offsety, uint32_t time,
int32_t type) {
Client *tc = NULL;
float delta_x, delta_y;
Client *next = NULL;
@@ -216,8 +217,8 @@ void resize_tile_master_horizontal(Client *grabc, bool isdrag, int offsetx,
}
}
void resize_tile_master_vertical(Client *grabc, bool isdrag, int offsetx,
int offsety, uint32_t time, int type) {
void resize_tile_master_vertical(Client *grabc, bool isdrag, int32_t offsetx,
int32_t offsety, uint32_t time, int32_t type) {
Client *tc = NULL;
float delta_x, delta_y;
Client *next = NULL;
@@ -373,8 +374,8 @@ void resize_tile_master_vertical(Client *grabc, bool isdrag, int offsetx,
}
}
void resize_tile_scroller(Client *grabc, bool isdrag, int offsetx, int offsety,
uint32_t time, bool isvertical) {
void resize_tile_scroller(Client *grabc, bool isdrag, int32_t offsetx,
int32_t offsety, uint32_t time, bool isvertical) {
float delta_x, delta_y;
float new_scroller_proportion;
@@ -477,8 +478,8 @@ void resize_tile_scroller(Client *grabc, bool isdrag, int offsetx, int offsety,
}
}
void resize_tile_client(Client *grabc, bool isdrag, int offsetx, int offsety,
uint32_t time) {
void resize_tile_client(Client *grabc, bool isdrag, int32_t offsetx,
int32_t offsety, uint32_t time) {
if (!grabc || grabc->isfullscreen || grabc->ismaximizescreen)
return;
@@ -506,14 +507,14 @@ void resize_tile_client(Client *grabc, bool isdrag, int offsetx, int offsety,
}
}
void reset_size_per_mon(Monitor *m, int tile_cilent_num,
void reset_size_per_mon(Monitor *m, int32_t tile_cilent_num,
double total_left_stack_hight_percent,
double total_right_stack_hight_percent,
double total_stack_hight_percent,
double total_master_inner_percent, int master_num,
int stack_num) {
double total_master_inner_percent, int32_t master_num,
int32_t stack_num) {
Client *c = NULL;
int i = 0;
int32_t i = 0;
uint32_t stack_index = 0;
uint32_t nmasters = m->pertag->nmasters[m->pertag->curtag];
@@ -587,11 +588,11 @@ arrange(Monitor *m, bool want_animation, bool from_view) {
double total_master_inner_percent = 0;
double total_right_stack_hight_percent = 0;
double total_left_stack_hight_percent = 0;
int i = 0;
int nmasters = 0;
int stack_index = 0;
int master_num = 0;
int stack_num = 0;
int32_t i = 0;
int32_t nmasters = 0;
int32_t stack_index = 0;
int32_t master_num = 0;
int32_t stack_num = 0;
if (!m)
return;

View File

@@ -6,8 +6,10 @@ void grid(Monitor *m) {
uint32_t cols, rows, overcols;
Client *c = NULL;
n = 0;
int target_gappo = enablegaps ? m->isoverview ? overviewgappo : gappoh : 0;
int target_gappi = enablegaps ? m->isoverview ? overviewgappi : gappih : 0;
int32_t target_gappo =
enablegaps ? m->isoverview ? overviewgappo : gappoh : 0;
int32_t target_gappi =
enablegaps ? m->isoverview ? overviewgappi : gappih : 0;
float single_width_ratio = m->isoverview ? 0.7 : 0.9;
float single_height_ratio = m->isoverview ? 0.8 : 0.9;
@@ -111,7 +113,7 @@ void grid(Monitor *m) {
void deck(Monitor *m) {
uint32_t mw, my;
int i, n = 0;
int32_t i, n = 0;
Client *c = NULL;
Client *fc = NULL;
float mfact;
@@ -218,7 +220,7 @@ void scroller(Monitor *m) {
Client *c = NULL, *root_client = NULL;
Client **tempClients = NULL; // 初始化为 NULL
struct wlr_box target_geom;
int focus_client_index = 0;
int32_t focus_client_index = 0;
bool need_scroller = false;
uint32_t cur_gappih = enablegaps ? m->gappih : 0;
uint32_t cur_gappoh = enablegaps ? m->gappoh : 0;
@@ -370,8 +372,8 @@ void center_tile(Monitor *m) {
Client *c = NULL;
Client *fc = NULL;
double mfact = 0;
int master_num = 0;
int stack_num = 0;
int32_t master_num = 0;
int32_t stack_num = 0;
n = m->visible_tiling_clients;
master_num = m->pertag->nmasters[m->pertag->curtag];
@@ -411,7 +413,7 @@ void center_tile(Monitor *m) {
tw = mw;
// 判断是否需要主区域铺满
int should_overspread = center_master_overspread && (n <= nmasters);
int32_t should_overspread = center_master_overspread && (n <= nmasters);
uint32_t master_surplus_height =
(m->w.height - 2 * cur_gappov - cur_gappiv * ie * (master_num - 1));
@@ -513,7 +515,7 @@ void center_tile(Monitor *m) {
c->master_mfact_per = mfact;
}
int stack_x;
int32_t stack_x;
if (center_when_single_stack) {
// 放在右侧master居中时stack在右边
stack_x = m->w.x + mx + mw + cur_gappih * ie;
@@ -553,7 +555,7 @@ void center_tile(Monitor *m) {
c->master_mfact_per = mfact;
}
int stack_x = m->w.x + mx + mw + cur_gappih * ie;
int32_t stack_x = m->w.x + mx + mw + cur_gappih * ie;
resize(c,
(struct wlr_box){.x = stack_x,
@@ -582,7 +584,7 @@ void center_tile(Monitor *m) {
c->master_mfact_per = mfact;
}
int stack_x = m->w.x + cur_gappoh;
int32_t stack_x = m->w.x + cur_gappoh;
resize(c,
(struct wlr_box){.x = stack_x,
.y = m->w.y + oty,
@@ -602,8 +604,8 @@ void tile(Monitor *m) {
Client *c = NULL;
Client *fc = NULL;
double mfact = 0;
int master_num = 0;
int stack_num = 0;
int32_t master_num = 0;
int32_t stack_num = 0;
n = m->visible_tiling_clients;
master_num = m->pertag->nmasters[m->pertag->curtag];
@@ -712,8 +714,8 @@ void right_tile(Monitor *m) {
Client *c = NULL;
Client *fc = NULL;
double mfact = 0;
int master_num = 0;
int stack_num = 0;
int32_t master_num = 0;
int32_t stack_num = 0;
n = m->visible_tiling_clients;
master_num = m->pertag->nmasters[m->pertag->curtag];

View File

@@ -3,8 +3,8 @@ void vertical_tile(Monitor *m) {
Client *c = NULL;
Client *fc = NULL;
double mfact = 0;
int master_num = 0;
int stack_num = 0;
int32_t master_num = 0;
int32_t stack_num = 0;
n = m->visible_tiling_clients;
master_num = m->pertag->nmasters[m->pertag->curtag];
@@ -106,7 +106,7 @@ void vertical_tile(Monitor *m) {
void vertical_deck(Monitor *m) {
uint32_t mh, mx;
int i, n = 0;
int32_t i, n = 0;
Client *c = NULL;
Client *fc = NULL;
float mfact;
@@ -207,7 +207,7 @@ void vertical_scroller(Monitor *m) {
Client *c = NULL, *root_client = NULL;
Client **tempClients = NULL;
struct wlr_box target_geom;
int focus_client_index = 0;
int32_t focus_client_index = 0;
bool need_scroller = false;
uint32_t cur_gappiv = enablegaps ? m->gappiv : 0;
uint32_t cur_gappov = enablegaps ? m->gappov : 0;
@@ -359,8 +359,10 @@ void vertical_grid(Monitor *m) {
uint32_t dy;
uint32_t rows, cols, overrows;
Client *c = NULL;
int target_gappo = enablegaps ? m->isoverview ? overviewgappo : gappov : 0;
int target_gappi = enablegaps ? m->isoverview ? overviewgappi : gappiv : 0;
int32_t target_gappo =
enablegaps ? m->isoverview ? overviewgappo : gappov : 0;
int32_t target_gappi =
enablegaps ? m->isoverview ? overviewgappi : gappiv : 0;
float single_width_ratio = m->isoverview ? 0.7 : 0.9;
float single_height_ratio = m->isoverview ? 0.8 : 0.9;