bakkeby / dwm-flexipatch

A dwm build with preprocessor directives to decide which patches to include during build time
MIT License
1.18k stars 238 forks source link

NOBORDER patch behaves incorrectly when used with SWALLOW patch #430

Closed mohammad-amin-khajeh closed 3 months ago

mohammad-amin-khajeh commented 3 months ago

Steps to reproduce issue 1:

Expected behavior:

Steps to reproduce issue 2:

Expected behavior:

My specs:

My patches:

BAR_LTSYMBOL_PATCH 1 BAR_STATUS_PATCH 1 BAR_SYSTRAY_PATCH 1 BAR_TAGS_PATCH 1 BAR_WINTITLE_PATCH 1 BAR_HIDEVACANTTAGS_PATCH 1 BAR_PADDING_VANITYGAPS_PATCH 1 BAR_PADDING_SMART_PATCH 1 BAR_STATUSPADDING_PATCH 1 ALWAYSCENTER_PATCH 1 AUTOSTART_PATCH 1 BIDI_PATCH 1 CENTER_TRANSIENT_WINDOWS_PATCH 1 CFACTS_PATCH 1 CYCLELAYOUTS_PATCH 1 FOCUSDIR_PATCH 1 FULLSCREEN_PATCH 1 NOBORDER_PATCH 1 NO_TRANSPARENT_BORDERS_PATCH 1 ON_EMPTY_KEYS_PATCH 1 PERTAG_PATCH 1 PLACEDIR_PATCH 1 RESTARTSIG_PATCH 1 RIODRAW_PATCH 1 SAVEFLOATS_PATCH 1 SEAMLESS_RESTART_PATCH 1 SELFRESTART_PATCH 1 STACKER_PATCH 1 SWALLOW_PATCH 1 SWAPFOCUS_PATCH 1 TOGGLEFULLSCREEN_PATCH 1 TOGGLELAYOUT_PATCH 1 TOGGLETAG_PATCH 1 VANITYGAPS_PATCH 1 VIEWONTAG_PATCH 1 WARP_PATCH 1 XRDB_PATCH 1 TILE_LAYOUT 1 MONOCLE_LAYOUT 1

Here's a video demonstrating the issues:

https://github.com/user-attachments/assets/55c2ecaa-5e88-4808-9a0c-0da1b809cb16

bakkeby commented 3 months ago

Out of the 300 or so patches for dwm the noborder patch is the one that introduces the most obscure issues across the board and in general it is best avoided.

I pushed a compatibility fix for swallow + noborder. I suppose arguably it might be better not to fix this as realistically you would run into this issue (as well as many others) if you were to build up your own dwm from scratch using standalone patches only.

For Issue 2 you said that the expected behaviour is that nsxiv starts fullscreen and no window border is shown.

I think what is the expected behaviour in this case is that the new window ends up in the same location and have the same size as the terminal window that started it (as per swallow logic).

At least the swallow patch does not consider that special case.

The way that I have this implemented in my own build is that I just disallow swallowing for windows that start in fullscreen, e.g. something like this:

diff --git a/dwm.c b/dwm.c
index 198b77b..91a8a48 100644
--- a/dwm.c
+++ b/dwm.c
@@ -2615,8 +2615,10 @@ manage(Window w, XWindowAttributes *wa)
        }
        #endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH

-       if (getatomprop(c, netatom[NetWMState], XA_ATOM) == netatom[NetWMFullscreen])
+       if (getatomprop(c, netatom[NetWMState], XA_ATOM) == netatom[NetWMFullscreen]) {
                setfullscreen(c, 1);
+               term = NULL; /* do not allow terminals to be swallowed by windows that start in fullscreen */
+       }

        XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
        grabbuttons(c, 0);
mohammad-amin-khajeh commented 3 months ago

Great it's perfect now! As for the nsxiv issue I decided to just do RULE(.class = "Nsxiv", .noswallow = 1) since most of the times I start nsxiv in fullscreen anyway. Anyways thank you I'll close the issue.