From 0ad469178a604e324318a591f32178773805a810 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 31 Jul 2021 22:57:03 -0400 Subject: [PATCH] [client] wayland: make it possible to disable fractional scaling The method used is not guaranteed to work on all Wayland compositors, so offer a way out. We need to support it anyways in case xdg_output or wp_viewporter protocols are not available. --- client/displayservers/Wayland/output.c | 2 +- client/displayservers/Wayland/wayland.c | 10 +++++++++- client/displayservers/Wayland/wayland.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/displayservers/Wayland/output.c b/client/displayservers/Wayland/output.c index 1214b4b8..b15db679 100644 --- a/client/displayservers/Wayland/output.c +++ b/client/displayservers/Wayland/output.c @@ -31,7 +31,7 @@ static void outputUpdateScale(struct WaylandOutput * node) { wl_fixed_t original = node->scale; - if (!wlWm.viewporter || !node->logicalWidth || !node->logicalHeight) + if (!wlWm.useFractionalScale || !wlWm.viewporter || !node->logicalWidth) node->scale = wl_fixed_from_int(node->scaleInt); else { diff --git a/client/displayservers/Wayland/wayland.c b/client/displayservers/Wayland/wayland.c index 0ee9a292..f7d95769 100644 --- a/client/displayservers/Wayland/wayland.c +++ b/client/displayservers/Wayland/wayland.c @@ -37,6 +37,13 @@ static struct Option waylandOptions[] = .type = OPTION_TYPE_BOOL, .value.x_bool = true, }, + { + .module = "wayland", + .name = "fractionScale", + .description = "Enable fractional scale", + .type = OPTION_TYPE_BOOL, + .value.x_bool = true, + }, {0} }; @@ -66,7 +73,8 @@ static bool waylandInit(const LG_DSInitParams params) memset(&wlWm, 0, sizeof(wlWm)); wl_list_init(&wlWm.surfaceOutputs); - wlWm.warpSupport = option_get_bool("wayland", "warpSupport"); + wlWm.warpSupport = option_get_bool("wayland", "warpSupport"); + wlWm.useFractionalScale = option_get_bool("wayland", "fractionScale"); wlWm.display = wl_display_connect(NULL); wlWm.width = params.w; diff --git a/client/displayservers/Wayland/wayland.h b/client/displayservers/Wayland/wayland.h index 31a6de87..56c72abb 100644 --- a/client/displayservers/Wayland/wayland.h +++ b/client/displayservers/Wayland/wayland.h @@ -174,6 +174,7 @@ struct WaylandDSState struct zxdg_output_manager_v1 * xdgOutputManager; struct wl_list outputs; // WaylandOutput::link struct wl_list surfaceOutputs; // SurfaceOutput::link + bool useFractionalScale; struct wl_list poll; // WaylandPoll::link struct wl_list pollFree; // WaylandPoll::link