diff options
author | emersion <contact@emersion.fr> | 2017-12-11 21:47:40 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-12-11 21:47:40 +0100 |
commit | 475a0132a99aa7c576a399fdee920aa3ecadeff9 (patch) | |
tree | 2f9bbf02bacdf9b5d41eeeebb59dcad158c58f60 /sway/config | |
parent | Remove output from layout (diff) | |
download | sway-475a0132a99aa7c576a399fdee920aa3ecadeff9.tar.gz sway-475a0132a99aa7c576a399fdee920aa3ecadeff9.tar.zst sway-475a0132a99aa7c576a399fdee920aa3ecadeff9.zip |
Use custom modes when output has no mode
Diffstat (limited to 'sway/config')
-rw-r--r-- | sway/config/output.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 027a79ce..e6e680d3 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) { | |||
69 | 69 | ||
70 | static void set_mode(struct wlr_output *output, int width, int height, | 70 | static void set_mode(struct wlr_output *output, int width, int height, |
71 | float refresh_rate) { | 71 | float refresh_rate) { |
72 | struct wlr_output_mode *mode, *best = NULL; | ||
73 | int mhz = (int)(refresh_rate * 1000); | 72 | int mhz = (int)(refresh_rate * 1000); |
73 | if (wl_list_empty(&output->modes)) { | ||
74 | sway_log(L_DEBUG, "Assigning custom mode to %s", output->name); | ||
75 | wlr_output_set_custom_mode(output, width, height, mhz); | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | struct wlr_output_mode *mode, *best = NULL; | ||
74 | wl_list_for_each(mode, &output->modes, link) { | 80 | wl_list_for_each(mode, &output->modes, link) { |
75 | if (mode->width == width && mode->height == height) { | 81 | if (mode->width == width && mode->height == height) { |
76 | if (mode->refresh == mhz) { | 82 | if (mode->refresh == mhz) { |
@@ -99,6 +105,8 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { | |||
99 | } | 105 | } |
100 | 106 | ||
101 | if (oc && oc->width > 0 && oc->height > 0) { | 107 | if (oc && oc->width > 0 && oc->height > 0) { |
108 | sway_log(L_DEBUG, "Set %s mode to %dx%d (%f GHz)", oc->name, oc->width, | ||
109 | oc->height, oc->refresh_rate); | ||
102 | set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); | 110 | set_mode(wlr_output, oc->width, oc->height, oc->refresh_rate); |
103 | } | 111 | } |
104 | if (oc && oc->scale > 0) { | 112 | if (oc && oc->scale > 0) { |