bakkeby/patches

Weird spacing issue after applying systray-alpha-patch and alpha-patch to dwm

n0x-io opened this issue · 2 comments

Hello!
First of all thank so much for this awesome collection of dwm patches and fixes to existing patches. I was going nuts about the issues the "official" systray and alpha patches caused together but your alpha-systray patch helped greatly.

I am running into a bit of an issue tho when also integrating both patches together with the barpadding patch.

On my primary monitor all patches work together without issues and everything looks as it should.

Primary Monitor upper left corner:
image
Primary Monitor lower left corner:
image

But if I move a window or open one on one of my secondary displays the spacing is off.

Secondary Monitor upper left corner:
image
Secondary Monitor lower left corner:
image

It looks like the window is "pushed upwards" so I assume there is somewhere an issue with subtracting the correct amount of spacing. Without the barpadding patch the spacing around the windows is correct on all monitors.
When I toggle the bar off and on again (via shortcut mod+b) the window fits correctly again on the secondary display. Which in my eyes means that the togglebar function works correctly when it comes to calling XMoveResizeWindow.
So I assume the issue is somewhere when first drawing the window on a screen or during the setup of the secondary screens.

I've tinkered around a little to see if I find the piece of code that is responsible for the initial setup of windows on a secondary screen but I'm not too familiar with the functions X11 provides. I looked at some of the functions the barpadding patch changes to see it I could spot anything that might have gone wrong but couldn't really find anything.
So I thought I'd ask here in hope you have an idea what might be the issue. If needed I can also link my suckless/dwm repo which i currently only have on gitlab.

I'm very sorry if this is the wrong place to ask this but I though you might have an idea on how do fix my issue.

Thank you so much in advance and I hope you'll have a lovely Sunday!

Ah I think I remember this one. It's the barpadding patch that is buggy.

https://dwm.suckless.org/patches/barpadding/dwm-barpadding-20200720-bb2e722.diff

    updategeom();
+   sp = sidepad;
+   vp = (topbar == 1) ? vertpad : - vertpad;
+
    /* init atoms */

You see above the author of that patch made the mistake of setting the sp and vp variables after the call to updategeom() which sets up the monitors and in turn calls updatebarpos which places the bar and sets the area for the window area.

If you move those two lines before the updategeom call then it should be fine.

The author ran into this issue as well, and to fix it they added this line further down:

    /* init bars */
    updatebars();
    updatestatus();
+   updatebarpos(selmon);
    /* supporting window for NetWMCheck */

which updates it for the first monitor only. That being the reason why it looks OK on your primary monitor, but looks off on the adjacent monitor.

You can remove this updatebarpos(selmon); call when you do the other fix above.

Oh wow that indeed fixes the issue!

Thank you so much! I'll close the issue for now.