aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-05-27 00:22:14 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-06-03 08:30:28 -0400
commit260ea42128c763e415e6957fb0d34cc3ab7fac8b (patch)
tree77fe88872dc33704b484fb504724f3160ef077f5
parentUpdate output manager config on all output events (diff)
downloadsway-260ea42128c763e415e6957fb0d34cc3ab7fac8b.tar.gz
sway-260ea42128c763e415e6957fb0d34cc3ab7fac8b.tar.zst
sway-260ea42128c763e415e6957fb0d34cc3ab7fac8b.zip
input/switch: fix indentation of file
This just changes the indentation of `sway/input/switch.c` to use tabs instead of spaces since I messed up and missed it when approving the PR that added the file.
-rw-r--r--sway/input/switch.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/sway/input/switch.c b/sway/input/switch.c
index d56e6525..a8769713 100644
--- a/sway/input/switch.c
+++ b/sway/input/switch.c
@@ -5,81 +5,81 @@
5#include "log.h" 5#include "log.h"
6 6
7struct sway_switch *sway_switch_create(struct sway_seat *seat, 7struct sway_switch *sway_switch_create(struct sway_seat *seat,
8 struct sway_seat_device *device) { 8 struct sway_seat_device *device) {
9 struct sway_switch *switch_device = 9 struct sway_switch *switch_device =
10 calloc(1, sizeof(struct sway_switch)); 10 calloc(1, sizeof(struct sway_switch));
11 if (!sway_assert(switch_device, "could not allocate switch")) { 11 if (!sway_assert(switch_device, "could not allocate switch")) {
12 return NULL; 12 return NULL;
13 } 13 }
14 device->switch_device = switch_device; 14 device->switch_device = switch_device;
15 switch_device->seat_device = device; 15 switch_device->seat_device = device;
16 wl_list_init(&switch_device->switch_toggle.link); 16 wl_list_init(&switch_device->switch_toggle.link);
17 sway_log(SWAY_DEBUG, "Allocated switch for device"); 17 sway_log(SWAY_DEBUG, "Allocated switch for device");
18 18
19 return switch_device; 19 return switch_device;
20} 20}
21 21
22static void handle_switch_toggle(struct wl_listener *listener, void *data) { 22static void handle_switch_toggle(struct wl_listener *listener, void *data) {
23 struct sway_switch *sway_switch = 23 struct sway_switch *sway_switch =
24 wl_container_of(listener, sway_switch, switch_toggle); 24 wl_container_of(listener, sway_switch, switch_toggle);
25 struct sway_seat* seat = sway_switch->seat_device->sway_seat; 25 struct sway_seat* seat = sway_switch->seat_device->sway_seat;
26 struct wlr_seat *wlr_seat = seat->wlr_seat; 26 struct wlr_seat *wlr_seat = seat->wlr_seat;
27 struct wlr_input_device *wlr_device = 27 struct wlr_input_device *wlr_device =
28 sway_switch->seat_device->input_device->wlr_device; 28 sway_switch->seat_device->input_device->wlr_device;
29 29
30 wlr_idle_notify_activity(server.idle, wlr_seat); 30 wlr_idle_notify_activity(server.idle, wlr_seat);
31 bool input_inhibited = seat->exclusive_client != NULL; 31 bool input_inhibited = seat->exclusive_client != NULL;
32 32
33 char *device_identifier = input_device_get_identifier(wlr_device); 33 char *device_identifier = input_device_get_identifier(wlr_device);
34 34
35 struct wlr_event_switch_toggle *event = data; 35 struct wlr_event_switch_toggle *event = data;
36 enum wlr_switch_type type = event->switch_type; 36 enum wlr_switch_type type = event->switch_type;
37 enum wlr_switch_state state = event->switch_state; 37 enum wlr_switch_state state = event->switch_state;
38 sway_log(SWAY_DEBUG, "%s: type %d state %d", device_identifier, type, state); 38 sway_log(SWAY_DEBUG, "%s: type %d state %d", device_identifier, type, state);
39 39
40 list_t *bindings = config->current_mode->switch_bindings; 40 list_t *bindings = config->current_mode->switch_bindings;
41 for (int i = 0; i < bindings->length; ++i) { 41 for (int i = 0; i < bindings->length; ++i) {
42 struct sway_switch_binding *binding = bindings->items[i]; 42 struct sway_switch_binding *binding = bindings->items[i];
43 if (binding->type != type) { 43 if (binding->type != type) {
44 continue; 44 continue;
45 } 45 }
46 if (binding->state != WLR_SWITCH_STATE_TOGGLE && 46 if (binding->state != WLR_SWITCH_STATE_TOGGLE &&
47 binding->state != state) { 47 binding->state != state) {
48 continue; 48 continue;
49 } 49 }
50 bool binding_locked = binding->flags & BINDING_LOCKED; 50 bool binding_locked = binding->flags & BINDING_LOCKED;
51 if (!binding_locked && input_inhibited) { 51 if (!binding_locked && input_inhibited) {
52 continue; 52 continue;
53 } 53 }
54 54
55 struct sway_binding *dummy_binding = calloc(1, sizeof(struct sway_binding)); 55 struct sway_binding *dummy_binding = calloc(1, sizeof(struct sway_binding));
56 dummy_binding->type = BINDING_SWITCH; 56 dummy_binding->type = BINDING_SWITCH;
57 dummy_binding->flags = binding->flags; 57 dummy_binding->flags = binding->flags;
58 dummy_binding->command = binding->command; 58 dummy_binding->command = binding->command;
59 59
60 seat_execute_command(seat, dummy_binding); 60 seat_execute_command(seat, dummy_binding);
61 free(dummy_binding); 61 free(dummy_binding);
62 } 62 }
63 63
64 transaction_commit_dirty(); 64 transaction_commit_dirty();
65 65
66 free(device_identifier); 66 free(device_identifier);
67} 67}
68 68
69void sway_switch_configure(struct sway_switch *sway_switch) { 69void sway_switch_configure(struct sway_switch *sway_switch) {
70 struct wlr_input_device *wlr_device = 70 struct wlr_input_device *wlr_device =
71 sway_switch->seat_device->input_device->wlr_device; 71 sway_switch->seat_device->input_device->wlr_device;
72 wl_list_remove(&sway_switch->switch_toggle.link); 72 wl_list_remove(&sway_switch->switch_toggle.link);
73 wl_signal_add(&wlr_device->switch_device->events.toggle, 73 wl_signal_add(&wlr_device->switch_device->events.toggle,
74 &sway_switch->switch_toggle); 74 &sway_switch->switch_toggle);
75 sway_switch->switch_toggle.notify = handle_switch_toggle; 75 sway_switch->switch_toggle.notify = handle_switch_toggle;
76 sway_log(SWAY_DEBUG, "Configured switch for device"); 76 sway_log(SWAY_DEBUG, "Configured switch for device");
77} 77}
78 78
79void sway_switch_destroy(struct sway_switch *sway_switch) { 79void sway_switch_destroy(struct sway_switch *sway_switch) {
80 if (!sway_switch) { 80 if (!sway_switch) {
81 return; 81 return;
82 } 82 }
83 wl_list_remove(&sway_switch->switch_toggle.link); 83 wl_list_remove(&sway_switch->switch_toggle.link);
84 free(sway_switch); 84 free(sway_switch);
85} 85}