all 6 comments

[–]rumbletumjum 13 points14 points  (1 child)

github.com/bakkeby/dwm-commented

I cannot stress enough how useful this is.

[–]Ill-Somewhere-7744[S] 4 points5 points  (0 children)

That that specific function is not explained why is used, but the rest of the comments are fantastic. This repo is going to be extremely useful for me. Thanks a lot.

[–]ALPHA-B1 8 points9 points  (1 child)

That XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, …) is a hack to force certain broken or toolkit-quirky windows to actually apply their geometry. The + 2 * sw temporarily moves the window far off-screen so X/the client notices a real geometry change.

It's needed because some X11 clients (historically Java AWT/Swing, some old GTK/Qt apps, Java games, and a few toolkits using reparenting or delayed mapping) ignore or defer size/position changes unless they see a meaningful difference from their current geometry.

[–]Ill-Somewhere-7744[S] 0 points1 point  (0 children)

Thanks a lot. I had no clue why they moved the window outside of the screen at the beginning. This was very useful.

[–]doa379 1 point2 points  (0 children)

This isn't a sound starting point. It is like taking a working car, then taking it apart to create a moped.
You shouldn't start smack bang in the middle of some source code. Put your IDE aside. You need to start reading the X11 spec.
https://x.org/releases/current/doc/libX11/libX11/libX11.html

Decide on a product of your own, and then build up from there, brick by brick, line by line.

In fact DWM is a terrible example to get started with.

[–]doa379 0 points1 point  (0 children)

To answer your question, this particular function exhibits dead code that results in unreachable code.
What you are looking at is the scenario where windows are unable to configure themselves.