From bb2b4801f7aef81f0739a50bf272431f7d7d9549 Mon Sep 17 00:00:00 2001 From: Arda Atci Date: Mon, 6 Feb 2023 23:12:45 +0300 Subject: [PATCH] randr anim fix --- src/win.c | 8 ++++++-- src/x.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/win.c b/src/win.c index 130c445..247bc16 100644 --- a/src/win.c +++ b/src/win.c @@ -474,7 +474,12 @@ static void init_animation(session_t *ps, struct managed_win *w) { static int32_t randr_mon_center_x, randr_mon_center_y; if (w->randr_monitor == -1) { win_update_monitor(ps->randr_nmonitors, ps->randr_monitor_regs, w); - randr_mon_center_x = ps->root_width / 2, randr_mon_center_y = ps->root_height / 2; + if (w->randr_monitor != -1) { + auto e = pixman_region32_extents(&ps->randr_monitor_regs[w->randr_monitor]); + randr_mon_center_x = (e->x1 + e->x2) / 2, randr_mon_center_y = (e->y1 + e->y2) / 2; + } else { + randr_mon_center_x = ps->root_width / 2, randr_mon_center_y = ps->root_height / 2; + } } else { auto e = pixman_region32_extents(&ps->randr_monitor_regs[w->randr_monitor]); randr_mon_center_x = (e->x1 + e->x2) / 2, randr_mon_center_y = (e->y1 + e->y2) / 2; @@ -2751,7 +2756,6 @@ bool win_skip_fading(session_t *ps, struct managed_win *w) { // TODO(absolutelynothelix): rename to x_update_win_(randr_?)monitor and move to // the x.c. void win_update_monitor(int nmons, region_t *mons, struct managed_win *mw) { - mw->randr_monitor = -1; for (int i = 0; i < nmons; i++) { auto e = pixman_region32_extents(&mons[i]); if (e->x1 <= mw->g.x && e->y1 <= mw->g.y && diff --git a/src/x.c b/src/x.c index 6121e77..ef60b7e 100644 --- a/src/x.c +++ b/src/x.c @@ -792,7 +792,7 @@ xcb_screen_t *x_screen_of_display(xcb_connection_t *c, int screen) { void x_update_randr_monitors(session_t *ps) { x_free_randr_info(ps); - if (!ps->o.crop_shadow_to_monitor || !ps->randr_exists) { + if ((!ps->o.crop_shadow_to_monitor || !ps->o.animations) || !ps->randr_exists) { return; }