diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-28 13:18:38 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-12-30 11:21:11 -0700 |
commit | 31f721286a23851a4fe5f0b6ee4fc324bdd79fef (patch) | |
tree | 9e3b94de3eb191087a3029b6721b5a0502c6f5d1 | |
parent | 8fc16890c713990ca6dbe89b34e70c78564b4a0f (diff) |
tinywl: enable and commit output when modesetting
While at it, choose the preferred mode instead of the last one.
-rw-r--r-- | tinywl/tinywl.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 3ea7d073..e98aaf3f 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -648,12 +648,15 @@ static void server_new_output(struct wl_listener *listener, void *data) { /* Some backends don't have modes. DRM+KMS does, and we need to set a mode * before we can use the output. The mode is a tuple of (width, height, * refresh rate), and each monitor supports only a specific set of modes. We - * just pick the first, a more sophisticated compositor would let the user - * configure it or pick the mode the display advertises as preferred. */ + * just pick the monitor's preferred mode, a more sophisticated compositor + * would let the user configure it. */ if (!wl_list_empty(&wlr_output->modes)) { - struct wlr_output_mode *mode = - wl_container_of(wlr_output->modes.prev, mode, link); + struct wlr_output_mode *mode = wlr_output_preferred_mode(wlr_output); wlr_output_set_mode(wlr_output, mode); + wlr_output_enable(wlr_output, true); + if (!wlr_output_commit(wlr_output)) { + return; + } } /* Allocates and configures our state for this output */ |