1
0
Fork 0
forked from wry/wry

layer-shell: take margin into account when centering

This commit is contained in:
Julian Orth 2025-12-21 19:45:46 +01:00
parent af0477f327
commit 16bb83df24

View file

@ -501,14 +501,14 @@ impl ZwlrLayerSurfaceV1 {
let mut x1 = 0; let mut x1 = 0;
let mut y1 = 0; let mut y1 = 0;
if anchor.contains(LEFT | RIGHT) { if anchor.contains(LEFT | RIGHT) {
x1 = (owidth - width) / 2; x1 = ml + (owidth - width - ml - mr) / 2;
} else if anchor.contains(LEFT) { } else if anchor.contains(LEFT) {
x1 = ml; x1 = ml;
} else if anchor.contains(RIGHT) { } else if anchor.contains(RIGHT) {
x1 = owidth - width - mr; x1 = owidth - width - mr;
} }
if anchor.contains(TOP | BOTTOM) { if anchor.contains(TOP | BOTTOM) {
y1 = (oheight - height) / 2; y1 = mt + (oheight - height - mt - mb) / 2;
} else if anchor.contains(TOP) { } else if anchor.contains(TOP) {
y1 = mt; y1 = mt;
} else if anchor.contains(BOTTOM) { } else if anchor.contains(BOTTOM) {