aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_default.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seatop_default.c')
-rw-r--r--sway/input/seatop_default.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index c56330fd..0c6f7c5e 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -1,4 +1,3 @@
1#define _POSIX_C_SOURCE 200809L
2#include <float.h> 1#include <float.h>
3#include <libevdev/libevdev.h> 2#include <libevdev/libevdev.h>
4#include <wlr/types/wlr_cursor.h> 3#include <wlr/types/wlr_cursor.h>
@@ -291,7 +290,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
291 290
292static bool trigger_pointer_button_binding(struct sway_seat *seat, 291static bool trigger_pointer_button_binding(struct sway_seat *seat,
293 struct wlr_input_device *device, uint32_t button, 292 struct wlr_input_device *device, uint32_t button,
294 enum wlr_button_state state, uint32_t modifiers, 293 enum wl_pointer_button_state state, uint32_t modifiers,
295 bool on_titlebar, bool on_border, bool on_contents, bool on_workspace) { 294 bool on_titlebar, bool on_border, bool on_contents, bool on_workspace) {
296 // We can reach this for non-pointer devices if we're currently emulating 295 // We can reach this for non-pointer devices if we're currently emulating
297 // pointer input for one. Emulated input should not trigger bindings. The 296 // pointer input for one. Emulated input should not trigger bindings. The
@@ -305,7 +304,7 @@ static bool trigger_pointer_button_binding(struct sway_seat *seat,
305 char *device_identifier = device ? input_device_get_identifier(device) 304 char *device_identifier = device ? input_device_get_identifier(device)
306 : strdup("*"); 305 : strdup("*");
307 struct sway_binding *binding = NULL; 306 struct sway_binding *binding = NULL;
308 if (state == WLR_BUTTON_PRESSED) { 307 if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
309 state_add_button(e, button); 308 state_add_button(e, button);
310 binding = get_active_mouse_binding(e, 309 binding = get_active_mouse_binding(e,
311 config->current_mode->mouse_bindings, modifiers, false, 310 config->current_mode->mouse_bindings, modifiers, false,
@@ -330,7 +329,7 @@ static bool trigger_pointer_button_binding(struct sway_seat *seat,
330 329
331static void handle_button(struct sway_seat *seat, uint32_t time_msec, 330static void handle_button(struct sway_seat *seat, uint32_t time_msec,
332 struct wlr_input_device *device, uint32_t button, 331 struct wlr_input_device *device, uint32_t button,
333 enum wlr_button_state state) { 332 enum wl_pointer_button_state state) {
334 struct sway_cursor *cursor = seat->cursor; 333 struct sway_cursor *cursor = seat->cursor;
335 334
336 // Determine what's under the cursor 335 // Determine what's under the cursor
@@ -363,7 +362,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
363 362
364 // Handle clicking an empty workspace 363 // Handle clicking an empty workspace
365 if (node && node->type == N_WORKSPACE) { 364 if (node && node->type == N_WORKSPACE) {
366 if (state == WLR_BUTTON_PRESSED) { 365 if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
367 seat_set_focus(seat, node); 366 seat_set_focus(seat, node);
368 transaction_commit_dirty(); 367 transaction_commit_dirty();
369 } 368 }
@@ -378,7 +377,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
378 seat_set_focus_layer(seat, layer); 377 seat_set_focus_layer(seat, layer);
379 transaction_commit_dirty(); 378 transaction_commit_dirty();
380 } 379 }
381 if (state == WLR_BUTTON_PRESSED) { 380 if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
382 seatop_begin_down_on_surface(seat, surface, sx, sy); 381 seatop_begin_down_on_surface(seat, surface, sx, sy);
383 } 382 }
384 seat_pointer_notify_button(seat, time_msec, button, state); 383 seat_pointer_notify_button(seat, time_msec, button, state);
@@ -387,7 +386,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
387 386
388 // Handle tiling resize via border 387 // Handle tiling resize via border
389 if (cont && resize_edge && button == BTN_LEFT && 388 if (cont && resize_edge && button == BTN_LEFT &&
390 state == WLR_BUTTON_PRESSED && !is_floating) { 389 state == WL_POINTER_BUTTON_STATE_PRESSED && !is_floating) {
391 // If a resize is triggered on a tabbed or stacked container, change 390 // If a resize is triggered on a tabbed or stacked container, change
392 // focus to the tab which already had inactive focus -- otherwise, we'd 391 // focus to the tab which already had inactive focus -- otherwise, we'd
393 // change the active tab when the user probably just wanted to resize. 392 // change the active tab when the user probably just wanted to resize.
@@ -405,7 +404,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
405 // Handle tiling resize via mod 404 // Handle tiling resize via mod
406 bool mod_pressed = modifiers & config->floating_mod; 405 bool mod_pressed = modifiers & config->floating_mod;
407 if (cont && !is_floating_or_child && mod_pressed && 406 if (cont && !is_floating_or_child && mod_pressed &&
408 state == WLR_BUTTON_PRESSED) { 407 state == WL_POINTER_BUTTON_STATE_PRESSED) {
409 uint32_t btn_resize = config->floating_mod_inverse ? 408 uint32_t btn_resize = config->floating_mod_inverse ?
410 BTN_LEFT : BTN_RIGHT; 409 BTN_LEFT : BTN_RIGHT;
411 if (button == btn_resize) { 410 if (button == btn_resize) {
@@ -433,7 +432,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
433 } 432 }
434 433
435 // Handle changing focus when clicking on a container 434 // Handle changing focus when clicking on a container
436 if (cont && state == WLR_BUTTON_PRESSED) { 435 if (cont && state == WL_POINTER_BUTTON_STATE_PRESSED) {
437 // Default case: focus the container that was just clicked. 436 // Default case: focus the container that was just clicked.
438 node = &cont->node; 437 node = &cont->node;
439 438
@@ -454,7 +453,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
454 453
455 // Handle beginning floating move 454 // Handle beginning floating move
456 if (cont && is_floating_or_child && !is_fullscreen_or_child && 455 if (cont && is_floating_or_child && !is_fullscreen_or_child &&
457 state == WLR_BUTTON_PRESSED) { 456 state == WL_POINTER_BUTTON_STATE_PRESSED) {
458 uint32_t btn_move = config->floating_mod_inverse ? BTN_RIGHT : BTN_LEFT; 457 uint32_t btn_move = config->floating_mod_inverse ? BTN_RIGHT : BTN_LEFT;
459 if (button == btn_move && (mod_pressed || on_titlebar)) { 458 if (button == btn_move && (mod_pressed || on_titlebar)) {
460 seatop_begin_move_floating(seat, container_toplevel_ancestor(cont)); 459 seatop_begin_move_floating(seat, container_toplevel_ancestor(cont));
@@ -464,7 +463,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
464 463
465 // Handle beginning floating resize 464 // Handle beginning floating resize
466 if (cont && is_floating_or_child && !is_fullscreen_or_child && 465 if (cont && is_floating_or_child && !is_fullscreen_or_child &&
467 state == WLR_BUTTON_PRESSED) { 466 state == WL_POINTER_BUTTON_STATE_PRESSED) {
468 // Via border 467 // Via border
469 if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { 468 if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) {
470 seat_set_focus_container(seat, cont); 469 seat_set_focus_container(seat, cont);
@@ -490,7 +489,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
490 489
491 // Handle moving a tiling container 490 // Handle moving a tiling container
492 if (config->tiling_drag && (mod_pressed || on_titlebar) && 491 if (config->tiling_drag && (mod_pressed || on_titlebar) &&
493 state == WLR_BUTTON_PRESSED && !is_floating_or_child && 492 state == WL_POINTER_BUTTON_STATE_PRESSED && !is_floating_or_child &&
494 cont && cont->pending.fullscreen_mode == FULLSCREEN_NONE) { 493 cont && cont->pending.fullscreen_mode == FULLSCREEN_NONE) {
495 // If moving a container by its title bar, use a threshold for the drag 494 // If moving a container by its title bar, use a threshold for the drag
496 if (!mod_pressed && config->tiling_drag_threshold > 0) { 495 if (!mod_pressed && config->tiling_drag_threshold > 0) {
@@ -503,14 +502,14 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
503 } 502 }
504 503
505 // Handle mousedown on a container surface 504 // Handle mousedown on a container surface
506 if (surface && cont && state == WLR_BUTTON_PRESSED) { 505 if (surface && cont && state == WL_POINTER_BUTTON_STATE_PRESSED) {
507 seatop_begin_down(seat, cont, sx, sy); 506 seatop_begin_down(seat, cont, sx, sy);
508 seat_pointer_notify_button(seat, time_msec, button, WLR_BUTTON_PRESSED); 507 seat_pointer_notify_button(seat, time_msec, button, WL_POINTER_BUTTON_STATE_PRESSED);
509 return; 508 return;
510 } 509 }
511 510
512 // Handle clicking a container surface or decorations 511 // Handle clicking a container surface or decorations
513 if (cont && state == WLR_BUTTON_PRESSED) { 512 if (cont && state == WL_POINTER_BUTTON_STATE_PRESSED) {
514 seat_pointer_notify_button(seat, time_msec, button, state); 513 seat_pointer_notify_button(seat, time_msec, button, state);
515 return; 514 return;
516 } 515 }
@@ -685,7 +684,7 @@ static void handle_touch_down(struct sway_seat *seat,
685 pointer_motion(cursor, event->time_msec, &event->touch->base, dx, dy, 684 pointer_motion(cursor, event->time_msec, &event->touch->base, dx, dy,
686 dx, dy); 685 dx, dy);
687 dispatch_cursor_button(cursor, &event->touch->base, event->time_msec, 686 dispatch_cursor_button(cursor, &event->touch->base, event->time_msec,
688 BTN_LEFT, WLR_BUTTON_PRESSED); 687 BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED);
689 } 688 }
690} 689}
691 690
@@ -695,9 +694,9 @@ static void handle_touch_down(struct sway_seat *seat,
695 694
696static uint32_t wl_axis_to_button(struct wlr_pointer_axis_event *event) { 695static uint32_t wl_axis_to_button(struct wlr_pointer_axis_event *event) {
697 switch (event->orientation) { 696 switch (event->orientation) {
698 case WLR_AXIS_ORIENTATION_VERTICAL: 697 case WL_POINTER_AXIS_VERTICAL_SCROLL:
699 return event->delta < 0 ? SWAY_SCROLL_UP : SWAY_SCROLL_DOWN; 698 return event->delta < 0 ? SWAY_SCROLL_UP : SWAY_SCROLL_DOWN;
700 case WLR_AXIS_ORIENTATION_HORIZONTAL: 699 case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
701 return event->delta < 0 ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT; 700 return event->delta < 0 ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT;
702 default: 701 default:
703 sway_log(SWAY_DEBUG, "Unknown axis orientation"); 702 sway_log(SWAY_DEBUG, "Unknown axis orientation");