diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 527d0350..8b3ce941 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h @@ -85,8 +85,7 @@ struct sway_cursor { struct sway_node; struct sway_node *node_at_coords( - struct sway_seat *seat, double lx, double ly, - struct wlr_surface **surface, double *sx, double *sy); + double lx, double ly, struct wlr_surface **surface, double *sx, double *sy); void sway_cursor_destroy(struct sway_cursor *cursor); struct sway_cursor *sway_cursor_create(struct sway_seat *seat); diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 268f2855..8361a06f 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -621,7 +621,7 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding) || binding->type == BINDING_MOUSECODE) { struct wlr_surface *surface = NULL; double sx, sy; - struct sway_node *node = node_at_coords(seat, + struct sway_node *node = node_at_coords( seat->cursor->cursor->x, seat->cursor->cursor->y, &surface, &sx, &sy); if (node && node->type == N_CONTAINER) { diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 4a0846d5..fff6067e 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -42,8 +42,7 @@ static uint32_t get_current_time_msec(void) { * Returns the node at the cursor's position. If there is a surface at that * location, it is stored in **surface (it may not be a view). */ -struct sway_node *node_at_coords( - struct sway_seat *seat, double lx, double ly, +struct sway_node *node_at_coords(double lx, double ly, struct wlr_surface **surface, double *sx, double *sy) { struct wlr_scene_node *scene_node = NULL; @@ -285,8 +284,7 @@ void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec, if (cursor->active_constraint && device->type == WLR_INPUT_DEVICE_POINTER) { struct wlr_surface *surface = NULL; double sx, sy; - node_at_coords(cursor->seat, - cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); + node_at_coords(cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); if (cursor->active_constraint->surface != surface) { return; @@ -545,7 +543,7 @@ static void handle_tablet_tool_position(struct sway_cursor *cursor, double sx, sy; struct wlr_surface *surface = NULL; struct sway_seat *seat = cursor->seat; - node_at_coords(seat, cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); + node_at_coords(cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); // The logic for whether we should send a tablet event or an emulated pointer // event is tricky. It comes down to: @@ -635,8 +633,7 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) { double sx, sy; struct wlr_surface *surface = NULL; - node_at_coords(seat, cursor->cursor->x, cursor->cursor->y, - &surface, &sx, &sy); + node_at_coords(cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); if (cursor->simulating_pointer_from_tool_tip && event->state == WLR_TABLET_TOOL_TIP_UP) { @@ -720,8 +717,7 @@ static void handle_tool_button(struct wl_listener *listener, void *data) { double sx, sy; struct wlr_surface *surface = NULL; - node_at_coords(cursor->seat, cursor->cursor->x, cursor->cursor->y, - &surface, &sx, &sy); + node_at_coords(cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); // TODO: floating resize should support graphics tablet events struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(cursor->seat->wlr_seat); diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 42ce333b..4b8200e8 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c @@ -223,7 +223,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, struct sway_cursor *cursor = seat->cursor; struct wlr_surface *surface = NULL; double sx, sy; - struct sway_node *node = node_at_coords(seat, + struct sway_node *node = node_at_coords( cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); if (!sway_assert(surface, @@ -336,8 +336,8 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, // Determine what's under the cursor struct wlr_surface *surface = NULL; double sx, sy; - struct sway_node *node = node_at_coords(seat, - cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); + struct sway_node *node = node_at_coords( + cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); struct sway_container *cont = node && node->type == N_CONTAINER ? node->sway_container : NULL; @@ -552,8 +552,7 @@ static void check_focus_follows_mouse(struct sway_seat *seat, struct wlr_surface *surface = NULL; double sx, sy; - node_at_coords(seat, seat->cursor->cursor->x, seat->cursor->cursor->y, - &surface, &sx, &sy); + node_at_coords(seat->cursor->cursor->x, seat->cursor->cursor->y, &surface, &sx, &sy); // Focus topmost layer surface struct wlr_layer_surface_v1 *layer = NULL; @@ -607,8 +606,8 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { struct wlr_surface *surface = NULL; double sx, sy; - struct sway_node *node = node_at_coords(seat, - cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); + struct sway_node *node = node_at_coords( + cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); if (config->focus_follows_mouse != FOLLOWS_NO) { check_focus_follows_mouse(seat, e, node); @@ -636,8 +635,8 @@ static void handle_tablet_tool_motion(struct sway_seat *seat, struct wlr_surface *surface = NULL; double sx, sy; - struct sway_node *node = node_at_coords(seat, - cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); + struct sway_node *node = node_at_coords( + cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); if (config->focus_follows_mouse != FOLLOWS_NO) { check_focus_follows_mouse(seat, e, node); @@ -665,7 +664,7 @@ static void handle_touch_down(struct sway_seat *seat, struct wlr_seat *wlr_seat = seat->wlr_seat; struct sway_cursor *cursor = seat->cursor; double sx, sy; - node_at_coords(seat, seat->touch_x, seat->touch_y, &surface, &sx, &sy); + node_at_coords(seat->touch_x, seat->touch_y, &surface, &sx, &sy); if (surface && wlr_surface_accepts_touch(surface, wlr_seat)) { if (seat_is_input_allowed(seat, surface)) { @@ -717,7 +716,7 @@ static void handle_pointer_axis(struct sway_seat *seat, // Determine what's under the cursor struct wlr_surface *surface = NULL; double sx, sy; - struct sway_node *node = node_at_coords(seat, + struct sway_node *node = node_at_coords( cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); struct sway_container *cont = node && node->type == N_CONTAINER ? node->sway_container : NULL; @@ -1109,8 +1108,8 @@ static void handle_rebase(struct sway_seat *seat, uint32_t time_msec) { struct sway_cursor *cursor = seat->cursor; struct wlr_surface *surface = NULL; double sx = 0.0, sy = 0.0; - e->previous_node = node_at_coords(seat, - cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); + e->previous_node = node_at_coords( + cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); if (surface) { if (seat_is_input_allowed(seat, surface)) { diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c index 340e334b..b79888de 100644 --- a/sway/input/seatop_down.c +++ b/sway/input/seatop_down.c @@ -75,7 +75,7 @@ static void handle_touch_down(struct sway_seat *seat, struct seatop_down_event *e = seat->seatop_data; double sx, sy; struct wlr_surface *surface = NULL; - struct sway_node *focused_node = node_at_coords(seat, seat->touch_x, + struct sway_node *focused_node = node_at_coords(seat->touch_x, seat->touch_y, &surface, &sx, &sy); if (!surface || surface != e->surface) { // Must start from the initial surface diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index c525b77a..eca24362 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c @@ -163,8 +163,8 @@ static void handle_motion_postthreshold(struct sway_seat *seat) { struct wlr_surface *surface = NULL; double sx, sy; struct sway_cursor *cursor = seat->cursor; - struct sway_node *node = node_at_coords(seat, - cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); + struct sway_node *node = node_at_coords( + cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); if (!node) { // Eg. hovered over a layer surface such as swaybar