layer-shell: fix overflow with large bottom margin

This commit is contained in:
Isaac Freund 2022-03-28 12:10:18 +02:00
parent aa684aa936
commit ae349b0ce4
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -320,8 +320,10 @@ fn arrangeLayer(
new_box.width = current_state.desired_width; new_box.width = current_state.desired_width;
} else { } else {
assert(current_state.anchor.right); assert(current_state.anchor.right);
new_box.x = bounds.x + @intCast(i32, bounds.width - current_state.desired_width - new_box.x = bounds.x + @intCast(i32, bounds.width) -
current_state.margin.right); @intCast(i32, current_state.desired_width) -
// TODO(wlroots) this type has been corrected to i32 for the next release
@intCast(i32, current_state.margin.right);
new_box.width = current_state.desired_width; new_box.width = current_state.desired_width;
} }
@ -338,8 +340,10 @@ fn arrangeLayer(
new_box.height = current_state.desired_height; new_box.height = current_state.desired_height;
} else { } else {
assert(current_state.anchor.bottom); assert(current_state.anchor.bottom);
new_box.y = bounds.y + @intCast(i32, bounds.height - current_state.desired_height - new_box.y = bounds.y + @intCast(i32, bounds.height) -
current_state.margin.bottom); @intCast(i32, current_state.desired_height) -
// TODO(wlroots) this type has been corrected to i32 for the next release
@intCast(i32, current_state.margin.bottom);
new_box.height = current_state.desired_height; new_box.height = current_state.desired_height;
} }