mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-03 01:40:28 -05:00
opt: animations logic all use the int type
avoid the coordinates being forcibly limited to positive numbers
This commit is contained in:
parent
0d13b1002e
commit
2771053ee6
21 changed files with 876 additions and 861 deletions
|
|
@ -1,10 +1,10 @@
|
|||
void client_actual_size(Client *c, uint32_t *width, uint32_t *height) {
|
||||
*width = c->animation.current.width - 2 * c->bw;
|
||||
void client_actual_size(Client *c, int32_t *width, int32_t *height) {
|
||||
*width = c->animation.current.width - 2 * (int32_t)c->bw;
|
||||
|
||||
*height = c->animation.current.height - 2 * c->bw;
|
||||
*height = c->animation.current.height - 2 * (int32_t)c->bw;
|
||||
}
|
||||
|
||||
void set_rect_size(struct wlr_scene_rect *rect, int width, int height) {
|
||||
void set_rect_size(struct wlr_scene_rect *rect, int32_t width, int32_t height) {
|
||||
wlr_scene_rect_set_size(rect, GEZERO(width), GEZERO(height));
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ bool is_horizontal_right_stack_layout(Monitor *m) {
|
|||
return false;
|
||||
}
|
||||
|
||||
int is_special_animaiton_rule(Client *c) {
|
||||
int32_t is_special_animaiton_rule(Client *c) {
|
||||
|
||||
if (is_scroller_layout(c->mon) && !c->isfloating) {
|
||||
return DOWN;
|
||||
|
|
@ -71,11 +71,11 @@ int is_special_animaiton_rule(Client *c) {
|
|||
}
|
||||
|
||||
void set_client_open_animaiton(Client *c, struct wlr_box geo) {
|
||||
int slide_direction;
|
||||
int horizontal, horizontal_value;
|
||||
int vertical, vertical_value;
|
||||
int special_direction;
|
||||
int center_x, center_y;
|
||||
int32_t slide_direction;
|
||||
int32_t horizontal, horizontal_value;
|
||||
int32_t vertical, vertical_value;
|
||||
int32_t special_direction;
|
||||
int32_t center_x, center_y;
|
||||
|
||||
if ((!c->animation_type_open && strcmp(animation_type_open, "fade") == 0) ||
|
||||
(c->animation_type_open &&
|
||||
|
|
@ -147,15 +147,15 @@ void set_client_open_animaiton(Client *c, struct wlr_box geo) {
|
|||
}
|
||||
}
|
||||
|
||||
void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
||||
int sy, void *data) {
|
||||
void snap_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int32_t sx,
|
||||
int32_t sy, void *data) {
|
||||
BufferData *buffer_data = (BufferData *)data;
|
||||
wlr_scene_buffer_set_dest_size(buffer, buffer_data->width,
|
||||
buffer_data->height);
|
||||
}
|
||||
|
||||
void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
|
||||
void *data) {
|
||||
void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int32_t sx,
|
||||
int32_t sy, void *data) {
|
||||
BufferData *buffer_data = (BufferData *)data;
|
||||
|
||||
if (buffer_data->should_scale && buffer_data->height_scale < 1 &&
|
||||
|
|
@ -183,8 +183,8 @@ void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx, int sy,
|
|||
|
||||
if (buffer_data->should_scale) {
|
||||
|
||||
uint32_t surface_width = surface->current.width;
|
||||
uint32_t surface_height = surface->current.height;
|
||||
int32_t surface_width = surface->current.width;
|
||||
int32_t surface_height = surface->current.height;
|
||||
|
||||
surface_width = buffer_data->width_scale < 1
|
||||
? surface_width
|
||||
|
|
@ -271,19 +271,19 @@ void client_draw_shadow(Client *c) {
|
|||
? CORNER_LOCATION_NONE
|
||||
: CORNER_LOCATION_ALL;
|
||||
|
||||
int bwoffset = c->bw != 0 && hit_no_border ? (int)c->bw : 0;
|
||||
int32_t bwoffset = c->bw != 0 && hit_no_border ? (int32_t)c->bw : 0;
|
||||
|
||||
uint32_t width, height;
|
||||
int32_t width, height;
|
||||
client_actual_size(c, &width, &height);
|
||||
|
||||
uint32_t delta = shadows_size + c->bw - bwoffset;
|
||||
int32_t delta = shadows_size + (int32_t)c->bw - bwoffset;
|
||||
|
||||
/* we calculate where to clip the shadow */
|
||||
struct wlr_box client_box = {
|
||||
.x = bwoffset,
|
||||
.y = bwoffset,
|
||||
.width = width + (int)c->bw - bwoffset,
|
||||
.height = height + (int)c->bw - bwoffset,
|
||||
.width = width + (int32_t)c->bw - bwoffset,
|
||||
.height = height + (int32_t)c->bw - bwoffset,
|
||||
};
|
||||
|
||||
struct wlr_box shadow_box = {
|
||||
|
|
@ -313,7 +313,7 @@ void client_draw_shadow(Client *c) {
|
|||
.height = shadow_box.height,
|
||||
};
|
||||
|
||||
int right_offset, bottom_offset, left_offset, top_offset;
|
||||
int32_t right_offset, bottom_offset, left_offset, top_offset;
|
||||
|
||||
if (c == grabc) {
|
||||
right_offset = 0;
|
||||
|
|
@ -379,9 +379,9 @@ void apply_border(Client *c) {
|
|||
|
||||
struct wlr_box clip_box = c->animation.current;
|
||||
// 一但在GEZERO如果使用无符号,那么其他数据也会转换为无符号导致没有负数出错
|
||||
int bw = (int)c->bw;
|
||||
int32_t bw = (int32_t)c->bw;
|
||||
|
||||
int right_offset, bottom_offset, left_offset, top_offset;
|
||||
int32_t right_offset, bottom_offset, left_offset, top_offset;
|
||||
|
||||
if (c == grabc) {
|
||||
right_offset = 0;
|
||||
|
|
@ -400,25 +400,27 @@ void apply_border(Client *c) {
|
|||
top_offset = GEZERO(c->mon->m.y - c->animation.current.y);
|
||||
}
|
||||
|
||||
int inner_surface_width = GEZERO(clip_box.width - 2 * bw);
|
||||
int inner_surface_height = GEZERO(clip_box.height - 2 * bw);
|
||||
int32_t inner_surface_width = GEZERO(clip_box.width - 2 * bw);
|
||||
int32_t inner_surface_height = GEZERO(clip_box.height - 2 * bw);
|
||||
|
||||
int inner_surface_x = GEZERO(bw - left_offset);
|
||||
int inner_surface_y = GEZERO(bw - top_offset);
|
||||
int32_t inner_surface_x = GEZERO(bw - left_offset);
|
||||
int32_t inner_surface_y = GEZERO(bw - top_offset);
|
||||
|
||||
int rect_x = left_offset;
|
||||
int rect_y = top_offset;
|
||||
int32_t rect_x = left_offset;
|
||||
int32_t rect_y = top_offset;
|
||||
|
||||
int rect_width =
|
||||
int32_t rect_width =
|
||||
GEZERO(c->animation.current.width - left_offset - right_offset);
|
||||
int rect_height =
|
||||
int32_t rect_height =
|
||||
GEZERO(c->animation.current.height - top_offset - bottom_offset);
|
||||
|
||||
if (left_offset > c->bw)
|
||||
inner_surface_width = inner_surface_width - left_offset + c->bw;
|
||||
inner_surface_width =
|
||||
inner_surface_width - left_offset + (int32_t)c->bw;
|
||||
|
||||
if (top_offset > c->bw)
|
||||
inner_surface_height = inner_surface_height - top_offset + c->bw;
|
||||
inner_surface_height =
|
||||
inner_surface_height - top_offset + (int32_t)c->bw;
|
||||
|
||||
if (right_offset > 0) {
|
||||
inner_surface_width =
|
||||
|
|
@ -446,24 +448,24 @@ void apply_border(Client *c) {
|
|||
}
|
||||
|
||||
struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
||||
int offsetx = 0, offsety = 0, offsetw = 0, offseth = 0;
|
||||
int32_t offsetx = 0, offsety = 0, offsetw = 0, offseth = 0;
|
||||
struct ivec2 offset = {0, 0, 0, 0};
|
||||
|
||||
if (!ISSCROLLTILED(c) && !c->animation.tagining && !c->animation.tagouted &&
|
||||
!c->animation.tagouting)
|
||||
return offset;
|
||||
|
||||
int bottom_out_offset =
|
||||
int32_t bottom_out_offset =
|
||||
GEZERO(c->animation.current.y + c->animation.current.height -
|
||||
c->mon->m.y - c->mon->m.height);
|
||||
int right_out_offset =
|
||||
int32_t right_out_offset =
|
||||
GEZERO(c->animation.current.x + c->animation.current.width -
|
||||
c->mon->m.x - c->mon->m.width);
|
||||
int left_out_offset = GEZERO(c->mon->m.x - c->animation.current.x);
|
||||
int top_out_offset = GEZERO(c->mon->m.y - c->animation.current.y);
|
||||
int32_t left_out_offset = GEZERO(c->mon->m.x - c->animation.current.x);
|
||||
int32_t top_out_offset = GEZERO(c->mon->m.y - c->animation.current.y);
|
||||
|
||||
// 必须转换为int,否计算会没有负数导致判断错误
|
||||
int bw = (int)c->bw;
|
||||
int32_t bw = (int32_t)c->bw;
|
||||
|
||||
/*
|
||||
计算窗口表面超出屏幕四个方向的偏差,避免窗口超出屏幕
|
||||
|
|
@ -547,7 +549,7 @@ void client_apply_clip(Client *c, float factor) {
|
|||
}
|
||||
|
||||
// 获取窗口动画实时位置矩形
|
||||
uint32_t width, height;
|
||||
int32_t width, height;
|
||||
client_actual_size(c, &width, &height);
|
||||
|
||||
// 计算出除了边框的窗口实际剪切大小
|
||||
|
|
@ -590,8 +592,8 @@ void client_apply_clip(Client *c, float factor) {
|
|||
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip_box);
|
||||
|
||||
// 获取剪切后的表面的实际大小用于计算缩放
|
||||
int acutal_surface_width = geometry.width - offset.x - offset.width;
|
||||
int acutal_surface_height = geometry.height - offset.y - offset.height;
|
||||
int32_t acutal_surface_width = geometry.width - offset.x - offset.width;
|
||||
int32_t acutal_surface_height = geometry.height - offset.y - offset.height;
|
||||
|
||||
if (acutal_surface_width <= 0 || acutal_surface_height <= 0)
|
||||
return;
|
||||
|
|
@ -623,25 +625,24 @@ void fadeout_client_animation_next_tick(Client *c) {
|
|||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
uint32_t passed_time = timespec_to_ms(&now) - c->animation.time_started;
|
||||
int32_t passed_time = timespec_to_ms(&now) - c->animation.time_started;
|
||||
double animation_passed =
|
||||
c->animation.duration
|
||||
? (double)passed_time / (double)c->animation.duration
|
||||
: 1.0;
|
||||
|
||||
int type = c->animation.action = c->animation.action;
|
||||
int32_t type = c->animation.action = c->animation.action;
|
||||
double factor = find_animation_curve_at(animation_passed, type);
|
||||
|
||||
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;
|
||||
int32_t width = c->animation.initial.width +
|
||||
(c->current.width - c->animation.initial.width) * factor;
|
||||
int32_t height = c->animation.initial.height +
|
||||
(c->current.height - c->animation.initial.height) * 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;
|
||||
int32_t x = c->animation.initial.x +
|
||||
(c->current.x - c->animation.initial.x) * factor;
|
||||
int32_t y = c->animation.initial.y +
|
||||
(c->current.y - c->animation.initial.y) * factor;
|
||||
|
||||
wlr_scene_node_set_position(&c->scene->node, x, y);
|
||||
|
||||
|
|
@ -690,24 +691,23 @@ void client_animation_next_tick(Client *c) {
|
|||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
uint32_t passed_time = timespec_to_ms(&now) - c->animation.time_started;
|
||||
int32_t passed_time = timespec_to_ms(&now) - c->animation.time_started;
|
||||
double animation_passed =
|
||||
c->animation.duration
|
||||
? (double)passed_time / (double)c->animation.duration
|
||||
: 1.0;
|
||||
|
||||
int type = c->animation.action == NONE ? MOVE : c->animation.action;
|
||||
int32_t type = c->animation.action == NONE ? MOVE : c->animation.action;
|
||||
double factor = find_animation_curve_at(animation_passed, type);
|
||||
|
||||
Client *pointer_c = NULL;
|
||||
double sx = 0, sy = 0;
|
||||
struct wlr_surface *surface = NULL;
|
||||
|
||||
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;
|
||||
int32_t width = c->animation.initial.width +
|
||||
(c->current.width - c->animation.initial.width) * factor;
|
||||
int32_t height = c->animation.initial.height +
|
||||
(c->current.height - c->animation.initial.height) * factor;
|
||||
|
||||
int32_t x = c->animation.initial.x +
|
||||
(c->current.x - c->animation.initial.x) * factor;
|
||||
|
|
@ -910,7 +910,7 @@ void client_set_pending_state(Client *c) {
|
|||
c->dirty = true;
|
||||
}
|
||||
|
||||
void resize(Client *c, struct wlr_box geo, int interact) {
|
||||
void resize(Client *c, struct wlr_box geo, int32_t interact) {
|
||||
|
||||
// 动画设置的起始函数,这里用来计算一些动画的起始值
|
||||
// 动画起始位置大小是由于c->animainit_geom确定的
|
||||
|
|
@ -932,8 +932,8 @@ void resize(Client *c, struct wlr_box geo, int interact) {
|
|||
|
||||
if (is_scroller_layout(c->mon) && (!c->isfloating || c == grabc)) {
|
||||
c->geom = geo;
|
||||
c->geom.width = MAX(1 + 2 * (int)c->bw, c->geom.width);
|
||||
c->geom.height = MAX(1 + 2 * (int)c->bw, c->geom.height);
|
||||
c->geom.width = MAX(1 + 2 * (int32_t)c->bw, c->geom.width);
|
||||
c->geom.height = MAX(1 + 2 * (int32_t)c->bw, c->geom.height);
|
||||
} else { // 这里会限制不允许窗口划出屏幕
|
||||
c->geom = geo;
|
||||
applybounds(
|
||||
|
|
@ -1113,7 +1113,7 @@ bool client_apply_focus_opacity(Client *c) {
|
|||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
uint32_t passed_time = timespec_to_ms(&now) - c->animation.time_started;
|
||||
int32_t passed_time = timespec_to_ms(&now) - c->animation.time_started;
|
||||
double linear_progress =
|
||||
c->animation.duration
|
||||
? (double)passed_time / (double)c->animation.duration
|
||||
|
|
@ -1138,7 +1138,7 @@ bool client_apply_focus_opacity(Client *c) {
|
|||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
uint32_t passed_time =
|
||||
int32_t passed_time =
|
||||
timespec_to_ms(&now) - c->opacity_animation.time_started;
|
||||
double linear_progress =
|
||||
c->opacity_animation.duration
|
||||
|
|
@ -1155,7 +1155,7 @@ bool client_apply_focus_opacity(Client *c) {
|
|||
client_set_opacity(c, c->opacity_animation.current_opacity);
|
||||
|
||||
// Animate border color
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
c->opacity_animation.current_border_color[i] =
|
||||
c->opacity_animation.initial_border_color[i] +
|
||||
(c->opacity_animation.target_border_color[i] -
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
struct dvec2 calculate_animation_curve_at(double t, int type) {
|
||||
struct dvec2 calculate_animation_curve_at(double t, int32_t type) {
|
||||
struct dvec2 point;
|
||||
double *animation_curve;
|
||||
if (type == MOVE) {
|
||||
|
|
@ -41,41 +41,41 @@ void init_baked_points(void) {
|
|||
baked_points_opafadeout =
|
||||
calloc(BAKED_POINTS_COUNT, sizeof(*baked_points_opafadeout));
|
||||
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_move[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), MOVE);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_open[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), OPEN);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_tag[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), TAG);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_close[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), CLOSE);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_focus[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), FOCUS);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_opafadein[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), OPAFADEIN);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_opafadeout[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), OPAFADEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
double find_animation_curve_at(double t, int type) {
|
||||
uint32_t down = 0;
|
||||
uint32_t up = BAKED_POINTS_COUNT - 1;
|
||||
double find_animation_curve_at(double t, int32_t type) {
|
||||
int32_t down = 0;
|
||||
int32_t up = BAKED_POINTS_COUNT - 1;
|
||||
|
||||
uint32_t middle = (up + down) / 2;
|
||||
int32_t middle = (up + down) / 2;
|
||||
struct dvec2 *baked_points;
|
||||
if (type == MOVE) {
|
||||
baked_points = baked_points_move;
|
||||
|
|
@ -106,7 +106,8 @@ double find_animation_curve_at(double t, int type) {
|
|||
return baked_points[up].y;
|
||||
}
|
||||
|
||||
static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
||||
static bool scene_node_snapshot(struct wlr_scene_node *node, int32_t lx,
|
||||
int32_t ly,
|
||||
struct wlr_scene_tree *snapshot_tree) {
|
||||
if (!node->enabled && node->type != WLR_SCENE_NODE_TREE) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
void layer_actual_size(LayerSurface *l, uint32_t *width, uint32_t *height) {
|
||||
void layer_actual_size(LayerSurface *l, int32_t *width, int32_t *height) {
|
||||
struct wlr_box box;
|
||||
|
||||
if (l->animation.running) {
|
||||
|
|
@ -42,7 +42,7 @@ void get_layer_target_geometry(LayerSurface *l, struct wlr_box *target_box) {
|
|||
.height = state->desired_height};
|
||||
|
||||
// 水平方向定位
|
||||
const uint32_t both_horiz =
|
||||
const int32_t both_horiz =
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
|
||||
if (box.width == 0) {
|
||||
box.x = bounds.x;
|
||||
|
|
@ -57,7 +57,7 @@ void get_layer_target_geometry(LayerSurface *l, struct wlr_box *target_box) {
|
|||
}
|
||||
|
||||
// 垂直方向定位
|
||||
const uint32_t both_vert =
|
||||
const int32_t both_vert =
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;
|
||||
if (box.height == 0) {
|
||||
box.y = bounds.y;
|
||||
|
|
@ -101,10 +101,10 @@ void get_layer_target_geometry(LayerSurface *l, struct wlr_box *target_box) {
|
|||
}
|
||||
|
||||
void set_layer_dir_animaiton(LayerSurface *l, struct wlr_box *geo) {
|
||||
int slide_direction;
|
||||
int horizontal, horizontal_value;
|
||||
int vertical, vertical_value;
|
||||
int center_x, center_y;
|
||||
int32_t slide_direction;
|
||||
int32_t horizontal, horizontal_value;
|
||||
int32_t vertical, vertical_value;
|
||||
int32_t center_x, center_y;
|
||||
|
||||
if (!l)
|
||||
return;
|
||||
|
|
@ -161,10 +161,10 @@ void layer_draw_shadow(LayerSurface *l) {
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t width, height;
|
||||
int32_t width, height;
|
||||
layer_actual_size(l, &width, &height);
|
||||
|
||||
uint32_t delta = shadows_size;
|
||||
int32_t delta = shadows_size;
|
||||
|
||||
/* we calculate where to clip the shadow */
|
||||
struct wlr_box layer_box = {
|
||||
|
|
@ -200,8 +200,8 @@ void layer_draw_shadow(LayerSurface *l) {
|
|||
wlr_scene_shadow_set_clipped_region(l->shadow, clipped_region);
|
||||
}
|
||||
|
||||
void layer_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
||||
int sy, void *data) {
|
||||
void layer_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer,
|
||||
int32_t sx, int32_t sy, void *data) {
|
||||
BufferData *buffer_data = (BufferData *)data;
|
||||
|
||||
struct wlr_scene_surface *scene_surface =
|
||||
|
|
@ -212,8 +212,8 @@ void layer_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
|||
|
||||
struct wlr_surface *surface = scene_surface->surface;
|
||||
|
||||
uint32_t surface_width = surface->current.width * buffer_data->width_scale;
|
||||
uint32_t surface_height =
|
||||
int32_t surface_width = surface->current.width * buffer_data->width_scale;
|
||||
int32_t surface_height =
|
||||
surface->current.height * buffer_data->height_scale;
|
||||
|
||||
if (surface_height > 0 && surface_width > 0) {
|
||||
|
|
@ -222,7 +222,8 @@ void layer_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
|
|||
}
|
||||
|
||||
void layer_fadeout_scene_buffer_apply_effect(struct wlr_scene_buffer *buffer,
|
||||
int sx, int sy, void *data) {
|
||||
int32_t sx, int32_t sy,
|
||||
void *data) {
|
||||
BufferData *buffer_data = (BufferData *)data;
|
||||
wlr_scene_buffer_set_dest_size(buffer, buffer_data->width,
|
||||
buffer_data->height);
|
||||
|
|
@ -235,24 +236,23 @@ void fadeout_layer_animation_next_tick(LayerSurface *l) {
|
|||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
uint32_t passed_time = timespec_to_ms(&now) - l->animation.time_started;
|
||||
int32_t passed_time = timespec_to_ms(&now) - l->animation.time_started;
|
||||
double animation_passed =
|
||||
l->animation.duration
|
||||
? (double)passed_time / (double)l->animation.duration
|
||||
: 1.0;
|
||||
|
||||
int type = l->animation.action = l->animation.action;
|
||||
int32_t type = l->animation.action = l->animation.action;
|
||||
double factor = find_animation_curve_at(animation_passed, type);
|
||||
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;
|
||||
int32_t width = l->animation.initial.width +
|
||||
(l->current.width - l->animation.initial.width) * factor;
|
||||
int32_t height = l->animation.initial.height +
|
||||
(l->current.height - l->animation.initial.height) * 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;
|
||||
int32_t x = l->animation.initial.x +
|
||||
(l->current.x - l->animation.initial.x) * factor;
|
||||
int32_t y = l->animation.initial.y +
|
||||
(l->current.y - l->animation.initial.y) * factor;
|
||||
|
||||
wlr_scene_node_set_position(&l->scene->node, x, y);
|
||||
|
||||
|
|
@ -304,20 +304,19 @@ void layer_animation_next_tick(LayerSurface *l) {
|
|||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
uint32_t passed_time = timespec_to_ms(&now) - l->animation.time_started;
|
||||
int32_t passed_time = timespec_to_ms(&now) - l->animation.time_started;
|
||||
double animation_passed =
|
||||
l->animation.duration
|
||||
? (double)passed_time / (double)l->animation.duration
|
||||
: 1.0;
|
||||
|
||||
int type = l->animation.action == NONE ? MOVE : l->animation.action;
|
||||
int32_t type = l->animation.action == NONE ? MOVE : l->animation.action;
|
||||
double factor = find_animation_curve_at(animation_passed, type);
|
||||
|
||||
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;
|
||||
int32_t width = l->animation.initial.width +
|
||||
(l->current.width - l->animation.initial.width) * factor;
|
||||
int32_t height = l->animation.initial.height +
|
||||
(l->current.height - l->animation.initial.height) * factor;
|
||||
|
||||
int32_t x = l->animation.initial.x +
|
||||
(l->current.x - l->animation.initial.x) * factor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue