Kanshi Scale Issue -- Numerical Precision vs swaymsg / IPC
jameswalmsley opened this issue · 4 comments
Please see this issue:
I've noticed that setting a scale for an output in kanshi vs directly with
swaymsg results in a different "rect" from swaymsg -t get_outputs.
My solution so far was to add an exec command to each profile to set the
scale individually.
J
This is a Sway bug.
Hi @emersion I've been looking at the cause of this.
The scale is converted to a fixed type on the wayland protocol.
This is 24-bits of integer, and only 8-bits of decimal precision.
I guess that's where the precision is lost.
The protocol would have to send the scale as e.g. a string or pack the float into
and int32 to keep the precision.
I'll make a PR to test this and see what the you all over at sway think.
Can imagine you don't want to break the wayland type system.
Even if there are rounding errors with the scale (which isn't a big deal IMHO), the rects should have the same size.
Thanks for the quick responses.
I've created an issue demonstrating the rounding error with the wlr-output-management
protocol.