diff options
author | Drew DeVault <sir@cmpwn.com> | 2017-12-11 08:32:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 08:32:18 -0500 |
commit | 808ab5aa1bd990776ae30d5f9bb171ca7b42d6ef (patch) | |
tree | dbed215e4f235d2458cbab2bbff512dcad0f11a2 /rootston | |
parent | 301850ec5d1a65aed87734583ed0868694f1913a (diff) | |
parent | 529675b7b04a2598f7701d2e05567d8249ea1cfb (diff) |
Merge pull request #481 from emersion/custom-mode
Add wlr_output_set_custom_mode
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/output.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/rootston/output.c b/rootston/output.c index cf2ffdc3..b2d6554d 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -263,8 +263,15 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { static void set_mode(struct wlr_output *output, struct roots_output_config *oc) { - struct wlr_output_mode *mode, *best = NULL; int mhz = (int)(oc->mode.refresh_rate * 1000); + + if (wl_list_empty(&output->modes)) { + // Output has no mode, try setting a custom one + wlr_output_set_custom_mode(output, oc->mode.width, oc->mode.height, mhz); + return; + } + + struct wlr_output_mode *mode, *best = NULL; wl_list_for_each(mode, &output->modes, link) { if (mode->width == oc->mode.width && mode->height == oc->mode.height) { if (mode->refresh == mhz) { |