cursor: Remove node_at_coords unused seat parameter

This commit is contained in:
Alexander Orzechowski 2024-08-26 16:19:18 -04:00
parent 4a3c13f1ba
commit 6ceade3ad2
6 changed files with 22 additions and 28 deletions

View file

@ -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);

View file

@ -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) {

View file

@ -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);

View file

@ -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)) {

View file

@ -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

View file

@ -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