mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-08 13:29:45 -05:00
Wire up pointer, start on cursor
This commit is contained in:
parent
0699aa62d8
commit
7523de7c61
5 changed files with 80 additions and 8 deletions
28
rootston/cursor.c
Normal file
28
rootston/cursor.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
void cursor_update_position(struct roots_input *input, uint32_t time) {
|
||||
/*
|
||||
if (input->motion_context.surface) {
|
||||
struct example_xdg_surface_v6 *surface;
|
||||
surface = sample->motion_context.surface;
|
||||
surface->position.lx = sample->cursor->x - sample->motion_context.off_x;
|
||||
surface->position.ly = sample->cursor->y - sample->motion_context.off_y;
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
struct wlr_xdg_surface_v6 *surface = example_xdg_surface_at(sample,
|
||||
sample->cursor->x, sample->cursor->y);
|
||||
|
||||
if (surface) {
|
||||
struct example_xdg_surface_v6 *esurface = surface->data;
|
||||
|
||||
double sx = sample->cursor->x - esurface->position.lx;
|
||||
double sy = sample->cursor->y - esurface->position.ly;
|
||||
|
||||
// TODO z-order
|
||||
wlr_seat_pointer_enter(sample->wl_seat, surface->surface, sx, sy);
|
||||
wlr_seat_pointer_send_motion(sample->wl_seat, time, sx, sy);
|
||||
} else {
|
||||
wlr_seat_pointer_clear_focus(sample->wl_seat);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue