fix: remove useless code

This commit is contained in:
DreamMaoMao 2025-02-08 11:40:40 +08:00
parent 55d307009d
commit 32c2f81638

58
main.c
View file

@ -744,9 +744,9 @@ bool client_animation_next_tick(Client *c) {
client_set_opacity(c, MIN(animation_passed + fadein_begin_opacity, 1.0)); client_set_opacity(c, MIN(animation_passed + fadein_begin_opacity, 1.0));
} }
if (c->iskilling) { // if (c->iskilling) {
client_set_opacity(c, MAX(fadeout_begin_opacity - animation_passed, 0.1)); // client_set_opacity(c, MAX(fadeout_begin_opacity - animation_passed, 0.1));
} // }
c->is_open_animation = false; c->is_open_animation = false;
@ -1725,9 +1725,6 @@ void client_set_pending_state(Client *c) {
(!c->is_open_animation && (!c->is_open_animation &&
wlr_box_equal(&c->current, &c->pending))) { wlr_box_equal(&c->current, &c->pending))) {
c->animation.should_animate = false; c->animation.should_animate = false;
} else if (c->is_restoring_from_ov) {
c->is_restoring_from_ov = false;
c->animation.should_animate = false;
} else { } else {
c->animation.should_animate = true; c->animation.should_animate = true;
c->animation.initial = c->animainit_geom; c->animation.initial = c->animainit_geom;
@ -1760,12 +1757,14 @@ void client_commit(Client *c) {
wlr_output_schedule_frame(c->mon->wlr_output); wlr_output_schedule_frame(c->mon->wlr_output);
} }
void // 0.5 void
commitnotify(struct wl_listener *listener, void *data) { commitnotify(struct wl_listener *listener, void *data) {
Client *c = wl_container_of(listener, c, commit); Client *c = wl_container_of(listener, c, commit);
if(!c || c->iskilling) if(!c || c->iskilling)
return; return;
// if don't do this, some client may resize uncompleted
resize(c, c->geom, (c->isfloating && !c->isfullscreen));
} }
@ -2888,39 +2887,7 @@ 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->pending = c->geom;
// c->pending.y = c->geom.y + c->mon->m.height - (c->geom.y - c->mon->m.y);
// if (c == grabc) {
// cursor_mode = CurNormal;
// grabc = NULL;
// }
// if (c == selmon->sel) {
// selmon->sel = NULL;
// Client *nextfocus = focustop(selmon);
// if (nextfocus) {
// focusclient(nextfocus, 0);
// }
// if (!nextfocus && selmon->isoverview) {
// Arg arg = {0};
// toggleoverview(&arg);
// }
// }
// if (c->foreign_toplevel) {
// wlr_foreign_toplevel_handle_v1_destroy(c->foreign_toplevel);
// c->foreign_toplevel = NULL;
// }
// resize(c, c->geom, 0);
// printstatus();
// motionnotify(0, NULL, 0, 0, 0, 0);
// arrange(selmon, false);
client_send_close(c); client_send_close(c);
} }
@ -3791,9 +3758,7 @@ void resize(Client *c, struct wlr_box geo, int interact) {
client_set_opacity(c, 1); client_set_opacity(c, 1);
} }
if (c->iskilling) { if (c->animation.tagouting) {
c->animation.duration = animation_duration_close;
} else if (c->animation.tagouting) {
c->animation.duration = animation_duration_tag; c->animation.duration = animation_duration_tag;
} else if (c->animation.tagining) { } else if (c->animation.tagining) {
c->animation.duration = animation_duration_tag; c->animation.duration = animation_duration_tag;
@ -4638,7 +4603,7 @@ void overview_restore(Client *c, const Arg *arg) {
c->overview_isfullscreenbak = 0; c->overview_isfullscreenbak = 0;
c->overview_isfakefullscreenbak = 0; c->overview_isfakefullscreenbak = 0;
c->bw = c->overview_backup_bw; c->bw = c->overview_backup_bw;
c->is_restoring_from_ov = (arg->ui & c->tags) == 0 ? true : false; c->is_restoring_from_ov = (arg->ui & c->tags & TAGMASK) == 0 ? true : false;
if (c->isfloating) { if (c->isfloating) {
// XRaiseWindow(dpy, c->win); // 提升悬浮窗口到顶层 // XRaiseWindow(dpy, c->win); // 提升悬浮窗口到顶层
resizeclient(c, c->overview_backup_x, c->overview_backup_y, resizeclient(c, c->overview_backup_x, c->overview_backup_y,
@ -4654,9 +4619,12 @@ void overview_restore(Client *c, const Arg *arg) {
client_set_fullscreen(c, false); client_set_fullscreen(c, false);
} }
} else { } else {
if(c->is_restoring_from_ov ) {
c->is_restoring_from_ov = false;
resizeclient(c, c->overview_backup_x, c->overview_backup_y, resizeclient(c, c->overview_backup_x, c->overview_backup_y,
c->overview_backup_w, c->overview_backup_h, 0); c->overview_backup_w, c->overview_backup_h, 0);
} }
}
if (c->bw == 0 && !c->isnoborder && if (c->bw == 0 && !c->isnoborder &&
!c->isfullscreen) { // 如果是在ov模式中创建的窗口,没有bw记录 !c->isfullscreen) { // 如果是在ov模式中创建的窗口,没有bw记录
@ -4870,8 +4838,6 @@ 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;