From 475a0132a99aa7c576a399fdee920aa3ecadeff9 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 11 Dec 2017 21:47:40 +0100 Subject: [PATCH] Use custom modes when output has no mode --- sway/config/output.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sway/config/output.c b/sway/config/output.c index 027a79cef..e6e680d3d 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -69,8 +69,14 @@ void merge_output_config(struct output_config *dst, struct output_config *src) { static void set_mode(struct wlr_output *output, int width, int height, float refresh_rate) { - struct wlr_output_mode *mode, *best = NULL; int mhz = (int)(refresh_rate * 1000); + if (wl_list_empty(&output->modes)) { + sway_log(L_DEBUG, "Assigning custom mode to %s", output->name); + wlr_output_set_custom_mode(output, width, height, mhz); + return; + } + + struct wlr_output_mode *mode, *best = NULL; wl_list_for_each(mode, &output->modes, link) { if (mode->width == width && mode->height == height) { if (mode->refresh == mhz) { @@ -99,6 +105,8 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { } if (oc && oc->width > 0 && oc->height > 0) { + sway_log(L_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, + oc->height, oc->refresh_rate); set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); } if (oc && oc->scale > 0) {