Set cursor when beginning resize and move operations

This commit is contained in:
Ryan Dwyer 2018-07-22 23:10:06 +10:00
parent 009b426024
commit d21d4b83a3
2 changed files with 10 additions and 0 deletions

View file

@ -215,6 +215,7 @@ static void calculate_floating_constraints(struct sway_container *con,
*max_height = config->floating_maximum_height; *max_height = config->floating_maximum_height;
} }
} }
static void handle_resize_motion(struct sway_seat *seat, static void handle_resize_motion(struct sway_seat *seat,
struct sway_cursor *cursor) { struct sway_cursor *cursor) {
struct sway_container *con = seat->op_container; struct sway_container *con = seat->op_container;
@ -704,6 +705,9 @@ static void handle_request_set_cursor(struct wl_listener *listener,
void *data) { void *data) {
struct sway_cursor *cursor = struct sway_cursor *cursor =
wl_container_of(listener, cursor, request_set_cursor); wl_container_of(listener, cursor, request_set_cursor);
if (cursor->seat->operation != OP_NONE) {
return;
}
struct wlr_seat_pointer_request_set_cursor_event *event = data; struct wlr_seat_pointer_request_set_cursor_event *event = data;
struct wl_client *focused_client = NULL; struct wl_client *focused_client = NULL;

View file

@ -910,6 +910,7 @@ void seat_begin_move(struct sway_seat *seat, struct sway_container *con,
seat->operation = OP_MOVE; seat->operation = OP_MOVE;
seat->op_container = con; seat->op_container = con;
seat->op_button = button; seat->op_button = button;
cursor_set_image(seat->cursor, "grab", NULL);
} }
void seat_begin_resize(struct sway_seat *seat, struct sway_container *con, void seat_begin_resize(struct sway_seat *seat, struct sway_container *con,
@ -932,6 +933,10 @@ void seat_begin_resize(struct sway_seat *seat, struct sway_container *con,
seat->op_ref_con_ly = con->y; seat->op_ref_con_ly = con->y;
seat->op_ref_width = con->width; seat->op_ref_width = con->width;
seat->op_ref_height = con->height; seat->op_ref_height = con->height;
const char *image = edge == WLR_EDGE_NONE ?
"se-resize" : wlr_xcursor_get_resize_name(edge);
cursor_set_image(seat->cursor, image, NULL);
} }
void seat_end_mouse_operation(struct sway_seat *seat) { void seat_end_mouse_operation(struct sway_seat *seat) {
@ -951,6 +956,7 @@ void seat_end_mouse_operation(struct sway_seat *seat) {
} }
seat->operation = OP_NONE; seat->operation = OP_NONE;
seat->op_container = NULL; seat->op_container = NULL;
cursor_set_image(seat->cursor, "left_ptr", NULL);
} }
void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec, void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,