cursor: add cursor_update_focus()

...and call it from desktop_move_to_front() in order force an enter event
on the surface below the cursor when cycling views.

Fixes #162 and #225
Inspired by PR #164 - just restructured it a bit.

Suggested-by: @bi4k8
Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
This commit is contained in:
Johan Malm 2021-12-26 22:09:41 +00:00
parent befe66d93f
commit 97846ae45b
3 changed files with 23 additions and 1 deletions

View file

@ -321,6 +321,20 @@ process_cursor_motion(struct server *server, uint32_t time)
}
}
static uint32_t
msec(const struct timespec *t)
{
return t->tv_sec * 1000 + t->tv_nsec / 1000000;
}
void
cursor_update_focus(struct server *server)
{
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
cursor_rebase(&server->seat, msec(&now));
}
void
start_drag(struct wl_listener *listener, void *data)
{
@ -750,7 +764,6 @@ cursor_axis(struct wl_listener *listener, void *data)
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
/* Notify the client with pointer focus of the axis event. */
cursor_rebase(seat, event->time_msec);
wlr_seat_pointer_notify_axis(seat->seat, event->time_msec,
event->orientation, event->delta, event->delta_discrete,
event->source);