aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-07-09 22:54:30 +0100
committerLibravatar emersion <contact@emersion.fr>2018-07-09 22:54:30 +0100
commit63b4bf500020cf35cebfdce2d73f8e359ff495c2 (patch)
tree76624b3d4820551261e5c15f773c403c1a41264e /sway/input
parentMerge pull request #2223 from RyanDwyer/floating-move (diff)
downloadsway-63b4bf500020cf35cebfdce2d73f8e359ff495c2.tar.gz
sway-63b4bf500020cf35cebfdce2d73f8e359ff495c2.tar.zst
sway-63b4bf500020cf35cebfdce2d73f8e359ff495c2.zip
Update for swaywm/wlroots#1126
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c2
-rw-r--r--sway/input/input-manager.c38
-rw-r--r--sway/input/keyboard.c8
-rw-r--r--sway/input/seat.c22
4 files changed, 35 insertions, 35 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index a2f11557..307eedd4 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -474,7 +474,7 @@ static void handle_request_set_cursor(struct wl_listener *listener,
474 // TODO: check cursor mode 474 // TODO: check cursor mode
475 if (focused_client == NULL || 475 if (focused_client == NULL ||
476 event->seat_client->client != focused_client) { 476 event->seat_client->client != focused_client) {
477 wlr_log(L_DEBUG, "denying request to set cursor from unfocused client"); 477 wlr_log(WLR_DEBUG, "denying request to set cursor from unfocused client");
478 return; 478 return;
479 } 479 }
480 480
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 98f7d7cf..daaf1fb6 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -61,7 +61,7 @@ static char *get_device_identifier(struct wlr_input_device *device) {
61 int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1; 61 int len = snprintf(NULL, 0, fmt, vendor, product, name) + 1;
62 char *identifier = malloc(len); 62 char *identifier = malloc(len);
63 if (!identifier) { 63 if (!identifier) {
64 wlr_log(L_ERROR, "Unable to allocate unique input device name"); 64 wlr_log(WLR_ERROR, "Unable to allocate unique input device name");
65 return NULL; 65 return NULL;
66 } 66 }
67 67
@@ -104,74 +104,74 @@ static void input_manager_libinput_config_pointer(
104 } 104 }
105 105
106 libinput_device = wlr_libinput_get_device_handle(wlr_device); 106 libinput_device = wlr_libinput_get_device_handle(wlr_device);
107 wlr_log(L_DEBUG, "input_manager_libinput_config_pointer(%s)", 107 wlr_log(WLR_DEBUG, "input_manager_libinput_config_pointer(%s)",
108 ic->identifier); 108 ic->identifier);
109 109
110 if (ic->accel_profile != INT_MIN) { 110 if (ic->accel_profile != INT_MIN) {
111 wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)", 111 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) accel_set_profile(%d)",
112 ic->identifier, ic->accel_profile); 112 ic->identifier, ic->accel_profile);
113 libinput_device_config_accel_set_profile(libinput_device, 113 libinput_device_config_accel_set_profile(libinput_device,
114 ic->accel_profile); 114 ic->accel_profile);
115 } 115 }
116 if (ic->click_method != INT_MIN) { 116 if (ic->click_method != INT_MIN) {
117 wlr_log(L_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)", 117 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) click_set_method(%d)",
118 ic->identifier, ic->click_method); 118 ic->identifier, ic->click_method);
119 libinput_device_config_click_set_method(libinput_device, 119 libinput_device_config_click_set_method(libinput_device,
120 ic->click_method); 120 ic->click_method);
121 } 121 }
122 if (ic->drag_lock != INT_MIN) { 122 if (ic->drag_lock != INT_MIN) {
123 wlr_log(L_DEBUG, 123 wlr_log(WLR_DEBUG,
124 "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)", 124 "libinput_config_pointer(%s) tap_set_drag_lock_enabled(%d)",
125 ic->identifier, ic->click_method); 125 ic->identifier, ic->click_method);
126 libinput_device_config_tap_set_drag_lock_enabled(libinput_device, 126 libinput_device_config_tap_set_drag_lock_enabled(libinput_device,
127 ic->drag_lock); 127 ic->drag_lock);
128 } 128 }
129 if (ic->dwt != INT_MIN) { 129 if (ic->dwt != INT_MIN) {
130 wlr_log(L_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)", 130 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) dwt_set_enabled(%d)",
131 ic->identifier, ic->dwt); 131 ic->identifier, ic->dwt);
132 libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt); 132 libinput_device_config_dwt_set_enabled(libinput_device, ic->dwt);
133 } 133 }
134 if (ic->left_handed != INT_MIN) { 134 if (ic->left_handed != INT_MIN) {
135 wlr_log(L_DEBUG, 135 wlr_log(WLR_DEBUG,
136 "libinput_config_pointer(%s) left_handed_set_enabled(%d)", 136 "libinput_config_pointer(%s) left_handed_set_enabled(%d)",
137 ic->identifier, ic->left_handed); 137 ic->identifier, ic->left_handed);
138 libinput_device_config_left_handed_set(libinput_device, 138 libinput_device_config_left_handed_set(libinput_device,
139 ic->left_handed); 139 ic->left_handed);
140 } 140 }
141 if (ic->middle_emulation != INT_MIN) { 141 if (ic->middle_emulation != INT_MIN) {
142 wlr_log(L_DEBUG, 142 wlr_log(WLR_DEBUG,
143 "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)", 143 "libinput_config_pointer(%s) middle_emulation_set_enabled(%d)",
144 ic->identifier, ic->middle_emulation); 144 ic->identifier, ic->middle_emulation);
145 libinput_device_config_middle_emulation_set_enabled(libinput_device, 145 libinput_device_config_middle_emulation_set_enabled(libinput_device,
146 ic->middle_emulation); 146 ic->middle_emulation);
147 } 147 }
148 if (ic->natural_scroll != INT_MIN) { 148 if (ic->natural_scroll != INT_MIN) {
149 wlr_log(L_DEBUG, 149 wlr_log(WLR_DEBUG,
150 "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)", 150 "libinput_config_pointer(%s) natural_scroll_set_enabled(%d)",
151 ic->identifier, ic->natural_scroll); 151 ic->identifier, ic->natural_scroll);
152 libinput_device_config_scroll_set_natural_scroll_enabled( 152 libinput_device_config_scroll_set_natural_scroll_enabled(
153 libinput_device, ic->natural_scroll); 153 libinput_device, ic->natural_scroll);
154 } 154 }
155 if (ic->pointer_accel != FLT_MIN) { 155 if (ic->pointer_accel != FLT_MIN) {
156 wlr_log(L_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)", 156 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) accel_set_speed(%f)",
157 ic->identifier, ic->pointer_accel); 157 ic->identifier, ic->pointer_accel);
158 libinput_device_config_accel_set_speed(libinput_device, 158 libinput_device_config_accel_set_speed(libinput_device,
159 ic->pointer_accel); 159 ic->pointer_accel);
160 } 160 }
161 if (ic->scroll_method != INT_MIN) { 161 if (ic->scroll_method != INT_MIN) {
162 wlr_log(L_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)", 162 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) scroll_set_method(%d)",
163 ic->identifier, ic->scroll_method); 163 ic->identifier, ic->scroll_method);
164 libinput_device_config_scroll_set_method(libinput_device, 164 libinput_device_config_scroll_set_method(libinput_device,
165 ic->scroll_method); 165 ic->scroll_method);
166 } 166 }
167 if (ic->send_events != INT_MIN) { 167 if (ic->send_events != INT_MIN) {
168 wlr_log(L_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)", 168 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) send_events_set_mode(%d)",
169 ic->identifier, ic->send_events); 169 ic->identifier, ic->send_events);
170 libinput_device_config_send_events_set_mode(libinput_device, 170 libinput_device_config_send_events_set_mode(libinput_device,
171 ic->send_events); 171 ic->send_events);
172 } 172 }
173 if (ic->tap != INT_MIN) { 173 if (ic->tap != INT_MIN) {
174 wlr_log(L_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)", 174 wlr_log(WLR_DEBUG, "libinput_config_pointer(%s) tap_set_enabled(%d)",
175 ic->identifier, ic->tap); 175 ic->identifier, ic->tap);
176 libinput_device_config_tap_set_enabled(libinput_device, ic->tap); 176 libinput_device_config_tap_set_enabled(libinput_device, ic->tap);
177 } 177 }
@@ -187,7 +187,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
187 return; 187 return;
188 } 188 }
189 189
190 wlr_log(L_DEBUG, "removing device: '%s'", 190 wlr_log(WLR_DEBUG, "removing device: '%s'",
191 input_device->identifier); 191 input_device->identifier);
192 192
193 struct sway_seat *seat = NULL; 193 struct sway_seat *seat = NULL;
@@ -217,7 +217,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
217 input_device->identifier = get_device_identifier(device); 217 input_device->identifier = get_device_identifier(device);
218 wl_list_insert(&input->devices, &input_device->link); 218 wl_list_insert(&input->devices, &input_device->link);
219 219
220 wlr_log(L_DEBUG, "adding device: '%s'", 220 wlr_log(WLR_DEBUG, "adding device: '%s'",
221 input_device->identifier); 221 input_device->identifier);
222 222
223 if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) { 223 if (input_device->wlr_device->type == WLR_INPUT_DEVICE_POINTER) {
@@ -229,7 +229,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
229 229
230 struct sway_seat *seat = NULL; 230 struct sway_seat *seat = NULL;
231 if (!input_has_seat_configuration(input)) { 231 if (!input_has_seat_configuration(input)) {
232 wlr_log(L_DEBUG, "no seat configuration, using default seat"); 232 wlr_log(WLR_DEBUG, "no seat configuration, using default seat");
233 seat = input_manager_get_seat(input, default_seat); 233 seat = input_manager_get_seat(input, default_seat);
234 seat_add_device(seat, input_device); 234 seat_add_device(seat, input_device);
235 return; 235 return;
@@ -259,7 +259,7 @@ static void handle_new_input(struct wl_listener *listener, void *data) {
259 } 259 }
260 260
261 if (!added) { 261 if (!added) {
262 wlr_log(L_DEBUG, 262 wlr_log(WLR_DEBUG,
263 "device '%s' is not configured on any seats", 263 "device '%s' is not configured on any seats",
264 input_device->identifier); 264 input_device->identifier);
265 } 265 }
@@ -282,7 +282,7 @@ static void handle_inhibit_deactivate(struct wl_listener *listener, void *data)
282 seat_set_exclusive_client(seat, NULL); 282 seat_set_exclusive_client(seat, NULL);
283 struct sway_container *previous = seat_get_focus(seat); 283 struct sway_container *previous = seat_get_focus(seat);
284 if (previous) { 284 if (previous) {
285 wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", previous, 285 wlr_log(WLR_DEBUG, "Returning focus to %p %s '%s'", previous,
286 container_type_to_str(previous->type), previous->name); 286 container_type_to_str(previous->type), previous->name);
287 // Hack to get seat to re-focus the return value of get_focus 287 // Hack to get seat to re-focus the return value of get_focus
288 seat_set_focus(seat, previous->parent); 288 seat_set_focus(seat, previous->parent);
@@ -359,7 +359,7 @@ void input_manager_apply_input_config(struct sway_input_manager *input,
359 359
360void input_manager_apply_seat_config(struct sway_input_manager *input, 360void input_manager_apply_seat_config(struct sway_input_manager *input,
361 struct seat_config *seat_config) { 361 struct seat_config *seat_config) {
362 wlr_log(L_DEBUG, "applying new seat config for seat %s", 362 wlr_log(WLR_DEBUG, "applying new seat config for seat %s",
363 seat_config->name); 363 seat_config->name);
364 struct sway_seat *seat = input_manager_get_seat(input, seat_config->name); 364 struct sway_seat *seat = input_manager_get_seat(input, seat_config->name);
365 if (!seat) { 365 if (!seat) {
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index 182536de..580c0d4b 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -108,7 +108,7 @@ static void get_active_binding(const struct sway_shortcut_state *state,
108 } 108 }
109 109
110 if (*current_binding && *current_binding != binding) { 110 if (*current_binding && *current_binding != binding) {
111 wlr_log(L_DEBUG, "encountered duplicate bindings %d and %d", 111 wlr_log(WLR_DEBUG, "encountered duplicate bindings %d and %d",
112 (*current_binding)->order, binding->order); 112 (*current_binding)->order, binding->order);
113 } else { 113 } else {
114 *current_binding = binding; 114 *current_binding = binding;
@@ -122,12 +122,12 @@ static void get_active_binding(const struct sway_shortcut_state *state,
122 */ 122 */
123static void keyboard_execute_command(struct sway_keyboard *keyboard, 123static void keyboard_execute_command(struct sway_keyboard *keyboard,
124 struct sway_binding *binding) { 124 struct sway_binding *binding) {
125 wlr_log(L_DEBUG, "running command for binding: %s", 125 wlr_log(WLR_DEBUG, "running command for binding: %s",
126 binding->command); 126 binding->command);
127 config->handler_context.seat = keyboard->seat_device->sway_seat; 127 config->handler_context.seat = keyboard->seat_device->sway_seat;
128 struct cmd_results *results = execute_command(binding->command, NULL); 128 struct cmd_results *results = execute_command(binding->command, NULL);
129 if (results->status != CMD_SUCCESS) { 129 if (results->status != CMD_SUCCESS) {
130 wlr_log(L_DEBUG, "could not run command for binding: %s (%s)", 130 wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
131 binding->command, results->error); 131 binding->command, results->error);
132 } 132 }
133 free_cmd_results(results); 133 free_cmd_results(results);
@@ -386,7 +386,7 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
386 xkb_keymap_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); 386 xkb_keymap_new_from_names(context, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
387 387
388 if (!keymap) { 388 if (!keymap) {
389 wlr_log(L_DEBUG, "cannot configure keyboard: keymap does not exist"); 389 wlr_log(WLR_DEBUG, "cannot configure keyboard: keymap does not exist");
390 xkb_context_unref(context); 390 xkb_context_unref(context);
391 return; 391 return;
392 } 392 }
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 6c5abcd8..5dadb31d 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -75,7 +75,7 @@ static void seat_send_activate(struct sway_container *con,
75 struct sway_seat *seat) { 75 struct sway_seat *seat) {
76 if (con->type == C_VIEW) { 76 if (con->type == C_VIEW) {
77 if (!seat_is_input_allowed(seat, con->sway_view->surface)) { 77 if (!seat_is_input_allowed(seat, con->sway_view->surface)) {
78 wlr_log(L_DEBUG, "Refusing to set focus, input is inhibited"); 78 wlr_log(WLR_DEBUG, "Refusing to set focus, input is inhibited");
79 return; 79 return;
80 } 80 }
81 view_set_activated(con->sway_view, true); 81 view_set_activated(con->sway_view, true);
@@ -219,7 +219,7 @@ static struct sway_seat_container *seat_container_from_container(
219 219
220 seat_con = calloc(1, sizeof(struct sway_seat_container)); 220 seat_con = calloc(1, sizeof(struct sway_seat_container));
221 if (seat_con == NULL) { 221 if (seat_con == NULL) {
222 wlr_log(L_ERROR, "could not allocate seat container"); 222 wlr_log(WLR_ERROR, "could not allocate seat container");
223 return NULL; 223 return NULL;
224 } 224 }
225 225
@@ -301,7 +301,7 @@ static void handle_new_drag_icon(struct wl_listener *listener, void *data) {
301 301
302 struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon)); 302 struct sway_drag_icon *icon = calloc(1, sizeof(struct sway_drag_icon));
303 if (icon == NULL) { 303 if (icon == NULL) {
304 wlr_log(L_ERROR, "Allocation failed"); 304 wlr_log(WLR_ERROR, "Allocation failed");
305 return; 305 return;
306 } 306 }
307 icon->seat = seat; 307 icon->seat = seat;
@@ -391,7 +391,7 @@ static void seat_apply_input_config(struct sway_seat *seat,
391 struct input_config *ic = input_device_get_config( 391 struct input_config *ic = input_device_get_config(
392 sway_device->input_device); 392 sway_device->input_device);
393 if (ic != NULL) { 393 if (ic != NULL) {
394 wlr_log(L_DEBUG, "Applying input config to %s", 394 wlr_log(WLR_DEBUG, "Applying input config to %s",
395 sway_device->input_device->identifier); 395 sway_device->input_device->identifier);
396 396
397 mapped_to_output = ic->mapped_to_output; 397 mapped_to_output = ic->mapped_to_output;
@@ -401,7 +401,7 @@ static void seat_apply_input_config(struct sway_seat *seat,
401 mapped_to_output = sway_device->input_device->wlr_device->output_name; 401 mapped_to_output = sway_device->input_device->wlr_device->output_name;
402 } 402 }
403 if (mapped_to_output != NULL) { 403 if (mapped_to_output != NULL) {
404 wlr_log(L_DEBUG, "Mapping input device %s to output %s", 404 wlr_log(WLR_DEBUG, "Mapping input device %s to output %s",
405 sway_device->input_device->identifier, mapped_to_output); 405 sway_device->input_device->identifier, mapped_to_output);
406 struct sway_container *output = NULL; 406 struct sway_container *output = NULL;
407 for (int i = 0; i < root_container.children->length; ++i) { 407 for (int i = 0; i < root_container.children->length; ++i) {
@@ -415,7 +415,7 @@ static void seat_apply_input_config(struct sway_seat *seat,
415 wlr_cursor_map_input_to_output(seat->cursor->cursor, 415 wlr_cursor_map_input_to_output(seat->cursor->cursor,
416 sway_device->input_device->wlr_device, 416 sway_device->input_device->wlr_device,
417 output->sway_output->wlr_output); 417 output->sway_output->wlr_output);
418 wlr_log(L_DEBUG, "Mapped to output %s", output->name); 418 wlr_log(WLR_DEBUG, "Mapped to output %s", output->name);
419 } 419 }
420 } 420 }
421} 421}
@@ -495,7 +495,7 @@ void seat_configure_device(struct sway_seat *seat,
495 seat_configure_tablet_tool(seat, seat_device); 495 seat_configure_tablet_tool(seat, seat_device);
496 break; 496 break;
497 case WLR_INPUT_DEVICE_TABLET_PAD: 497 case WLR_INPUT_DEVICE_TABLET_PAD:
498 wlr_log(L_DEBUG, "TODO: configure tablet pad"); 498 wlr_log(WLR_DEBUG, "TODO: configure tablet pad");
499 break; 499 break;
500 } 500 }
501} 501}
@@ -510,11 +510,11 @@ void seat_add_device(struct sway_seat *seat,
510 struct sway_seat_device *seat_device = 510 struct sway_seat_device *seat_device =
511 calloc(1, sizeof(struct sway_seat_device)); 511 calloc(1, sizeof(struct sway_seat_device));
512 if (!seat_device) { 512 if (!seat_device) {
513 wlr_log(L_DEBUG, "could not allocate seat device"); 513 wlr_log(WLR_DEBUG, "could not allocate seat device");
514 return; 514 return;
515 } 515 }
516 516
517 wlr_log(L_DEBUG, "adding device %s to seat %s", 517 wlr_log(WLR_DEBUG, "adding device %s to seat %s",
518 input_device->identifier, seat->wlr_seat->name); 518 input_device->identifier, seat->wlr_seat->name);
519 519
520 seat_device->sway_seat = seat; 520 seat_device->sway_seat = seat;
@@ -533,7 +533,7 @@ void seat_remove_device(struct sway_seat *seat,
533 return; 533 return;
534 } 534 }
535 535
536 wlr_log(L_DEBUG, "removing device %s from seat %s", 536 wlr_log(WLR_DEBUG, "removing device %s from seat %s",
537 input_device->identifier, seat->wlr_seat->name); 537 input_device->identifier, seat->wlr_seat->name);
538 538
539 seat_device_destroy(seat_device); 539 seat_device_destroy(seat_device);
@@ -752,7 +752,7 @@ void seat_set_focus_layer(struct sway_seat *seat,
752 struct sway_container *previous = 752 struct sway_container *previous =
753 seat_get_focus_inactive(seat, &root_container); 753 seat_get_focus_inactive(seat, &root_container);
754 if (previous) { 754 if (previous) {
755 wlr_log(L_DEBUG, "Returning focus to %p %s '%s'", previous, 755 wlr_log(WLR_DEBUG, "Returning focus to %p %s '%s'", previous,
756 container_type_to_str(previous->type), previous->name); 756 container_type_to_str(previous->type), previous->name);
757 // Hack to get seat to re-focus the return value of get_focus 757 // Hack to get seat to re-focus the return value of get_focus
758 seat_set_focus(seat, previous->parent); 758 seat_set_focus(seat, previous->parent);