aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/switch.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/switch.c')
-rw-r--r--sway/input/switch.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sway/input/switch.c b/sway/input/switch.c
index ac4baece..831f4dbf 100644
--- a/sway/input/switch.c
+++ b/sway/input/switch.c
@@ -1,6 +1,5 @@
1#include "sway/config.h" 1#include "sway/config.h"
2#include "sway/input/switch.h" 2#include "sway/input/switch.h"
3#include <wlr/types/wlr_idle.h>
4#include "log.h" 3#include "log.h"
5 4
6struct sway_switch *sway_switch_create(struct sway_seat *seat, 5struct sway_switch *sway_switch_create(struct sway_seat *seat,
@@ -11,6 +10,7 @@ struct sway_switch *sway_switch_create(struct sway_seat *seat,
11 return NULL; 10 return NULL;
12 } 11 }
13 device->switch_device = switch_device; 12 device->switch_device = switch_device;
13 switch_device->wlr = wlr_switch_from_input_device(device->input_device->wlr_device);
14 switch_device->seat_device = device; 14 switch_device->seat_device = device;
15 switch_device->state = WLR_SWITCH_STATE_OFF; 15 switch_device->state = WLR_SWITCH_STATE_OFF;
16 wl_list_init(&switch_device->switch_toggle.link); 16 wl_list_init(&switch_device->switch_toggle.link);
@@ -33,9 +33,8 @@ static bool sway_switch_trigger_test(enum sway_switch_trigger trigger,
33} 33}
34 34
35static void execute_binding(struct sway_switch *sway_switch) { 35static void execute_binding(struct sway_switch *sway_switch) {
36 struct sway_seat* seat = sway_switch->seat_device->sway_seat; 36 struct sway_seat *seat = sway_switch->seat_device->sway_seat;
37 bool input_inhibited = seat->exclusive_client != NULL || 37 bool locked = server.session_lock.lock;
38 server.session_lock.locked;
39 38
40 list_t *bindings = config->current_mode->switch_bindings; 39 list_t *bindings = config->current_mode->switch_bindings;
41 struct sway_switch_binding *matched_binding = NULL; 40 struct sway_switch_binding *matched_binding = NULL;
@@ -52,13 +51,13 @@ static void execute_binding(struct sway_switch *sway_switch) {
52 continue; 51 continue;
53 } 52 }
54 bool binding_locked = binding->flags & BINDING_LOCKED; 53 bool binding_locked = binding->flags & BINDING_LOCKED;
55 if (!binding_locked && input_inhibited) { 54 if (!binding_locked && locked) {
56 continue; 55 continue;
57 } 56 }
58 57
59 matched_binding = binding; 58 matched_binding = binding;
60 59
61 if (binding_locked == input_inhibited) { 60 if (binding_locked == locked) {
62 break; 61 break;
63 } 62 }
64 } 63 }
@@ -95,10 +94,8 @@ static void handle_switch_toggle(struct wl_listener *listener, void *data) {
95} 94}
96 95
97void sway_switch_configure(struct sway_switch *sway_switch) { 96void sway_switch_configure(struct sway_switch *sway_switch) {
98 struct wlr_input_device *wlr_device =
99 sway_switch->seat_device->input_device->wlr_device;
100 wl_list_remove(&sway_switch->switch_toggle.link); 97 wl_list_remove(&sway_switch->switch_toggle.link);
101 wl_signal_add(&wlr_device->switch_device->events.toggle, 98 wl_signal_add(&sway_switch->wlr->events.toggle,
102 &sway_switch->switch_toggle); 99 &sway_switch->switch_toggle);
103 sway_switch->switch_toggle.notify = handle_switch_toggle; 100 sway_switch->switch_toggle.notify = handle_switch_toggle;
104 sway_log(SWAY_DEBUG, "Configured switch for device"); 101 sway_log(SWAY_DEBUG, "Configured switch for device");