aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-02 11:44:42 -0400
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-04-02 11:44:42 -0400
commita82c107c7613548a3ae0e75bb951ba57b7d2f22b (patch)
treec98359e87642355925dc1dda415aeebb1a01e071
parentdont copy seat config on the seat (diff)
downloadsway-a82c107c7613548a3ae0e75bb951ba57b7d2f22b.tar.gz
sway-a82c107c7613548a3ae0e75bb951ba57b7d2f22b.tar.zst
sway-a82c107c7613548a3ae0e75bb951ba57b7d2f22b.zip
80col
-rw-r--r--sway/commands.c14
-rw-r--r--sway/commands/seat.c11
-rw-r--r--sway/input/input-manager.c45
-rw-r--r--sway/input/seat.c18
4 files changed, 57 insertions, 31 deletions
diff --git a/sway/commands.c b/sway/commands.c
index dc6c867f..9e83a401 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -75,20 +75,20 @@ void apply_input_config(struct input_config *input) {
75 input_manager_apply_input_config(input_manager, input); 75 input_manager_apply_input_config(input_manager, input);
76} 76}
77 77
78void apply_seat_config(struct seat_config *seat) { 78void apply_seat_config(struct seat_config *seat_config) {
79 int i; 79 int i;
80 i = list_seq_find(config->seat_configs, seat_name_cmp, seat->name); 80 i = list_seq_find(config->seat_configs, seat_name_cmp, seat_config->name);
81 if (i >= 0) { 81 if (i >= 0) {
82 // merge existing config 82 // merge existing config
83 struct seat_config *sc = config->seat_configs->items[i]; 83 struct seat_config *sc = config->seat_configs->items[i];
84 merge_seat_config(sc, seat); 84 merge_seat_config(sc, seat_config);
85 free_seat_config(seat); 85 free_seat_config(seat_config);
86 seat = sc; 86 seat_config = sc;
87 } else { 87 } else {
88 list_add(config->seat_configs, seat); 88 list_add(config->seat_configs, seat_config);
89 } 89 }
90 90
91 input_manager_apply_seat_config(input_manager, seat); 91 input_manager_apply_seat_config(input_manager, seat_config);
92} 92}
93 93
94/* Keep alphabetized */ 94/* Keep alphabetized */
diff --git a/sway/commands/seat.c b/sway/commands/seat.c
index 45079616..819b769c 100644
--- a/sway/commands/seat.c
+++ b/sway/commands/seat.c
@@ -14,7 +14,8 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
14 free_seat_config(config->handler_context.seat_config); 14 free_seat_config(config->handler_context.seat_config);
15 config->handler_context.seat_config = new_seat_config(argv[0]); 15 config->handler_context.seat_config = new_seat_config(argv[0]);
16 if (!config->handler_context.seat_config) { 16 if (!config->handler_context.seat_config) {
17 return cmd_results_new(CMD_FAILURE, NULL, "Couldn't allocate config"); 17 return cmd_results_new(CMD_FAILURE, NULL,
18 "Couldn't allocate config");
18 } 19 }
19 wlr_log(L_DEBUG, "entering seat block: %s", argv[0]); 20 wlr_log(L_DEBUG, "entering seat block: %s", argv[0]);
20 return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); 21 return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
@@ -28,7 +29,8 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
28 if (!has_context) { 29 if (!has_context) {
29 config->handler_context.seat_config = new_seat_config(argv[0]); 30 config->handler_context.seat_config = new_seat_config(argv[0]);
30 if (!config->handler_context.seat_config) { 31 if (!config->handler_context.seat_config) {
31 return cmd_results_new(CMD_FAILURE, NULL, "Couldn't allocate config"); 32 return cmd_results_new(CMD_FAILURE, NULL,
33 "Couldn't allocate config");
32 } 34 }
33 } 35 }
34 36
@@ -41,7 +43,10 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
41 } else if (strcasecmp("fallback", argv[1]) == 0) { 43 } else if (strcasecmp("fallback", argv[1]) == 0) {
42 res = seat_cmd_fallback(argc_new, argv_new); 44 res = seat_cmd_fallback(argc_new, argv_new);
43 } else { 45 } else {
44 res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); 46 res =
47 cmd_results_new(CMD_INVALID,
48 "seat <name>", "Unknown command %s",
49 argv[1]);
45 } 50 }
46 51
47 if (!has_context) { 52 if (!has_context) {
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index d9d20200..34d5b4cf 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -92,7 +92,8 @@ static bool input_has_seat_configuration(struct sway_input_manager *input) {
92 return false; 92 return false;
93} 93}
94 94
95static void input_manager_libinput_config_pointer(struct sway_input_device *input_device) { 95static void input_manager_libinput_config_pointer(
96 struct sway_input_device *input_device) {
96 struct wlr_input_device *wlr_device = input_device->wlr_device; 97 struct wlr_input_device *wlr_device = input_device->wlr_device;
97 struct input_config *ic = input_device->config; 98 struct input_config *ic = input_device->config;
98 struct libinput_device *libinput_device; 99 struct libinput_device *libinput_device;
@@ -102,22 +103,27 @@ static void input_manager_libinput_config_pointer(struct sway_input_device *inpu
102 } 103 }
103 104
104 libinput_device = wlr_libinput_get_device_handle(wlr_device); 105 libinput_device = wlr_libinput_get_device_handle(wlr_device);
105 wlr_log(L_DEBUG, "input_manager_libinput_config_pointer(%s)", ic->identifier); 106 wlr_log(L_DEBUG, "input_manager_libinput_config_pointer(%s)",
107 ic->identifier);
106 108
107 if (ic->accel_profile != INT_MIN) { 109 if (ic->accel_profile != INT_MIN) {
108 wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", 110 wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
109 ic->identifier, ic->accel_profile); 111 ic->identifier, ic->accel_profile);
110 libinput_device_config_accel_set_profile(libinput_device, ic->accel_profile); 112 libinput_device_config_accel_set_profile(libinput_device,
113 ic->accel_profile);
111 } 114 }
112 if (ic->click_method != INT_MIN) { 115 if (ic->click_method != INT_MIN) {
113 wlr_log(L_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)", 116 wlr_log(L_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)",
114 ic->identifier, ic->click_method); 117 ic->identifier, ic->click_method);
115 libinput_device_config_click_set_method(libinput_device, ic->click_method); 118 libinput_device_config_click_set_method(libinput_device,
119 ic->click_method);
116 } 120 }
117 if (ic->drag_lock != INT_MIN) { 121 if (ic->drag_lock != INT_MIN) {
118 wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)", 122 wlr_log(L_DEBUG,
123 "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)",
119 ic->identifier, ic->click_method); 124 ic->identifier, ic->click_method);
120 libinput_device_config_tap_set_drag_lock_enabled(libinput_device, ic->drag_lock); 125 libinput_device_config_tap_set_drag_lock_enabled(libinput_device,
126 ic->drag_lock);
121 } 127 }
122 if (ic->dwt != INT_MIN) { 128 if (ic->dwt != INT_MIN) {
123 wlr_log(L_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)", 129 wlr_log(L_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)",
@@ -125,34 +131,43 @@ static void input_manager_libinput_config_pointer(struct sway_input_device *inpu
125 libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt); 131 libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt);
126 } 132 }
127 if (ic->left_handed != INT_MIN) { 133 if (ic->left_handed != INT_MIN) {
128 wlr_log(L_DEBUG, "libinput_config_pointer(%s) left_handed_set_enabled(%d)", 134 wlr_log(L_DEBUG,
135 "libinput_config_pointer(%s) left_handed_set_enabled(%d)",
129 ic->identifier, ic->left_handed); 136 ic->identifier, ic->left_handed);
130 libinput_device_config_left_handed_set(libinput_device, ic->left_handed); 137 libinput_device_config_left_handed_set(libinput_device,
138 ic->left_handed);
131 } 139 }
132 if (ic->middle_emulation != INT_MIN) { 140 if (ic->middle_emulation != INT_MIN) {
133 wlr_log(L_DEBUG, "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)", 141 wlr_log(L_DEBUG,
142 "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)",
134 ic->identifier, ic->middle_emulation); 143 ic->identifier, ic->middle_emulation);
135 libinput_device_config_middle_emulation_set_enabled(libinput_device, ic->middle_emulation); 144 libinput_device_config_middle_emulation_set_enabled(libinput_device,
145 ic->middle_emulation);
136 } 146 }
137 if (ic->natural_scroll != INT_MIN) { 147 if (ic->natural_scroll != INT_MIN) {
138 wlr_log(L_DEBUG, "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)", 148 wlr_log(L_DEBUG,
149 "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)",
139 ic->identifier, ic->natural_scroll); 150 ic->identifier, ic->natural_scroll);
140 libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, ic->natural_scroll); 151 libinput_device_config_scroll_set_natural_scroll_enabled(
152 libinput_device, ic->natural_scroll);
141 } 153 }
142 if (ic->pointer_accel != FLT_MIN) { 154 if (ic->pointer_accel != FLT_MIN) {
143 wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)", 155 wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)",
144 ic->identifier, ic->pointer_accel); 156 ic->identifier, ic->pointer_accel);
145 libinput_device_config_accel_set_speed(libinput_device, ic->pointer_accel); 157 libinput_device_config_accel_set_speed(libinput_device,
158 ic->pointer_accel);
146 } 159 }
147 if (ic->scroll_method != INT_MIN) { 160 if (ic->scroll_method != INT_MIN) {
148 wlr_log(L_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)", 161 wlr_log(L_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)",
149 ic->identifier, ic->scroll_method); 162 ic->identifier, ic->scroll_method);
150 libinput_device_config_scroll_set_method(libinput_device, ic->scroll_method); 163 libinput_device_config_scroll_set_method(libinput_device,
164 ic->scroll_method);
151 } 165 }
152 if (ic->send_events != INT_MIN) { 166 if (ic->send_events != INT_MIN) {
153 wlr_log(L_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)", 167 wlr_log(L_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)",
154 ic->identifier, ic->send_events); 168 ic->identifier, ic->send_events);
155 libinput_device_config_send_events_set_mode(libinput_device, ic->send_events); 169 libinput_device_config_send_events_set_mode(libinput_device,
170 ic->send_events);
156 } 171 }
157 if (ic->tap != INT_MIN) { 172 if (ic->tap != INT_MIN) {
158 wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)", 173 wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)",
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 91a9e32b..38b617b7 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -49,7 +49,8 @@ static void handle_seat_container_destroy(struct wl_listener *listener,
49 if (is_focus) { 49 if (is_focus) {
50 // pick next focus 50 // pick next focus
51 seat_set_focus(seat, NULL); 51 seat_set_focus(seat, NULL);
52 struct sway_container *next = seat_get_focus_inactive(seat, con->parent); 52 struct sway_container *next =
53 seat_get_focus_inactive(seat, con->parent);
53 if (next == NULL) { 54 if (next == NULL) {
54 next = con->parent; 55 next = con->parent;
55 } 56 }
@@ -133,7 +134,8 @@ struct sway_seat *seat_create(struct sway_input_manager *input,
133 // init the focus stack 134 // init the focus stack
134 wl_list_init(&seat->focus_stack); 135 wl_list_init(&seat->focus_stack);
135 136
136 container_for_each_descendant_dfs(&root_container, collect_focus_iter, seat); 137 container_for_each_descendant_dfs(&root_container,
138 collect_focus_iter, seat);
137 139
138 wl_signal_add(&root_container.sway_root->events.new_container, 140 wl_signal_add(&root_container.sway_root->events.new_container,
139 &seat->new_container); 141 &seat->new_container);
@@ -165,7 +167,8 @@ static void seat_configure_keyboard(struct sway_seat *seat,
165 if (!seat_device->keyboard) { 167 if (!seat_device->keyboard) {
166 sway_keyboard_create(seat, seat_device); 168 sway_keyboard_create(seat, seat_device);
167 } 169 }
168 struct wlr_keyboard *wlr_keyboard = seat_device->input_device->wlr_device->keyboard; 170 struct wlr_keyboard *wlr_keyboard =
171 seat_device->input_device->wlr_device->keyboard;
169 sway_keyboard_configure(seat_device->keyboard); 172 sway_keyboard_configure(seat_device->keyboard);
170 wlr_seat_set_keyboard(seat->wlr_seat, 173 wlr_seat_set_keyboard(seat->wlr_seat,
171 seat_device->input_device->wlr_device); 174 seat_device->input_device->wlr_device);
@@ -275,7 +278,8 @@ void seat_configure_xcursor(struct sway_seat *seat) {
275 } 278 }
276 279
277 for (int i = 0; i < root_container.children->length; ++i) { 280 for (int i = 0; i < root_container.children->length; ++i) {
278 struct sway_container *output_container = root_container.children->items[i]; 281 struct sway_container *output_container =
282 root_container.children->items[i];
279 struct wlr_output *output = 283 struct wlr_output *output =
280 output_container->sway_output->wlr_output; 284 output_container->sway_output->wlr_output;
281 bool result = 285 bool result =
@@ -379,7 +383,8 @@ void seat_set_focus(struct sway_seat *seat,
379 seat_set_focus_warp(seat, container, true); 383 seat_set_focus_warp(seat, container, true);
380} 384}
381 385
382struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, struct sway_container *container) { 386struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
387 struct sway_container *container) {
383 struct sway_seat_container *current = NULL; 388 struct sway_seat_container *current = NULL;
384 struct sway_container *parent = NULL; 389 struct sway_container *parent = NULL;
385 wl_list_for_each(current, &seat->focus_stack, link) { 390 wl_list_for_each(current, &seat->focus_stack, link) {
@@ -409,7 +414,8 @@ struct sway_container *seat_get_focus(struct sway_seat *seat) {
409 414
410struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, 415struct sway_container *seat_get_focus_by_type(struct sway_seat *seat,
411 enum sway_container_type type) { 416 enum sway_container_type type) {
412 struct sway_container *focus = seat_get_focus_inactive(seat, &root_container); 417 struct sway_container *focus =
418 seat_get_focus_inactive(seat, &root_container);
413 if (focus->type == type) { 419 if (focus->type == type) {
414 return focus; 420 return focus;
415 } 421 }