aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-08-11 00:08:18 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-08-12 10:45:54 +1000
commite9d46ccbddf69e380d72b23d50d21988015ab60b (patch)
treefecfb460904f92253a93cf9f2d55ecc8a70cad73 /sway
parent1893515d3a0389bf9c2289b1ae34b3add10225c6 (diff)
Use col-resize and row-resize cursor images
Diffstat (limited to 'sway')
-rw-r--r--sway/input/cursor.c26
-rw-r--r--sway/input/seat.c3
2 files changed, 23 insertions, 6 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,
} else if (c) {
// Try a container's resize edge
enum wlr_edges edge = find_resize_edge(c, cursor);
- const char *image = edge == WLR_EDGE_NONE ?
- "left_ptr" : wlr_xcursor_get_resize_name(edge);
- cursor_set_image(cursor, image, NULL);
+ if (edge == WLR_EDGE_NONE) {
+ cursor_set_image(cursor, "left_ptr", NULL);
+ } else if (container_is_floating(c)) {
+ cursor_set_image(cursor, wlr_xcursor_get_resize_name(edge), NULL);
+ } else {
+ if (edge & (WLR_EDGE_LEFT | WLR_EDGE_RIGHT)) {
+ cursor_set_image(cursor, "col-resize", NULL);
+ } else {
+ cursor_set_image(cursor, "row-resize", NULL);
+ }
+ }
} else {
cursor_set_image(cursor, "left_ptr", NULL);
}
@@ -676,6 +684,18 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
WLR_EDGE_RIGHT : WLR_EDGE_LEFT;
edge |= cursor->cursor->y > cont->y + cont->height / 2 ?
WLR_EDGE_BOTTOM : WLR_EDGE_TOP;
+
+ const char *image = NULL;
+ if (edge == (WLR_EDGE_LEFT | WLR_EDGE_TOP)) {
+ image = "nw-resize";
+ } else if (edge == (WLR_EDGE_TOP | WLR_EDGE_RIGHT)) {
+ image = "ne-resize";
+ } else if (edge == (WLR_EDGE_RIGHT | WLR_EDGE_BOTTOM)) {
+ image = "se-resize";
+ } else if (edge == (WLR_EDGE_BOTTOM | WLR_EDGE_LEFT)) {
+ image = "sw-resize";
+ }
+ cursor_set_image(seat->cursor, image, NULL);
seat_set_focus(seat, cont);
seat_begin_resize_tiling(seat, cont, button, edge);
return;
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 6d9e85dc..57cc65f6 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -980,9 +980,6 @@ void seat_begin_resize_tiling(struct sway_seat *seat,
seat->op_ref_con_ly = con->y;
seat->op_ref_width = con->width;
seat->op_ref_height = con->height;
-
- const char *image = wlr_xcursor_get_resize_name(edge);
- cursor_set_image(seat->cursor, image, NULL);
}
void seat_end_mouse_operation(struct sway_seat *seat) {