[client] wayland: use round half away from zero behaviour
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

In fractional-scale-v1, the scaling is defined as follows:

> For toplevel surfaces, the size is rounded halfway away from zero.

Previously, it is undefined. This commit makes waylandScaleMulInt follow
the round half away from zero behaviour.
This commit is contained in:
Quantum
2026-06-03 20:44:16 -04:00
committed by Geoffrey McRae
parent 938a2a6c22
commit c8edf1eaf3

View File

@@ -71,7 +71,7 @@ static inline int waylandScaleCeil(struct WaylandScale scale)
static inline int waylandScaleMulInt(struct WaylandScale scale, int value)
{
return (int)(((int64_t)value * scale.num) / scale.den);
return (int)(((int64_t)value * scale.num + scale.den / 2) / scale.den);
}
static inline double waylandScaleToDouble(struct WaylandScale scale)