diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2024-05-04 20:30:20 +0530 |
|---|---|---|
| committer | Raghuram Subramani <raghus2247@gmail.com> | 2024-05-04 20:30:20 +0530 |
| commit | 18e363b5bb655859660eb6177fadc67192914f61 (patch) | |
| tree | 11c320379bc3c1166b3e7bd4128b0f91ab7e7822 /dwl.c | |
| parent | fcc65f28ec1c295ac38d8944aca30afd25b56560 (diff) | |
monfig patch
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -217,6 +217,11 @@ typedef struct { const Layout *lt; enum wl_output_transform rr; int x, y; + int resx; + int resy; + float rate; + int mode; + int adaptive; } MonitorRule; typedef struct { @@ -917,6 +922,7 @@ 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 = wl_container_of(wlr_output->modes.next, mode, link); const MonitorRule *r; size_t i; struct wlr_output_state state; @@ -945,16 +951,23 @@ createmon(struct wl_listener *listener, void *data) strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol)); wlr_output_state_set_scale(&state, r->scale); wlr_output_state_set_transform(&state, r->rr); + + wlr_output_state_set_adaptive_sync_enabled(&state, r->adaptive); + + if(r->mode == -1) + wlr_output_state_set_custom_mode(&state, r->resx, r->resy, + (int) (r->rate > 0 ? r->rate * 1000 : 0)); + else if (!wl_list_empty(&wlr_output->modes)) { + for (int j = 0; j < r->mode; j++) { + mode = wl_container_of(mode->link.next, mode, link); + } + wlr_output_state_set_mode(&state, mode); + } + break; } } - /* 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_state_set_mode(&state, wlr_output_preferred_mode(wlr_output)); - /* Set up event listeners */ LISTEN(&wlr_output->events.frame, &m->frame, rendermon); LISTEN(&wlr_output->events.destroy, &m->destroy, cleanupmon); |
