mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-20 01:40:44 -05:00
seat/pointer: add wl_pointer.warp event support
Add support for the wl_pointer.warp event from Wayland protocol version 11. https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/340 This allows the compositor to notify clients when the pointer position has changed due to surface movement or compositor action, rather than input device motion. This is useful for tracking cursor position across surface boundaries and dynamic repositioning.
This commit is contained in:
parent
1f0fb95e3b
commit
f175c2f592
5 changed files with 54 additions and 2 deletions
|
|
@ -11,7 +11,7 @@
|
|||
#include "types/wlr_seat.h"
|
||||
#include "util/global.h"
|
||||
|
||||
#define SEAT_VERSION 9
|
||||
#define SEAT_VERSION 11
|
||||
|
||||
static void seat_handle_get_pointer(struct wl_client *client,
|
||||
struct wl_resource *seat_resource, uint32_t id) {
|
||||
|
|
|
|||
|
|
@ -410,6 +410,28 @@ void wlr_seat_pointer_send_frame(struct wlr_seat *wlr_seat) {
|
|||
}
|
||||
}
|
||||
|
||||
void wlr_seat_pointer_send_warp(struct wlr_seat *wlr_seat,
|
||||
double sx, double sy) {
|
||||
struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client;
|
||||
if (client == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &client->pointers) {
|
||||
if (wlr_seat_client_from_pointer_resource(resource) == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t version = wl_resource_get_version(resource);
|
||||
if (version >= 11) { // WL_POINTER_WARP_SINCE_VERSION
|
||||
wl_pointer_send_warp(resource,
|
||||
wl_fixed_from_double(sx),
|
||||
wl_fixed_from_double(sy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wlr_seat_pointer_start_grab(struct wlr_seat *wlr_seat,
|
||||
struct wlr_seat_pointer_grab *grab) {
|
||||
assert(wlr_seat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue