diff options
| author | emersion <contact@emersion.fr> | 2018-01-04 15:48:28 +0100 | 
|---|---|---|
| committer | emersion <contact@emersion.fr> | 2018-01-04 15:48:28 +0100 | 
| commit | be3a7b0017823d80cd50c830d788a96e0e0ef6e8 (patch) | |
| tree | 5e9aa84b5c7287cf7585366553854474ffa71f7f | |
| parent | d9ecfbaf325f66b15d60d0f8c4fe08a939cb6576 (diff) | |
| download | wlroots-be3a7b0017823d80cd50c830d788a96e0e0ef6e8.tar.xz | |
Disable outputs in rootston config
| -rw-r--r-- | include/rootston/config.h | 1 | ||||
| -rw-r--r-- | rootston/config.c | 11 | ||||
| -rw-r--r-- | rootston/output.c | 21 | 
3 files changed, 24 insertions, 9 deletions
| diff --git a/include/rootston/config.h b/include/rootston/config.h index bd24e577..05f23b75 100644 --- a/include/rootston/config.h +++ b/include/rootston/config.h @@ -7,6 +7,7 @@  struct roots_output_config {  	char *name; +	bool enable;  	enum wl_output_transform transform;  	int x, y;  	float scale; diff --git a/rootston/config.c b/rootston/config.c index f9fde369..31bde2b0 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -263,10 +263,19 @@ static int config_ini_handler(void *user, const char *section, const char *name,  			oc->name = strdup(output_name);  			oc->transform = WL_OUTPUT_TRANSFORM_NORMAL;  			oc->scale = 1; +			oc->enable = true;  			wl_list_insert(&config->outputs, &oc->link);  		} -		if (strcmp(name, "x") == 0) { +		if (strcmp(name, "enable") == 0) { +			if (strcasecmp(value, "true") == 0) { +				oc->enable = true; +			} else if (strcasecmp(value, "false") == 0) { +				oc->enable = false; +			} else { +				wlr_log(L_ERROR, "got invalid output enable value: %s", value); +			} +		} else if (strcmp(name, "x") == 0) {  			oc->x = strtol(value, NULL, 10);  		} else if (strcmp(name, "y") == 0) {  			oc->y = strtol(value, NULL, 10); diff --git a/rootston/output.c b/rootston/output.c index 10450df3..7e05136a 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -324,9 +324,10 @@ void output_add_notify(struct wl_listener *listener, void *data) {  	wlr_log(L_DEBUG, "'%s %s %s' %"PRId32"mm x %"PRId32"mm", wlr_output->make,  		wlr_output->model, wlr_output->serial, wlr_output->phys_width,  		wlr_output->phys_height); +  	if (wl_list_length(&wlr_output->modes) > 0) { -		struct wlr_output_mode *mode = NULL; -		mode = wl_container_of((&wlr_output->modes)->prev, mode, link); +		struct wlr_output_mode *mode = +			wl_container_of((&wlr_output->modes)->prev, mode, link);  		wlr_output_set_mode(wlr_output, mode);  	} @@ -341,13 +342,17 @@ void output_add_notify(struct wl_listener *listener, void *data) {  	struct roots_output_config *output_config =  		roots_config_get_output(config, wlr_output);  	if (output_config) { -		if (output_config->mode.width) { -			set_mode(wlr_output, output_config); +		if (output_config->enable) { +			if (output_config->mode.width) { +				set_mode(wlr_output, output_config); +			} +			wlr_output_set_scale(wlr_output, output_config->scale); +			wlr_output_set_transform(wlr_output, output_config->transform); +			wlr_output_layout_add(desktop->layout, wlr_output, output_config->x, +				output_config->y); +		} else { +			wlr_output_enable(wlr_output, false);  		} -		wlr_output_set_scale(wlr_output, output_config->scale); -		wlr_output_set_transform(wlr_output, output_config->transform); -		wlr_output_layout_add(desktop->layout, wlr_output, output_config->x, -			output_config->y);  	} else {  		wlr_output_layout_add_auto(desktop->layout, wlr_output);  	} | 
