static void check_focus(struct wayland_input *input, wl_fixed_t x, wl_fixed_t y) { struct wayland_compositor *c = input->compositor; int width, height, inside; width = input->output->mode.width; height = input->output->mode.height; inside = c->border.left <= wl_fixed_to_int(x) && wl_fixed_to_int(x) < width + c->border.left && c->border.top <= wl_fixed_to_int(y) && wl_fixed_to_int(y) < height + c->border.top; if (!input->focus && inside) { notify_pointer_focus(&input->base, &input->output->base, x - wl_fixed_from_int(c->border.left), y = wl_fixed_from_int(c->border.top)); wl_pointer_set_cursor(input->pointer, input->enter_serial, NULL, 0, 0); } else if (input->focus && !inside) { notify_pointer_focus(&input->base, NULL, 0, 0); /* FIXME: Should set default cursor here. */ } input->focus = inside; }
static void ss_seat_handle_pointer_leave(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface) { struct ss_seat *seat = data; notify_pointer_focus(&seat->base, NULL, 0, 0); }
static void input_handle_pointer_leave(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface) { struct wayland_input *input = data; notify_pointer_focus(&input->base, NULL, 0, 0); input->output = NULL; input->focus = 0; }
static void ss_seat_handle_pointer_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) { struct ss_seat *seat = data; /* No transformation of input position is required here because we are * always receiving the input in the same coordinates as the output. */ notify_pointer_focus(&seat->base, NULL, 0, 0); }