Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

berrywm: rounded corners #145

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Sidd-Dino
Copy link
Contributor

@Sidd-Dino Sidd-Dino commented Jul 23, 2021

rounded corners for windows

default radius : 20

Can be configured by 
berryc border_radius X

Patch: https://patch-diff.githubusercontent.com/raw/JLErvin/berry/pull/145.patch

I doubt this goes with this version of berry will fit the idea that @JLErvin has for this project
but i made it as way to learn my way around X and Xlib

Known Bugs :
>  Wonky behavior with decorations and headers

\o/ Gotta give credit to this sauce of inspiration

@Sidd-Dino
Copy link
Contributor Author

<> Screenshot
scrot

@JLErvin
Copy link
Owner

JLErvin commented Jul 23, 2021

This is a very good start, and something that I would really like to be included in berry. However, it looks like it needs some adjustment for windows which are decorated. I think that, ideally, both the client and the client's decoration would have rounded corners. Or, perhaps this would be a configurable value.

@Sidd-Dino
Copy link
Contributor Author

Sidd-Dino commented Jul 23, 2021

Oh the client and client_decoration is huge pain.
For now rounded corners are being tested because of the problems that appear below

no_borders
scrot_no_borders

inner_border 5
scrot_inner_border

border 5
scrot_border

When any border is added
It's perfect at the (0,0) of client and client_dec windows.
everywhere else it just gets misaligned. Which makes no sense.
I checked the code but i cant for the life of me figure out how it's getting influenced.

Due to multiple misconceptions of the workings of windows and
decorations bugs were made. They have been promptly smashed.

Using border(outer_border) causes:
-> Removal of inner_border's rounded cornerss
-> When used without inner_border visual artifacts appear
@Sidd-Dino
Copy link
Contributor Author

Sidd-Dino commented Jul 24, 2021

Progress

no borders

no_border_scrot

inner border

in_border_scrot

outer border

out_border_scrot

outer + inner border

out+in_border_scrot

title

I made a mistake with this. Will be patched in the next commit.

Thoughts

I have no clue how to proceed further
Any modifications past this is design choices

I made a mistake with the calculation of the mask size
@Sidd-Dino
Copy link
Contributor Author

Progress

title + no_border

title+in_border_scrot

title + inner border

title+inner_border_scrot

@JLErvin
Copy link
Owner

JLErvin commented Jul 25, 2021

I actually quite like this patch and think that this is something that would really attract people to berry. I need to do some more testing before I'm ready to merge it, but I will leave some comments in the meantime. Thanks for taking the time to work on this! :)

@Sidd-Dino
Copy link
Contributor Author

I need to do some more testing before I'm ready to merge it,

Currently the only problem I've found is when border_width is set to a non zero value.
This creates visual artifacts on every corner of the window with said border.

outer border

out_border_scrot

outer + inner border

out+in_border_scrot

I believe the outer_border is being applied by the function ewmh_set_frame_extents()
Which uses XChangeProperty() to apply the outer_border
Which creates a border that doesn't span underneath the window like inner_border

I dont know how to solve it :/

Copy link
Owner

@JLErvin JLErvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the outer_border is being applied by the function ewmh_set_frame_extents()

ewmh_set_frame_extents has no effect on how windows are rendered by berry. This is a property reported to the x server so that compositors can render shadows correctly (there are other reasons as well, but this is why it was implemented).

The way that window decorations work in berry is that there is a dummy window created behind each client. The way that we achieve a double border look is by drawing a border around this window (this is a built-in function provided by the xlib API). This is probably the reason that we're seeing this artifact - the border around the decoration window is being rounded, but the actual base window itself is not being rounded. I'm not super familiar with how the rounding code is actually implemented, but I'll look into it and see if I can come up with a fix.

config.h.in Outdated Show resolved Hide resolved

# Default pkg flags to substitute when pkg-config is not found
pkg_libs="-lX11 -lXinerama -lfontconfig -lfreetype -lXft"
pkg_libs="-lX11 -lXinerama -lfontconfig -lfreetype -lXft -lXext"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's likely we will need to coordinate with package maintainers for this new dependency (unless its already included elsewhere, I will double check this).

wm.c Outdated Show resolved Hide resolved
{
unsigned int rad = conf.border_radius;

if (c->fullscreen)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this behavior, we might want to consider doing this for monocled windows as well? I'm open to either behavior for monocled windows actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should monocole view have it's corners rounded?

wm.c Outdated Show resolved Hide resolved
@Sidd-Dino Sidd-Dino changed the title berrywm:rounded corners berrywm: rounded corners Aug 7, 2021
@JLErvin
Copy link
Owner

JLErvin commented Aug 7, 2021

Unfortunately I haven't had much time to write up a solution for this, although I don know what the issue is. Behind each client window there is a decoration window. When borders are enabled, this window is ever so slightly larger than the client window, giving the illusion of a "border". When double borders are enabled, another border is added to the decoration window (using XLib's built-in API).

The issue comes into play because, when we round the decoration window, we are only rounding it's outer-most edge (i.e., it's border). This is an issue because we also want to round the inner edge (i.e. the edge of the base decoration window). I haven't had much time to dive into how to round is actually working, but so long as we could applying rounding to that inner-most window, it should resolve.

@Sidd-Dino
Copy link
Contributor Author

I'll start working on berrwm again.
I'd taken a break ( ;-; lost motivation to continue )

I'll start experimenting right away
I'll keep updating on my progress
'u'

*I'm sorry dude i changed the title cos i wanted a damn space between ...wm: and roun...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants