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

feat: add borders #23

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft

feat: add borders #23

wants to merge 16 commits into from

Conversation

WillPower3309
Copy link
Member

@WillPower3309 WillPower3309 commented Oct 19, 2023

TODO:

  • border setting
  • add border width to corner radius
  • border stencil
  • proper damage tracking
  • support scaled and rotated outputs
  • decrease buffer size by border size (otherwise the borders can mess up gaps because they increase the visual size of the surface)
  • remove slight rounding with corner radius of 0

@WillPower3309 WillPower3309 marked this pull request as draft October 19, 2023 06:09
@WillPower3309
Copy link
Member Author

will fix meson.build next commit

@WillPower3309
Copy link
Member Author

Need to fix a weird bug, corners of the borders don't round, and the stencil cuts out the window surface texture as well as the border area

render/fx_renderer/fx_renderer.c Show resolved Hide resolved
struct shadow_data *data = &buffer->shadow_data;
if (scene_buffer_has_shadow(data)) {
wlr_region_expand(&node->visible, &node->visible, data->blur_sigma);
wlr_region_expand(&node->visible, &node->visible, buffer->border_size);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe check if the size is larger than 0?

@@ -1124,10 +1139,54 @@ static void render_texture(struct fx_renderer *fx_renderer, struct wlr_output *o
}
}

static void render_border(struct fx_renderer *fx_renderer, struct wlr_output *output,
pixman_region32_t *surface_damage, const struct wlr_box *surface_box,
int size, float color[static 4], int corner_radius) {
Copy link
Member

Choose a reason for hiding this comment

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

What about passing the scene_buffer pointer instead of these three parameters?

@ErikReider
Copy link
Member

ErikReider commented Oct 20, 2023

What about moving this into a sister-node to our wlr_scene_buffer as a new node type? We could provide shadow control, border x/y offset, width, height, etc without messing with the wlr_scene_buffer struct as intended by the wlroots devs:

image

This would allow the comp to add multiple borders as discussed earlier.

But then again, we could just add those variables to the wlr_scene_buffer struct and get the same result

@WillPower3309
Copy link
Member Author

What about moving this into a sister-node to our wlr_scene_buffer as a new node type? We could provide shadow control, border x/y offset, width, height, etc without messing with the wlr_scene_buffer struct as intended by the wlroots devs:

image

This would allow the comp to add multiple borders as discussed earlier.

But then again, we could just add those variables to the wlr_scene_buffer struct and get the same result

Thanks for closing out this couple of items I had to do, I agree. I was actually going to suggest something similar, partly since shadows also depend on border values

@WillPower3309
Copy link
Member Author

Just need to fix a corner issue and close out the scaling / rotation and this is done!

@WillPower3309
Copy link
Member Author

I'll try to close out the last bit tomorrow

@WillPower3309
Copy link
Member Author

2023-11-01_01-11-1698815715
Still a bit of corner cropping, almost seems like the stencil is also applying to the surface texture

@WillPower3309
Copy link
Member Author

Might rename the function to render_rect_around_rect, to make it less specific to borders, as compositors should be able to use it for titlebars too

@WillPower3309 WillPower3309 linked an issue Apr 30, 2024 that may be closed by this pull request
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.

Add border drawing functionality
2 participants