fix:Remove unreasonable fadeout animations

This commit is contained in:
DreamMaoMao 2025-02-06 22:55:41 +08:00
parent ceb5f5dd85
commit d7f6f27392
3 changed files with 41 additions and 37 deletions

View file

@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/da80c6d1-b9a5-44c4-b738-6421365e6aa5
- workspace switch animaition - workspace switch animaition
- window close animaition - window close animaition
- custom mov/open/close/tag animaition sppeed - custom mov/open/close/tag animaition sppeed
- fade in / fade out - fade in animation
# install # install

View file

@ -10,7 +10,6 @@ static const bool animations = true; // Enable animations
static const char *animation_type = "slide"; //slide or zoom static const char *animation_type = "slide"; //slide or zoom
static const char animation_fade_in = 0; // Enable animation fade in static const char animation_fade_in = 0; // Enable animation fade in
static const float zoom_initial_ratio = 0.5; // Initial window ratio for animations static const float zoom_initial_ratio = 0.5; // Initial window ratio for animations
static const float fadeout_begin_opacity = 0.9; // Begin opacity for animations fadeout
static const float fadein_begin_opacity = 0; // Begin opacity for animations fasdein static const float fadein_begin_opacity = 0; // Begin opacity for animations fasdein
static const uint32_t animation_duration_move = 300; // Animation move speed static const uint32_t animation_duration_move = 300; // Animation move speed
static const uint32_t animation_duration_open = 300; // Animation open speed static const uint32_t animation_duration_open = 300; // Animation open speed

75
main.c
View file

@ -756,10 +756,10 @@ bool client_animation_next_tick(Client *c) {
} }
c->animation.running = false; c->animation.running = false;
if (c->iskilling) { // if (c->iskilling) {
client_send_close(c); // client_send_close(c);
return false; // return false;
} // }
if (c->animation.tagouting) { if (c->animation.tagouting) {
c->animation.tagouting = false; c->animation.tagouting = false;
wlr_scene_node_set_enabled(&c->scene->node, false); wlr_scene_node_set_enabled(&c->scene->node, false);
@ -822,7 +822,7 @@ void client_apply_clip(Client *c) {
} }
bool client_draw_frame(Client *c) { bool client_draw_frame(Client *c) {
if (!c || !c->mon || !client_surface(c)->mapped) if (!c || !client_surface(c)->mapped)
return false; return false;
// if (!VISIBLEON(c, c->mon)) // if (!VISIBLEON(c, c->mon))
// return false; // return false;
@ -2403,6 +2403,8 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output) {
// state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE; // state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
// wl_list_for_each(c, &clients, link) { // wl_list_for_each(c, &clients, link) {
// if (c->iskilling)
// continue;
// if (c->mon != monitor) // if (c->mon != monitor)
// continue; // continue;
// if (!(c->tags & tagmask)) // if (!(c->tags & tagmask))
@ -2886,39 +2888,40 @@ keypressmod(struct wl_listener *listener, void *data) {
} }
void pending_kill_client(Client *c) { void pending_kill_client(Client *c) {
c->iskilling = 1; // c->iskilling = 1;
c->animainit_geom = c->geom; // c->animainit_geom = c->geom;
c->pending = c->geom; // c->pending = c->geom;
c->pending.y = c->geom.y + c->mon->m.height - (c->geom.y - c->mon->m.y); // c->pending.y = c->geom.y + c->mon->m.height - (c->geom.y - c->mon->m.y);
if (c == grabc) { // if (c == grabc) {
cursor_mode = CurNormal; // cursor_mode = CurNormal;
grabc = NULL; // grabc = NULL;
} // }
if (c == selmon->sel) { // if (c == selmon->sel) {
selmon->sel = NULL; // selmon->sel = NULL;
Client *nextfocus = focustop(selmon); // Client *nextfocus = focustop(selmon);
if (nextfocus) { // if (nextfocus) {
focusclient(nextfocus, 0); // focusclient(nextfocus, 0);
} // }
if (!nextfocus && selmon->isoverview) { // if (!nextfocus && selmon->isoverview) {
Arg arg = {0}; // Arg arg = {0};
toggleoverview(&arg); // toggleoverview(&arg);
} // }
} // }
if (c->foreign_toplevel) { // if (c->foreign_toplevel) {
wlr_foreign_toplevel_handle_v1_destroy(c->foreign_toplevel); // wlr_foreign_toplevel_handle_v1_destroy(c->foreign_toplevel);
c->foreign_toplevel = NULL; // c->foreign_toplevel = NULL;
} // }
resize(c, c->geom, 0); // resize(c, c->geom, 0);
printstatus(); // printstatus();
motionnotify(0, NULL, 0, 0, 0, 0); // motionnotify(0, NULL, 0, 0, 0, 0);
arrange(selmon, false); // arrange(selmon, false);
client_send_close(c);
} }
void killclient(const Arg *arg) { void killclient(const Arg *arg) {
@ -3912,7 +3915,7 @@ setfloating(Client *c, int floating) {
struct wlr_box target_box, backup_box; struct wlr_box target_box, backup_box;
c->isfloating = floating; c->isfloating = floating;
if (!c || !c->mon || !client_surface(c)->mapped) if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
return; return;
wlr_scene_node_reparent(&c->scene->node, wlr_scene_node_reparent(&c->scene->node,
@ -3954,7 +3957,7 @@ setfloating(Client *c, int floating) {
void setfakefullscreen(Client *c, int fakefullscreen) { void setfakefullscreen(Client *c, int fakefullscreen) {
struct wlr_box fakefullscreen_box; struct wlr_box fakefullscreen_box;
if (!c || !c->mon || !client_surface(c)->mapped) if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
return; return;
c->isfakefullscreen = fakefullscreen; c->isfakefullscreen = fakefullscreen;
@ -4000,7 +4003,7 @@ void setfullscreen(Client *c, int fullscreen) // 用自定义全屏代理自带
{ {
c->isfullscreen = fullscreen; c->isfullscreen = fullscreen;
if (!c || !c->mon || !client_surface(c)->mapped) if (!c || !c->mon || !client_surface(c)->mapped || c->iskilling)
return; return;
client_set_fullscreen(c, fullscreen); client_set_fullscreen(c, fullscreen);
@ -4867,6 +4870,8 @@ void unmapnotify(struct wl_listener *listener, void *data) {
/* Called when the surface is unmapped, and should no longer be shown. */ /* Called when the surface is unmapped, and should no longer be shown. */
Client *c = wl_container_of(listener, c, unmap); Client *c = wl_container_of(listener, c, unmap);
c->iskilling = 1;
if (c == grabc) { if (c == grabc) {
cursor_mode = CurNormal; cursor_mode = CurNormal;
grabc = NULL; grabc = NULL;