aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-04-08 14:15:13 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-04-08 15:09:12 -0400
commit0e3ddf255ef56b7fe2b868232b80d04ea961120b (patch)
treecd650869ccbeca085a022d7aceb97d5e581ff3bf /sway/input/seat.c
parentMerge pull request #1778 from swaywm/fix-cursor (diff)
downloadsway-0e3ddf255ef56b7fe2b868232b80d04ea961120b.tar.gz
sway-0e3ddf255ef56b7fe2b868232b80d04ea961120b.tar.zst
sway-0e3ddf255ef56b7fe2b868232b80d04ea961120b.zip
Add input "identifier" map_to_output "identifier"
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index d9b42828..7b01fe88 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -1,6 +1,7 @@
1#define _XOPEN_SOURCE 700 1#define _XOPEN_SOURCE 700
2#define _POSIX_C_SOURCE 199309L 2#define _POSIX_C_SOURCE 199309L
3#include <assert.h> 3#include <assert.h>
4#include <strings.h>
4#include <time.h> 5#include <time.h>
5#include <wlr/types/wlr_cursor.h> 6#include <wlr/types/wlr_cursor.h>
6#include <wlr/types/wlr_output_layout.h> 7#include <wlr/types/wlr_output_layout.h>
@@ -219,10 +220,38 @@ struct sway_seat *seat_create(struct sway_input_manager *input,
219 return seat; 220 return seat;
220} 221}
221 222
223static void seat_apply_input_config(struct sway_seat *seat,
224 struct sway_seat_device *sway_device) {
225 struct input_config *ic = input_device_get_config(
226 sway_device->input_device);
227 if (!ic) {
228 return;
229 }
230 wlr_log(L_DEBUG, "Applying input config to %s",
231 sway_device->input_device->identifier);
232 if (ic->mapped_output) {
233 struct sway_container *output = NULL;
234 for (int i = 0; i < root_container.children->length; ++i) {
235 struct sway_container *_output = root_container.children->items[i];
236 if (strcasecmp(_output->name, ic->mapped_output) == 0) {
237 output = _output;
238 break;
239 }
240 }
241 if (output) {
242 wlr_cursor_map_input_to_output(seat->cursor->cursor,
243 sway_device->input_device->wlr_device,
244 output->sway_output->wlr_output);
245 wlr_log(L_DEBUG, "Mapped to output %s", output->name);
246 }
247 }
248}
249
222static void seat_configure_pointer(struct sway_seat *seat, 250static void seat_configure_pointer(struct sway_seat *seat,
223 struct sway_seat_device *sway_device) { 251 struct sway_seat_device *sway_device) {
224 wlr_cursor_attach_input_device(seat->cursor->cursor, 252 wlr_cursor_attach_input_device(seat->cursor->cursor,
225 sway_device->input_device->wlr_device); 253 sway_device->input_device->wlr_device);
254 seat_apply_input_config(seat, sway_device);
226} 255}
227 256
228static void seat_configure_keyboard(struct sway_seat *seat, 257static void seat_configure_keyboard(struct sway_seat *seat,
@@ -249,6 +278,7 @@ static void seat_configure_tablet_tool(struct sway_seat *seat,
249 struct sway_seat_device *sway_device) { 278 struct sway_seat_device *sway_device) {
250 wlr_cursor_attach_input_device(seat->cursor->cursor, 279 wlr_cursor_attach_input_device(seat->cursor->cursor,
251 sway_device->input_device->wlr_device); 280 sway_device->input_device->wlr_device);
281 seat_apply_input_config(seat, sway_device);
252} 282}
253 283
254static struct sway_seat_device *seat_get_device(struct sway_seat *seat, 284static struct sway_seat_device *seat_get_device(struct sway_seat *seat,