diff options
| author | Drew DeVault <sir@cmpwn.com> | 2018-05-03 10:46:02 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-03 10:46:02 -0400 | 
| commit | 029c9b179664428db9940fe68632bbf19c3d5018 (patch) | |
| tree | d90343481516f3c5fe104d369eb8bf698af935ec /sway/input | |
| parent | 812525246a362aa29c994a3c69b18ddecc98f015 (diff) | |
| parent | 424006089e5a61ef7649c14324c3fb5c3bec32ca (diff) | |
| download | sway-029c9b179664428db9940fe68632bbf19c3d5018.tar.xz | |
Merge pull request #1907 from emersion/backend-input-mapping
Default to backend-wise input device mapping, if any
Diffstat (limited to 'sway/input')
| -rw-r--r-- | sway/input/seat.c | 21 | 
1 files changed, 15 insertions, 6 deletions
| diff --git a/sway/input/seat.c b/sway/input/seat.c index e8bd6b36..443fe367 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -263,18 +263,27 @@ struct sway_seat *seat_create(struct sway_input_manager *input,  static void seat_apply_input_config(struct sway_seat *seat,  		struct sway_seat_device *sway_device) { +	const char *mapped_to_output = NULL; +  	struct input_config *ic = input_device_get_config(  			sway_device->input_device); -	if (!ic) { -		return; -	} -	wlr_log(L_DEBUG, "Applying input config to %s", +	if (ic != NULL) { +		wlr_log(L_DEBUG, "Applying input config to %s",  			sway_device->input_device->identifier); -	if (ic->mapped_to_output) { + +		mapped_to_output = ic->mapped_to_output; +	} + +	if (mapped_to_output == NULL) { +		mapped_to_output = sway_device->input_device->wlr_device->output_name; +	} +	if (mapped_to_output != NULL) { +		wlr_log(L_DEBUG, "Mapping input device %s to output %s", +			sway_device->input_device->identifier, mapped_to_output);  		struct sway_container *output = NULL;  		for (int i = 0; i < root_container.children->length; ++i) {  			struct sway_container *_output = root_container.children->items[i]; -			if (strcasecmp(_output->name, ic->mapped_to_output) == 0) { +			if (strcasecmp(_output->name, mapped_to_output) == 0) {  				output = _output;  				break;  			} | 
