diff --git a/src/common.h b/src/common.h index 6f8f328..7b9368e 100644 --- a/src/common.h +++ b/src/common.h @@ -292,7 +292,6 @@ typedef struct session { /// Index of the next free slot in expose_rects. int n_expose; /// Current desktop of display - uint32_t prev_desktop; uint32_t cur_desktop; // === Window related === diff --git a/src/event.c b/src/event.c index a676073..cdd1412 100644 --- a/src/event.c +++ b/src/event.c @@ -458,10 +458,19 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t 1L, XCB_ATOM_CARDINAL, 32); if (prop.nitems) { - ps->prev_desktop = ps->cur_desktop; - ps->cur_desktop = *prop.c32; - if (!ps->prev_desktop) - ps->prev_desktop = ps->cur_desktop; + if (ps->cur_desktop != *prop.c32) { + win_stack_foreach_managed_safe(w, &ps->window_stack) { + if (w->a.override_redirect) { + continue; + } + if (w->cur_desktop & *prop.c32) { + w->dwm_mask = ANIM_NEXT_TAG; + } else if (w->cur_desktop & ps->cur_desktop) { + w->dwm_mask = ANIM_PREV_TAG; + } + } + ps->cur_desktop = *prop.c32; + } } } diff --git a/src/picom.c b/src/picom.c index 25c569b..aedc8bc 100644 --- a/src/picom.c +++ b/src/picom.c @@ -1723,7 +1723,6 @@ static void draw_callback_impl(EV_P_ session_t *ps, int revents attr_unused) { ps->fade_time = 0L; } if (!animation_running) { - ps->prev_desktop = ps->cur_desktop; ps->animation_time = 0L; } @@ -1884,7 +1883,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy, .shadow_context = NULL, .cur_desktop = 0, - .prev_desktop = 0, #ifdef CONFIG_VSYNC_DRM .drm_fd = -1, diff --git a/src/win.c b/src/win.c index 14f3605..b98d22a 100644 --- a/src/win.c +++ b/src/win.c @@ -694,14 +694,6 @@ void win_process_update_flags(session_t *ps, struct managed_win *w) { // w->dwm_mask = ANIM_PREV_TAG; // else if (w->pending_g.y > 0 && w->g.y < 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height) // w->dwm_mask = ANIM_NEXT_TAG; - if (!w->a.override_redirect && ps->cur_desktop != ps->prev_desktop) { - if (w->cur_desktop == ps->cur_desktop) { - w->dwm_mask = ANIM_NEXT_TAG; - } else { - w->dwm_mask = ANIM_PREV_TAG; - } - } - if (!was_visible || w->dwm_mask) { diff --git a/src/win.h b/src/win.h index a2ed0d9..d3518b2 100644 --- a/src/win.h +++ b/src/win.h @@ -171,8 +171,8 @@ struct managed_win { /// opacity state, window geometry, window mapped/unmapped state, /// window mode of the windows above. DOES NOT INCLUDE the body of THIS WINDOW. /// NULL means reg_ignore has not been calculated for this window. - /// 1 = tag prev , 2 = tag next, 4 = unmap - uint32_t dwm_mask; + /// 1 = tag prev , 2 = tag next, 4 = unmap + uint32_t dwm_mask; rc_region_t *reg_ignore; /// Whether the reg_ignore of all windows beneath this window are valid bool reg_ignore_valid; @@ -203,11 +203,11 @@ struct managed_win { /// Inverse of the window distance at the start of animation, for /// tracking animation progress double animation_inv_og_distance; - /// Animation info if it is a tag change & check if its changing window sizes - /// 0: no tag change - /// 1: normal tag change animation - /// 2: tag change animation that effects window size - uint16_t animation_is_tag; + /// Animation info if it is a tag change & check if its changing window sizes + /// 0: no tag change + /// 1: normal tag change animation + /// 2: tag change animation that effects window size + uint16_t animation_is_tag; // Client window related members /// ID of the top-level client window of the window.