opt: change unsigned int to uint32_t

This commit is contained in:
DreamMaoMao 2025-12-02 16:57:24 +08:00
parent 9196e2a50b
commit b9952f03b5
20 changed files with 314 additions and 329 deletions

View file

@ -1,4 +1,4 @@
void client_actual_size(Client *c, unsigned int *width, unsigned int *height) {
void client_actual_size(Client *c, uint32_t *width, uint32_t *height) {
*width = c->animation.current.width - c->bw;
*height = c->animation.current.height - c->bw;
@ -183,8 +183,8 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
if (buffer_data->should_scale) {
unsigned int surface_width = surface->current.width;
unsigned int surface_height = surface->current.height;
uint32_t surface_width = surface->current.width;
uint32_t surface_height = surface->current.height;
surface_width = buffer_data->width_scale < 1
? surface_width
@ -270,7 +270,7 @@ void client_draw_shadow(Client *c) {
? CORNER_LOCATION_NONE
: CORNER_LOCATION_ALL;
unsigned int bwoffset = c->bw != 0 && hit_no_border ? c->bw : 0;
uint32_t bwoffset = c->bw != 0 && hit_no_border ? c->bw : 0;
uint32_t width, height;
client_actual_size(c, &width, &height);
@ -546,7 +546,7 @@ void client_apply_clip(Client *c, float factor) {
}
// 获取窗口动画实时位置矩形
unsigned int width, height;
uint32_t width, height;
client_actual_size(c, &width, &height);
// 计算出除了边框的窗口实际剪切大小
@ -630,17 +630,16 @@ void fadeout_client_animation_next_tick(Client *c) {
int type = c->animation.action = c->animation.action;
double factor = find_animation_curve_at(animation_passed, type);
unsigned int width =
c->animation.initial.width +
(c->current.width - c->animation.initial.width) * factor;
unsigned int height =
uint32_t width = c->animation.initial.width +
(c->current.width - c->animation.initial.width) * factor;
uint32_t height =
c->animation.initial.height +
(c->current.height - c->animation.initial.height) * factor;
unsigned int x = c->animation.initial.x +
(c->current.x - c->animation.initial.x) * factor;
unsigned int y = c->animation.initial.y +
(c->current.y - c->animation.initial.y) * factor;
uint32_t x = c->animation.initial.x +
(c->current.x - c->animation.initial.x) * factor;
uint32_t y = c->animation.initial.y +
(c->current.y - c->animation.initial.y) * factor;
wlr_scene_node_set_position(&c->scene->node, x, y);
@ -696,17 +695,16 @@ void client_animation_next_tick(Client *c) {
double sx = 0, sy = 0;
struct wlr_surface *surface = NULL;
unsigned int width =
c->animation.initial.width +
(c->current.width - c->animation.initial.width) * factor;
unsigned int height =
uint32_t width = c->animation.initial.width +
(c->current.width - c->animation.initial.width) * factor;
uint32_t height =
c->animation.initial.height +
(c->current.height - c->animation.initial.height) * factor;
unsigned int x = c->animation.initial.x +
(c->current.x - c->animation.initial.x) * factor;
unsigned int y = c->animation.initial.y +
(c->current.y - c->animation.initial.y) * factor;
uint32_t x = c->animation.initial.x +
(c->current.x - c->animation.initial.x) * factor;
uint32_t y = c->animation.initial.y +
(c->current.y - c->animation.initial.y) * factor;
wlr_scene_node_set_position(&c->scene->node, x, y);
c->animation.current = (struct wlr_box){

View file

@ -33,33 +33,33 @@ void init_baked_points(void) {
baked_points_focus =
calloc(BAKED_POINTS_COUNT, sizeof(*baked_points_focus));
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
baked_points_move[i] = calculate_animation_curve_at(
(double)i / (BAKED_POINTS_COUNT - 1), MOVE);
}
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
baked_points_open[i] = calculate_animation_curve_at(
(double)i / (BAKED_POINTS_COUNT - 1), OPEN);
}
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
baked_points_tag[i] = calculate_animation_curve_at(
(double)i / (BAKED_POINTS_COUNT - 1), TAG);
}
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
baked_points_close[i] = calculate_animation_curve_at(
(double)i / (BAKED_POINTS_COUNT - 1), CLOSE);
}
for (unsigned int i = 0; i < BAKED_POINTS_COUNT; i++) {
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
baked_points_focus[i] = calculate_animation_curve_at(
(double)i / (BAKED_POINTS_COUNT - 1), FOCUS);
}
}
double find_animation_curve_at(double t, int type) {
unsigned int down = 0;
unsigned int up = BAKED_POINTS_COUNT - 1;
uint32_t down = 0;
uint32_t up = BAKED_POINTS_COUNT - 1;
unsigned int middle = (up + down) / 2;
uint32_t middle = (up + down) / 2;
struct dvec2 *baked_points;
if (type == MOVE) {
baked_points = baked_points_move;

View file

@ -1,5 +1,4 @@
void layer_actual_size(LayerSurface *l, unsigned int *width,
unsigned int *height) {
void layer_actual_size(LayerSurface *l, uint32_t *width, uint32_t *height) {
struct wlr_box box;
if (l->animation.running) {
@ -213,9 +212,8 @@ void layer_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
struct wlr_surface *surface = scene_surface->surface;
unsigned int surface_width =
surface->current.width * buffer_data->width_scale;
unsigned int surface_height =
uint32_t surface_width = surface->current.width * buffer_data->width_scale;
uint32_t surface_height =
surface->current.height * buffer_data->height_scale;
if (surface_height > 0 && surface_width > 0) {
@ -245,17 +243,16 @@ void fadeout_layer_animation_next_tick(LayerSurface *l) {
int type = l->animation.action = l->animation.action;
double factor = find_animation_curve_at(animation_passed, type);
unsigned int width =
l->animation.initial.width +
(l->current.width - l->animation.initial.width) * factor;
unsigned int height =
uint32_t width = l->animation.initial.width +
(l->current.width - l->animation.initial.width) * factor;
uint32_t height =
l->animation.initial.height +
(l->current.height - l->animation.initial.height) * factor;
unsigned int x = l->animation.initial.x +
(l->current.x - l->animation.initial.x) * factor;
unsigned int y = l->animation.initial.y +
(l->current.y - l->animation.initial.y) * factor;
uint32_t x = l->animation.initial.x +
(l->current.x - l->animation.initial.x) * factor;
uint32_t y = l->animation.initial.y +
(l->current.y - l->animation.initial.y) * factor;
wlr_scene_node_set_position(&l->scene->node, x, y);
@ -310,17 +307,16 @@ void layer_animation_next_tick(LayerSurface *l) {
int type = l->animation.action == NONE ? MOVE : l->animation.action;
double factor = find_animation_curve_at(animation_passed, type);
unsigned int width =
l->animation.initial.width +
(l->current.width - l->animation.initial.width) * factor;
unsigned int height =
uint32_t width = l->animation.initial.width +
(l->current.width - l->animation.initial.width) * factor;
uint32_t height =
l->animation.initial.height +
(l->current.height - l->animation.initial.height) * factor;
unsigned int x = l->animation.initial.x +
(l->current.x - l->animation.initial.x) * factor;
unsigned int y = l->animation.initial.y +
(l->current.y - l->animation.initial.y) * factor;
uint32_t x = l->animation.initial.x +
(l->current.x - l->animation.initial.x) * factor;
uint32_t y = l->animation.initial.y +
(l->current.y - l->animation.initial.y) * factor;
double opacity = MIN(fadein_begin_opacity +
animation_passed * (1.0 - fadein_begin_opacity),