Merge pull request #162 from DreamMaoMao/fix_shadow

fix: error caculate about shadow area
This commit is contained in:
DreamMaoMao
2025-07-07 18:44:04 +08:00
committed by GitHub

View File

@@ -258,17 +258,26 @@ void client_draw_shadow(Client *c) {
return; return;
} }
bool hit_no_border = check_hit_no_border(c);
enum corner_location current_corner_location =
c->isfullscreen || (no_radius_when_single && c->mon &&
c->mon->visible_clients == 1)
? CORNER_LOCATION_NONE
: CORNER_LOCATION_ALL;
unsigned int bwoffset = c->bw != 0 && hit_no_border ? c->bw : 0;
uint32_t width, height; uint32_t width, height;
client_actual_size(c, &width, &height); client_actual_size(c, &width, &height);
uint32_t delta = shadows_size + c->bw; uint32_t delta = shadows_size + c->bw - bwoffset;
/* we calculate where to clip the shadow */ /* we calculate where to clip the shadow */
struct wlr_box client_box = { struct wlr_box client_box = {
.x = 0, .x = bwoffset,
.y = 0, .y = bwoffset,
.width = width, .width = width - 2 * bwoffset,
.height = height, .height = height - 2 * bwoffset,
}; };
struct wlr_box shadow_box = { struct wlr_box shadow_box = {
@@ -288,7 +297,7 @@ void client_draw_shadow(Client *c) {
struct clipped_region clipped_region = { struct clipped_region clipped_region = {
.area = intersection_box, .area = intersection_box,
.corner_radius = border_radius, .corner_radius = border_radius,
.corners = border_radius_location_default, .corners = current_corner_location,
}; };
struct wlr_box absolute_shadow_box = { struct wlr_box absolute_shadow_box = {
@@ -328,6 +337,10 @@ void client_draw_shadow(Client *c) {
wlr_scene_shadow_set_size( wlr_scene_shadow_set_size(
c->shadow, GEZERO(shadow_box.width - left_offset - right_offset), c->shadow, GEZERO(shadow_box.width - left_offset - right_offset),
GEZERO(shadow_box.height - top_offset - bottom_offset)); GEZERO(shadow_box.height - top_offset - bottom_offset));
clipped_region.area.x = clipped_region.area.x - left_offset;
clipped_region.area.y = clipped_region.area.y - top_offset;
wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region); wlr_scene_shadow_set_clipped_region(c->shadow, clipped_region);
} }