diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2020-05-03 11:45:47 -0500 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2020-05-03 11:45:47 -0500 |
commit | 1a30d9908dcee989631165deb3bb8780f5e121e5 (patch) | |
tree | 8bf8a3c06d65b426e999a9b80a4bb542cea0fdeb /dwl.c | |
parent | b19afa10f363b3e9dff9966eeccb396cd4285738 (diff) |
no conditional needed for output modes
If the output backend doesn't support modes, get_preferred_mode will
return NULL, and set_mode will accept NULL.
Diffstat (limited to 'dwl.c')
-rw-r--r-- | dwl.c | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -392,22 +392,14 @@ createmon(struct wl_listener *listener, void *data) /* This event is raised by the backend when a new output (aka a display or * monitor) becomes available. */ struct wlr_output *wlr_output = data; - struct wlr_output_mode *mode; Monitor *m; const MonitorRule *r; - /* 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 monitor's preferred mode, a more sophisticated compositor - * would let the user configure it. */ - if (!wl_list_empty(&wlr_output->modes)) { - mode = wlr_output_preferred_mode(wlr_output); - wlr_output_set_mode(wlr_output, mode); - wlr_output_enable(wlr_output, 1); - if (!wlr_output_commit(wlr_output)) - return; - } + /* The mode is a tuple of (width, height, refresh rate), and each + * monitor supports only a specific set of modes. We just pick the + * monitor's preferred mode; a more sophisticated compositor would let + * the user configure it. */ + wlr_output_set_mode(wlr_output, wlr_output_preferred_mode(wlr_output)); /* Allocates and configures monitor state using configured rules */ m = wlr_output->data = calloc(1, sizeof(*m)); @@ -429,6 +421,10 @@ createmon(struct wl_listener *listener, void *data) wl_signal_add(&wlr_output->events.frame, &m->frame); wl_list_insert(&mons, &m->link); + wlr_output_enable(wlr_output, 1); + if (!wlr_output_commit(wlr_output)) + return; + /* Adds this to the output layout. The add_auto function arranges outputs * from left-to-right in the order they appear. A more sophisticated * compositor would let the user configure the arrangement of outputs in the |