aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Ryan Walklin <ryan@testtoast.com>2019-03-20 14:47:29 +1100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-03-19 23:58:47 -0400
commitbdb402404cd6d54242b0b1dc2360cfc5679e52f2 (patch)
tree5a355e025c24b3de0bc69db4b8cc9d002bbd1167 /sway/input/seat.c
parentClean up focus follows mouse logic (diff)
downloadsway-bdb402404cd6d54242b0b1dc2360cfc5679e52f2.tar.gz
sway-bdb402404cd6d54242b0b1dc2360cfc5679e52f2.tar.zst
sway-bdb402404cd6d54242b0b1dc2360cfc5679e52f2.zip
Support WLR_INPUT_DEVICE_SWITCH in sway
This commit adds support for laptop lid and tablet mode switches as provided by evdev/libinput and handled by wlroots. Adds a new bindswitch command with syntax: bindswitch <switch>:<state> <command> Where <switch> is one of: tablet for WLR_SWITCH_TYPE_TABLET_MODE lid for WLR_SWITCH_TYPE_LID <state> is one of: on for WLR_SWITCH_STATE_ON off for WLR_SWITCH_STATE_OFF toggle for WLR_SWITCH_STATE_TOGGLE (Note that WLR_SWITCH_STATE_TOGGLE doesn't map to libinput and will trigger at both on and off events)
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 7fc87ee4..d58ff9e6 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -15,6 +15,7 @@
15#include "sway/input/input-manager.h" 15#include "sway/input/input-manager.h"
16#include "sway/input/keyboard.h" 16#include "sway/input/keyboard.h"
17#include "sway/input/seat.h" 17#include "sway/input/seat.h"
18#include "sway/input/switch.h"
18#include "sway/ipc-server.h" 19#include "sway/ipc-server.h"
19#include "sway/layers.h" 20#include "sway/layers.h"
20#include "sway/output.h" 21#include "sway/output.h"
@@ -482,8 +483,8 @@ static void seat_update_capabilities(struct sway_seat *seat) {
482 case WLR_INPUT_DEVICE_TABLET_TOOL: 483 case WLR_INPUT_DEVICE_TABLET_TOOL:
483 caps |= WL_SEAT_CAPABILITY_POINTER; 484 caps |= WL_SEAT_CAPABILITY_POINTER;
484 break; 485 break;
485 case WLR_INPUT_DEVICE_TABLET_PAD:
486 case WLR_INPUT_DEVICE_SWITCH: 486 case WLR_INPUT_DEVICE_SWITCH:
487 case WLR_INPUT_DEVICE_TABLET_PAD:
487 break; 488 break;
488 } 489 }
489 } 490 }
@@ -570,6 +571,15 @@ static void seat_configure_keyboard(struct sway_seat *seat,
570 } 571 }
571} 572}
572 573
574static void seat_configure_switch(struct sway_seat *seat,
575 struct sway_seat_device *seat_device) {
576 if (!seat_device->switch_device) {
577 sway_switch_create(seat, seat_device);
578 }
579 seat_apply_input_config(seat, seat_device);
580 sway_switch_configure(seat_device->switch_device);
581}
582
573static void seat_configure_touch(struct sway_seat *seat, 583static void seat_configure_touch(struct sway_seat *seat,
574 struct sway_seat_device *sway_device) { 584 struct sway_seat_device *sway_device) {
575 wlr_cursor_attach_input_device(seat->cursor->cursor, 585 wlr_cursor_attach_input_device(seat->cursor->cursor,
@@ -611,6 +621,9 @@ void seat_configure_device(struct sway_seat *seat,
611 case WLR_INPUT_DEVICE_KEYBOARD: 621 case WLR_INPUT_DEVICE_KEYBOARD:
612 seat_configure_keyboard(seat, seat_device); 622 seat_configure_keyboard(seat, seat_device);
613 break; 623 break;
624 case WLR_INPUT_DEVICE_SWITCH:
625 seat_configure_switch(seat, seat_device);
626 break;
614 case WLR_INPUT_DEVICE_TOUCH: 627 case WLR_INPUT_DEVICE_TOUCH:
615 seat_configure_touch(seat, seat_device); 628 seat_configure_touch(seat, seat_device);
616 break; 629 break;
@@ -620,9 +633,6 @@ void seat_configure_device(struct sway_seat *seat,
620 case WLR_INPUT_DEVICE_TABLET_PAD: 633 case WLR_INPUT_DEVICE_TABLET_PAD:
621 sway_log(SWAY_DEBUG, "TODO: configure tablet pad"); 634 sway_log(SWAY_DEBUG, "TODO: configure tablet pad");
622 break; 635 break;
623 case WLR_INPUT_DEVICE_SWITCH:
624 sway_log(SWAY_DEBUG, "TODO: configure switch device");
625 break;
626 } 636 }
627} 637}
628 638