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 | |
parent | Merge pull request #1901 from swaywm/touch-hide-cursor (diff) | |
parent | Default to backend-wise input device mapping, if any (diff) | |
download | sway-029c9b179664428db9940fe68632bbf19c3d5018.tar.gz sway-029c9b179664428db9940fe68632bbf19c3d5018.tar.zst sway-029c9b179664428db9940fe68632bbf19c3d5018.zip |
Merge pull request #1907 from emersion/backend-input-mapping
Default to backend-wise input device mapping, if any
-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, | |||
263 | 263 | ||
264 | static void seat_apply_input_config(struct sway_seat *seat, | 264 | static void seat_apply_input_config(struct sway_seat *seat, |
265 | struct sway_seat_device *sway_device) { | 265 | struct sway_seat_device *sway_device) { |
266 | const char *mapped_to_output = NULL; | ||
267 | |||
266 | struct input_config *ic = input_device_get_config( | 268 | struct input_config *ic = input_device_get_config( |
267 | sway_device->input_device); | 269 | sway_device->input_device); |
268 | if (!ic) { | 270 | if (ic != NULL) { |
269 | return; | 271 | wlr_log(L_DEBUG, "Applying input config to %s", |
270 | } | ||
271 | wlr_log(L_DEBUG, "Applying input config to %s", | ||
272 | sway_device->input_device->identifier); | 272 | sway_device->input_device->identifier); |
273 | if (ic->mapped_to_output) { | 273 | |
274 | mapped_to_output = ic->mapped_to_output; | ||
275 | } | ||
276 | |||
277 | if (mapped_to_output == NULL) { | ||
278 | mapped_to_output = sway_device->input_device->wlr_device->output_name; | ||
279 | } | ||
280 | if (mapped_to_output != NULL) { | ||
281 | wlr_log(L_DEBUG, "Mapping input device %s to output %s", | ||
282 | sway_device->input_device->identifier, mapped_to_output); | ||
274 | struct sway_container *output = NULL; | 283 | struct sway_container *output = NULL; |
275 | for (int i = 0; i < root_container.children->length; ++i) { | 284 | for (int i = 0; i < root_container.children->length; ++i) { |
276 | struct sway_container *_output = root_container.children->items[i]; | 285 | struct sway_container *_output = root_container.children->items[i]; |
277 | if (strcasecmp(_output->name, ic->mapped_to_output) == 0) { | 286 | if (strcasecmp(_output->name, mapped_to_output) == 0) { |
278 | output = _output; | 287 | output = _output; |
279 | break; | 288 | break; |
280 | } | 289 | } |