aboutsummaryrefslogtreecommitdiff
path: root/sway/config
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-20 18:56:43 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2023-02-22 10:14:31 -0500
commit423459723bc488b69aa6fafcc9aa4e13fdf92717 (patch)
tree5df50f9f14a7f9f0238f5eef6f9043a4717b2bee /sway/config
parent4666d1785bfb6635e6e8604de383c91714bceebc (diff)
Adjust scale for fractional-scale-v1
Diffstat (limited to 'sway/config')
-rw-r--r--sway/config/output.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index e2e48e4c..3b524433 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -460,6 +460,16 @@ static void queue_output_config(struct output_config *oc,
float scale;
if (oc && oc->scale > 0) {
scale = oc->scale;
+
+ // The factional-scale-v1 protocol uses increments of 120ths to send
+ // the scale factor to the client. Adjust the scale so that we use the
+ // same value as the clients'.
+ float adjusted_scale = round(scale * 120) / 120;
+ if (scale != adjusted_scale) {
+ sway_log(SWAY_INFO, "Adjusting output scale from %f to %f",
+ scale, adjusted_scale);
+ scale = adjusted_scale;
+ }
} else {
scale = compute_default_scale(wlr_output, pending);
sway_log(SWAY_DEBUG, "Auto-detected output scale: %f", scale);