diff options
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 25 | 
1 files changed, 6 insertions, 19 deletions
@@ -217,11 +217,6 @@ 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 { @@ -922,7 +917,6 @@ 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; @@ -951,23 +945,16 @@ 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);  | 
