Skip to content

Commit

Permalink
Added animation for closing windows.
Browse files Browse the repository at this point in the history
This will add animations for windows when closing (destroying) just like it works for unmapping (e.g. minimizing).
  • Loading branch information
pijulius committed Oct 19, 2021
1 parent b92d410 commit 7b674f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,9 @@ paint_preprocess(session_t *ps, bool *fade_running, bool *animation_running) {
pixman_region32_init_rect(&w->bounding_shape, 0, 0,
(uint)w->widthb, (uint)w->heightb);

win_clear_flags(w, WIN_FLAGS_PIXMAP_STALE);
if (w->state != WSTATE_DESTROYING)
win_clear_flags(w, WIN_FLAGS_PIXMAP_STALE);

win_process_image_flags(ps, w);
}
// Mark new window region with damage
Expand Down Expand Up @@ -878,7 +880,7 @@ paint_preprocess(session_t *ps, bool *fade_running, bool *animation_running) {
}
}

if (animation_running)
if (*animation_running)
ps->animation_time = now;

// Opacity will not change, from now on.
Expand Down Expand Up @@ -907,7 +909,10 @@ paint_preprocess(session_t *ps, bool *fade_running, bool *animation_running) {
if (w->state == WSTATE_UNMAPPED ||
unlikely(w->base.id == ps->debug_window ||
w->client_win == ps->debug_window)) {
to_paint = false;

if (!*fade_running || w->opacity == w->opacity_target)
to_paint = false;

} else if (!w->ever_damaged && w->state != WSTATE_UNMAPPING &&
w->state != WSTATE_DESTROYING) {
// Unmapping clears w->ever_damaged, but the fact that the window
Expand Down
6 changes: 4 additions & 2 deletions src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,9 @@ void win_on_win_size_change(session_t *ps, struct managed_win *w) {
w->state != WSTATE_UNMAPPING);

// Invalidate the shadow we built
win_set_flags(w, WIN_FLAGS_IMAGES_STALE);
if (w->state != WSTATE_DESTROYING)
win_set_flags(w, WIN_FLAGS_IMAGES_STALE);

ps->pending_updates = true;
free_paint(ps, &w->shadow_paint);
}
Expand Down Expand Up @@ -3109,5 +3111,5 @@ win_stack_find_next_managed(const session_t *ps, const struct list_node *i) {
bool win_is_mapped_in_x(const struct managed_win *w) {
return w->state == WSTATE_MAPPING || w->state == WSTATE_FADING ||
w->state == WSTATE_MAPPED || w->state == WSTATE_UNMAPPING ||
(w->flags & WIN_FLAGS_MAPPED);
w->state == WSTATE_DESTROYING || (w->flags & WIN_FLAGS_MAPPED);
}

0 comments on commit 7b674f9

Please sign in to comment.