aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-11 00:08:18 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-08-12 10:45:54 +1000
commite9d46ccbddf69e380d72b23d50d21988015ab60b (patch)
treefecfb460904f92253a93cf9f2d55ecc8a70cad73 /sway/input/cursor.c
parentFix right-click/popups and add state checks (diff)
downloadsway-e9d46ccbddf69e380d72b23d50d21988015ab60b.tar.gz
sway-e9d46ccbddf69e380d72b23d50d21988015ab60b.tar.zst
sway-e9d46ccbddf69e380d72b23d50d21988015ab60b.zip
Use col-resize and row-resize cursor images
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 12cca7fd..8e7157a2 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -472,9 +472,17 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
472 } else if (c) { 472 } else if (c) {
473 // Try a container's resize edge 473 // Try a container's resize edge
474 enum wlr_edges edge = find_resize_edge(c, cursor); 474 enum wlr_edges edge = find_resize_edge(c, cursor);
475 const char *image = edge == WLR_EDGE_NONE ? 475 if (edge == WLR_EDGE_NONE) {
476 "left_ptr" : wlr_xcursor_get_resize_name(edge); 476 cursor_set_image(cursor, "left_ptr", NULL);
477 cursor_set_image(cursor, image, NULL); 477 } else if (container_is_floating(c)) {
478 cursor_set_image(cursor, wlr_xcursor_get_resize_name(edge), NULL);
479 } else {
480 if (edge & (WLR_EDGE_LEFT | WLR_EDGE_RIGHT)) {
481 cursor_set_image(cursor, "col-resize", NULL);
482 } else {
483 cursor_set_image(cursor, "row-resize", NULL);
484 }
485 }
478 } else { 486 } else {
479 cursor_set_image(cursor, "left_ptr", NULL); 487 cursor_set_image(cursor, "left_ptr", NULL);
480 } 488 }
@@ -676,6 +684,18 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
676 WLR_EDGE_RIGHT : WLR_EDGE_LEFT; 684 WLR_EDGE_RIGHT : WLR_EDGE_LEFT;
677 edge |= cursor->cursor->y > cont->y + cont->height / 2 ? 685 edge |= cursor->cursor->y > cont->y + cont->height / 2 ?
678 WLR_EDGE_BOTTOM : WLR_EDGE_TOP; 686 WLR_EDGE_BOTTOM : WLR_EDGE_TOP;
687
688 const char *image = NULL;
689 if (edge == (WLR_EDGE_LEFT | WLR_EDGE_TOP)) {
690 image = "nw-resize";
691 } else if (edge == (WLR_EDGE_TOP | WLR_EDGE_RIGHT)) {
692 image = "ne-resize";
693 } else if (edge == (WLR_EDGE_RIGHT | WLR_EDGE_BOTTOM)) {
694 image = "se-resize";
695 } else if (edge == (WLR_EDGE_BOTTOM | WLR_EDGE_LEFT)) {
696 image = "sw-resize";
697 }
698 cursor_set_image(seat->cursor, image, NULL);
679 seat_set_focus(seat, cont); 699 seat_set_focus(seat, cont);
680 seat_begin_resize_tiling(seat, cont, button, edge); 700 seat_begin_resize_tiling(seat, cont, button, edge);
681 return; 701 return;