bakkeby / dwm-flexipatch

A dwm build with preprocessor directives to decide which patches to include during build time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

merge conflict with awesomebar

Goosegit11 opened this issue · comments

Hello, could you help me with this merge conflict please?

<<<<<<< HEAD

#define ISVISIBLEONTAG(C, T) ((C->tags & T))

#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])

=======

#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))

#define HIDDEN(C) ((getstate(C->win) == IconicState))

>>>>>>> awesomebar

I already resolved some conflicts, but this one is questionable.
I can't clearly understand what's going on there (wtf is these variable names)
so I'm scared of doing something there. (explanation would be cool, but not necessarily)

This is all patches I applied so far:

  1. dwm-actualfullscreen-20211013-cb3f58a.diff
  2. dwm-alwayscenter-20200625-f04cac6.diff
  3. dwm-attachdirection-6.2.diff
  4. dwm-autostart-20210120-cb3f58a.diff
  5. dwm-awesomebar-20220925-6.3.diff
  6. dwm-ewmhtags-6.2.diff
  7. dwm-noborderselflickerfix-2022042627-d93ff48803f0.diff
  8. dwm-restartsig-20180523-6.2.diff
  9. dwm-status2d-6.3.diff
  10. dwm-status2d-systray-6.3.diff
  11. dwm-swallow-6.3.diff
  12. dwm-systray-6.4.diff
  13. dwm-vanitygaps-6.2.diff

If you were to apply these patches manually then you would see that there is no conflict here.

The attachdirection patch (actually the attachaside patch) introduces this change:

+++ b/dwm.c
@@ -49,7 +49,8 @@
 #define CLEANMASK(mask)         (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
 #define INTERSECT(x,y,w,h,m)    (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
                                * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
-#define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]))
+#define ISVISIBLEONTAG(C, T)    ((C->tags & T))
+#define ISVISIBLE(C)            ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
 #define LENGTH(X)               (sizeof X / sizeof X[0])
 #define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
 #define WIDTH(X)                ((X)->w + 2 * (X)->bw)
@@ -147,6 +148,11 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac

while the awesomebar patch introduces this change:

+++ b/dwm.c
@@ -50,6 +50,7 @@
 #define INTERSECT(x,y,w,h,m)    (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
                                * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
 #define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]))
+#define HIDDEN(C)               ((getstate(C->win) == IconicState))
 #define LENGTH(X)               (sizeof X / sizeof X[0])
 #define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
 #define WIDTH(X)                ((X)->w + 2 * (X)->bw)
@@ -59,7 +60,7 @@

All it is doing is adding that one line for the HIDDEN macro.

The only reason why this can't be merged automatically is because the patches use the surrounding code for reference and expects to find this line:

#define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]))

which has been changed by the attachdirection patch. To err on the side of caution it raises a conflict so that the user can check this in case there is something amiss.

As such you should end up with:

#define ISVISIBLEONTAG(C, T)    ((C->tags & T))
#define ISVISIBLE(C)            ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
#define HIDDEN(C)               ((getstate(C->win) == IconicState))

what do you mean by "patching manually"? I don't use flexipatch, I just remembered that I once created similar issue there and you helped me.
I'm not really sure - can this repo's Issues be used to help with people's merge conflicts? Sorry, if not.

I already had such merge conflicts where it just adds something and everything is easy.
But here I got confused, because this line was different in awesomebar:

head:
#define ISVISIBLE(C)            ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])`

awesomebar:
#define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]))

I thought I needed to merge this line somehow, but I didn't understand a shit in the code.
you explained everything perfectly and in detail, thank you!

btw, what do you think about dkwm?

By patching manually I mean rather than doing

$ patch -p1 < path/to/patch.diff

or

$ git apply path/to/patch.diff

you read the patch file and copy in the line changes by hand :)

That way you become more familiar with the various sections of code and are better placed to properly address conflicts. In this case you might have remembered that you changed this line of code before at some point.

When you apply a patch using the tools and it works then it is great, but all you know is that something changed and you learn little to nothing from it. Plus you grow dependent on patches that apply nicely together.

I am not going to lie; patching by hand is horridly time consuming, frustrating and painful, but with time you learn what a patch changes to introduce a specific behaviour.

If you are serious about dwm and want to get to a point where you feel like you can make it work exactly the way you want it to work and go beyond the ideas that are presented as patches then it may be worth the effort. Otherwise it would be more time efficient to go with more established builds.

btw, what do you think about dkwm?

Can't say that I have come across this before, or at least I don't remember it.

Main points:

  • xcb based
  • does not come with a bar or key bindings
  • configuration and operation handled through an external program (dkcmd)
  • kudos for writing the window manager from scratch
  • the window management functionality that is there seems fairly elaborate
  • started out as yaswm - yet another simple window manager

The way it works makes me think that it most closely resembles bspwm. It is not something that I would personally use as I like a tight integration with the bar, but I can see some people appreciating the clear separation of window manager, bar and keybinding handler.

started out as yaswm - yet another simple window manager

where did you get that info?

Looks like I made a typo, it was

yaxwm - Yet another X window manager

I found it when looking at the commit history for the project.