diff options
author | Simon Ser <contact@emersion.fr> | 2024-02-28 17:49:58 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2024-02-28 14:28:11 -0500 |
commit | fca8474e9bd64bff8df16fdaf409d5f575ba9501 (patch) | |
tree | f310c4062fa1bcbd49fc9397a5386953050f1a61 /sway/input/seatop_default.c | |
parent | text_input: don't destroy scene_node twice (diff) | |
download | sway-fca8474e9bd64bff8df16fdaf409d5f575ba9501.tar.gz sway-fca8474e9bd64bff8df16fdaf409d5f575ba9501.tar.zst sway-fca8474e9bd64bff8df16fdaf409d5f575ba9501.zip |
Convert to new pointer enums
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4575
Diffstat (limited to 'sway/input/seatop_default.c')
-rw-r--r-- | sway/input/seatop_default.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index f2a9c2cd..0c6f7c5e 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c | |||
@@ -290,7 +290,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
290 | 290 | ||
291 | static bool trigger_pointer_button_binding(struct sway_seat *seat, | 291 | static bool trigger_pointer_button_binding(struct sway_seat *seat, |
292 | struct wlr_input_device *device, uint32_t button, | 292 | struct wlr_input_device *device, uint32_t button, |
293 | enum wlr_button_state state, uint32_t modifiers, | 293 | enum wl_pointer_button_state state, uint32_t modifiers, |
294 | 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) { |
295 | // 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 |
296 | // pointer input for one. Emulated input should not trigger bindings. The | 296 | // pointer input for one. Emulated input should not trigger bindings. The |
@@ -304,7 +304,7 @@ static bool trigger_pointer_button_binding(struct sway_seat *seat, | |||
304 | char *device_identifier = device ? input_device_get_identifier(device) | 304 | char *device_identifier = device ? input_device_get_identifier(device) |
305 | : strdup("*"); | 305 | : strdup("*"); |
306 | struct sway_binding *binding = NULL; | 306 | struct sway_binding *binding = NULL; |
307 | if (state == WLR_BUTTON_PRESSED) { | 307 | if (state == WL_POINTER_BUTTON_STATE_PRESSED) { |
308 | state_add_button(e, button); | 308 | state_add_button(e, button); |
309 | binding = get_active_mouse_binding(e, | 309 | binding = get_active_mouse_binding(e, |
310 | config->current_mode->mouse_bindings, modifiers, false, | 310 | config->current_mode->mouse_bindings, modifiers, false, |
@@ -329,7 +329,7 @@ static bool trigger_pointer_button_binding(struct sway_seat *seat, | |||
329 | 329 | ||
330 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, | 330 | static void handle_button(struct sway_seat *seat, uint32_t time_msec, |
331 | struct wlr_input_device *device, uint32_t button, | 331 | struct wlr_input_device *device, uint32_t button, |
332 | enum wlr_button_state state) { | 332 | enum wl_pointer_button_state state) { |
333 | struct sway_cursor *cursor = seat->cursor; | 333 | struct sway_cursor *cursor = seat->cursor; |
334 | 334 | ||
335 | // Determine what's under the cursor | 335 | // Determine what's under the cursor |
@@ -362,7 +362,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
362 | 362 | ||
363 | // Handle clicking an empty workspace | 363 | // Handle clicking an empty workspace |
364 | if (node && node->type == N_WORKSPACE) { | 364 | if (node && node->type == N_WORKSPACE) { |
365 | if (state == WLR_BUTTON_PRESSED) { | 365 | if (state == WL_POINTER_BUTTON_STATE_PRESSED) { |
366 | seat_set_focus(seat, node); | 366 | seat_set_focus(seat, node); |
367 | transaction_commit_dirty(); | 367 | transaction_commit_dirty(); |
368 | } | 368 | } |
@@ -377,7 +377,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
377 | seat_set_focus_layer(seat, layer); | 377 | seat_set_focus_layer(seat, layer); |
378 | transaction_commit_dirty(); | 378 | transaction_commit_dirty(); |
379 | } | 379 | } |
380 | if (state == WLR_BUTTON_PRESSED) { | 380 | if (state == WL_POINTER_BUTTON_STATE_PRESSED) { |
381 | seatop_begin_down_on_surface(seat, surface, sx, sy); | 381 | seatop_begin_down_on_surface(seat, surface, sx, sy); |
382 | } | 382 | } |
383 | seat_pointer_notify_button(seat, time_msec, button, state); | 383 | seat_pointer_notify_button(seat, time_msec, button, state); |
@@ -386,7 +386,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
386 | 386 | ||
387 | // Handle tiling resize via border | 387 | // Handle tiling resize via border |
388 | if (cont && resize_edge && button == BTN_LEFT && | 388 | if (cont && resize_edge && button == BTN_LEFT && |
389 | state == WLR_BUTTON_PRESSED && !is_floating) { | 389 | state == WL_POINTER_BUTTON_STATE_PRESSED && !is_floating) { |
390 | // 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 |
391 | // 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 |
392 | // 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. |
@@ -404,7 +404,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
404 | // Handle tiling resize via mod | 404 | // Handle tiling resize via mod |
405 | bool mod_pressed = modifiers & config->floating_mod; | 405 | bool mod_pressed = modifiers & config->floating_mod; |
406 | if (cont && !is_floating_or_child && mod_pressed && | 406 | if (cont && !is_floating_or_child && mod_pressed && |
407 | state == WLR_BUTTON_PRESSED) { | 407 | state == WL_POINTER_BUTTON_STATE_PRESSED) { |
408 | uint32_t btn_resize = config->floating_mod_inverse ? | 408 | uint32_t btn_resize = config->floating_mod_inverse ? |
409 | BTN_LEFT : BTN_RIGHT; | 409 | BTN_LEFT : BTN_RIGHT; |
410 | if (button == btn_resize) { | 410 | if (button == btn_resize) { |
@@ -432,7 +432,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
432 | } | 432 | } |
433 | 433 | ||
434 | // Handle changing focus when clicking on a container | 434 | // Handle changing focus when clicking on a container |
435 | if (cont && state == WLR_BUTTON_PRESSED) { | 435 | if (cont && state == WL_POINTER_BUTTON_STATE_PRESSED) { |
436 | // Default case: focus the container that was just clicked. | 436 | // Default case: focus the container that was just clicked. |
437 | node = &cont->node; | 437 | node = &cont->node; |
438 | 438 | ||
@@ -453,7 +453,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
453 | 453 | ||
454 | // Handle beginning floating move | 454 | // Handle beginning floating move |
455 | if (cont && is_floating_or_child && !is_fullscreen_or_child && | 455 | if (cont && is_floating_or_child && !is_fullscreen_or_child && |
456 | state == WLR_BUTTON_PRESSED) { | 456 | state == WL_POINTER_BUTTON_STATE_PRESSED) { |
457 | 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; |
458 | if (button == btn_move && (mod_pressed || on_titlebar)) { | 458 | if (button == btn_move && (mod_pressed || on_titlebar)) { |
459 | seatop_begin_move_floating(seat, container_toplevel_ancestor(cont)); | 459 | seatop_begin_move_floating(seat, container_toplevel_ancestor(cont)); |
@@ -463,7 +463,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
463 | 463 | ||
464 | // Handle beginning floating resize | 464 | // Handle beginning floating resize |
465 | if (cont && is_floating_or_child && !is_fullscreen_or_child && | 465 | if (cont && is_floating_or_child && !is_fullscreen_or_child && |
466 | state == WLR_BUTTON_PRESSED) { | 466 | state == WL_POINTER_BUTTON_STATE_PRESSED) { |
467 | // Via border | 467 | // Via border |
468 | if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { | 468 | if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { |
469 | seat_set_focus_container(seat, cont); | 469 | seat_set_focus_container(seat, cont); |
@@ -489,7 +489,7 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
489 | 489 | ||
490 | // Handle moving a tiling container | 490 | // Handle moving a tiling container |
491 | if (config->tiling_drag && (mod_pressed || on_titlebar) && | 491 | if (config->tiling_drag && (mod_pressed || on_titlebar) && |
492 | state == WLR_BUTTON_PRESSED && !is_floating_or_child && | 492 | state == WL_POINTER_BUTTON_STATE_PRESSED && !is_floating_or_child && |
493 | cont && cont->pending.fullscreen_mode == FULLSCREEN_NONE) { | 493 | cont && cont->pending.fullscreen_mode == FULLSCREEN_NONE) { |
494 | // 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 |
495 | if (!mod_pressed && config->tiling_drag_threshold > 0) { | 495 | if (!mod_pressed && config->tiling_drag_threshold > 0) { |
@@ -502,14 +502,14 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, | |||
502 | } | 502 | } |
503 | 503 | ||
504 | // Handle mousedown on a container surface | 504 | // Handle mousedown on a container surface |
505 | if (surface && cont && state == WLR_BUTTON_PRESSED) { | 505 | if (surface && cont && state == WL_POINTER_BUTTON_STATE_PRESSED) { |
506 | seatop_begin_down(seat, cont, sx, sy); | 506 | seatop_begin_down(seat, cont, sx, sy); |
507 | 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); |
508 | return; | 508 | return; |
509 | } | 509 | } |
510 | 510 | ||
511 | // Handle clicking a container surface or decorations | 511 | // Handle clicking a container surface or decorations |
512 | if (cont && state == WLR_BUTTON_PRESSED) { | 512 | if (cont && state == WL_POINTER_BUTTON_STATE_PRESSED) { |
513 | seat_pointer_notify_button(seat, time_msec, button, state); | 513 | seat_pointer_notify_button(seat, time_msec, button, state); |
514 | return; | 514 | return; |
515 | } | 515 | } |
@@ -684,7 +684,7 @@ static void handle_touch_down(struct sway_seat *seat, | |||
684 | pointer_motion(cursor, event->time_msec, &event->touch->base, dx, dy, | 684 | pointer_motion(cursor, event->time_msec, &event->touch->base, dx, dy, |
685 | dx, dy); | 685 | dx, dy); |
686 | dispatch_cursor_button(cursor, &event->touch->base, event->time_msec, | 686 | dispatch_cursor_button(cursor, &event->touch->base, event->time_msec, |
687 | BTN_LEFT, WLR_BUTTON_PRESSED); | 687 | BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED); |
688 | } | 688 | } |
689 | } | 689 | } |
690 | 690 | ||
@@ -694,9 +694,9 @@ static void handle_touch_down(struct sway_seat *seat, | |||
694 | 694 | ||
695 | static uint32_t wl_axis_to_button(struct wlr_pointer_axis_event *event) { | 695 | static uint32_t wl_axis_to_button(struct wlr_pointer_axis_event *event) { |
696 | switch (event->orientation) { | 696 | switch (event->orientation) { |
697 | case WLR_AXIS_ORIENTATION_VERTICAL: | 697 | case WL_POINTER_AXIS_VERTICAL_SCROLL: |
698 | return event->delta < 0 ? SWAY_SCROLL_UP : SWAY_SCROLL_DOWN; | 698 | return event->delta < 0 ? SWAY_SCROLL_UP : SWAY_SCROLL_DOWN; |
699 | case WLR_AXIS_ORIENTATION_HORIZONTAL: | 699 | case WL_POINTER_AXIS_HORIZONTAL_SCROLL: |
700 | return event->delta < 0 ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT; | 700 | return event->delta < 0 ? SWAY_SCROLL_LEFT : SWAY_SCROLL_RIGHT; |
701 | default: | 701 | default: |
702 | sway_log(SWAY_DEBUG, "Unknown axis orientation"); | 702 | sway_log(SWAY_DEBUG, "Unknown axis orientation"); |