mlukow / OpenBSD-patches

Assorted patches, work very much in progress
BSD 2-Clause "Simplified" License
8 stars 0 forks source link

error: static declaration of 'client_round_corners' follows non-static declaration #1

Open jcarnat opened 2 years ago

jcarnat commented 2 years ago

Hello,

Trying to apply your patches on -current code of cwm, I get the following error:

# doas make
yacc  -o parse.c parse.y
cc -O2 -pipe  -Wall  -MD -MP   -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/xenocara/app/cwm -c calmwm.c
cc -O2 -pipe  -Wall  -MD -MP   -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/xenocara/app/cwm -c screen.c
cc -O2 -pipe  -Wall  -MD -MP   -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/xenocara/app/cwm -c xmalloc.c
cc -O2 -pipe  -Wall  -MD -MP   -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/xenocara/app/cwm -c client.c
client.c:600:2: warning: implicit declaration of function 'client_round_corners' is invalid in C99 [-Wimplicit-function-declaration]
        client_round_corners(cc, X_Dpy, cc->bwidth);
        ^
client.c:604:1: error: static declaration of 'client_round_corners' follows non-static declaration
client_round_corners(struct client_ctx *cc, Display *d, int rad)
^
client.c:600:2: note: previous implicit declaration is here
        client_round_corners(cc, X_Dpy, cc->bwidth);
        ^
1 warning and 1 error generated.
*** Error 1 in /usr/xenocara/app/cwm (<sys.mk>:87 'client.o')

Any clue to solve this? Thanks.

mlukow commented 2 years ago

Hi, sorry, missed your message, was away for Christmas :-)

So, looks like you're using the OpenBSD version, I have to admit I've been running cwm on Linux lately and this is where I made this rounded corners patch. Hm, if my memory serves me right, it should be enough to declare the method at the beginning of the client.c file, maybe after client_wm_protocols in line 37 because why not 😬:

static void client_round_corners(struct client_ctx *cc, Display *d, int rad);

Let me know if it worked!

jcarnat commented 2 years ago

Yes, it works! Thank you.

According to the code, there is no option to configure the corner radius ; it only depends on the border size. Did I understood properly?

mlukow commented 2 years ago

Good to hear 😎 Yup, the patch isn't finished, gonna be working on in this weekend, stay tuned!

mlukow commented 2 years ago

Actually scratch that, just made the radius configurable. Yes mum, i'm working, i swear!

jcarnat commented 2 years ago

Just tested the new "cornerradius" parameters. Works great! Thanks again!

There is just a weird value set (borderwidth=3 / cornerradius=10) that renders not so appealing borders. I've compared with openbox (border=3)+picom (radius=10), and the same happens. So there may not be solution for this. cwm-border3-round-zoom

When you go for borderwidth=10/cornerradius=10, you get much more expected borders. The inner window border is still square but it looks "normal".

Using borderwidth=0/cornerradius=0 also renders windows in an expected way. I think I'll go for this configuration =)

Do you plan to submit those patches to upstream?

mlukow commented 2 years ago

So here's the thing - you can't get nice round borders with only xlib which cwm uses (when you set a shape mask on a window, it trims the border too), you have to use xcb which is a much bigger thing that i did. I mean, if you want rounded corners, you probably also want shadows and other bells and whistles so you'd want to go for picom anyway 😬 but yeah, these rounded corners are bothering me, i'm gonna have to fix them some day (maybe this weekend?)

And i'm not sure anyone would be interested in getting these patches upstream… these are just play toys, nothing really useful.

jcarnat commented 2 years ago

Indeed, switching libraries sounds like a tough thing to apply :-/