mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
Merge pull request #852 from Laaas/master
Implement pointer-constraints-unstable-v1 protocol
This commit is contained in:
commit
5e9959daaa
30 changed files with 1238 additions and 58 deletions
|
|
@ -225,6 +225,8 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) {
|
|||
seat->pointer_state.default_grab = pointer_grab;
|
||||
seat->pointer_state.grab = pointer_grab;
|
||||
|
||||
wl_signal_init(&seat->pointer_state.events.focus_change);
|
||||
|
||||
// keyboard state
|
||||
struct wlr_seat_keyboard_grab *keyboard_grab =
|
||||
calloc(1, sizeof(struct wlr_seat_keyboard_grab));
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ static void pointer_send_frame(struct wl_resource *resource) {
|
|||
|
||||
static const struct wl_pointer_interface pointer_impl;
|
||||
|
||||
static struct wlr_seat_client *seat_client_from_pointer_resource(
|
||||
struct wlr_seat_client *wlr_seat_client_from_pointer_resource(
|
||||
struct wl_resource *resource) {
|
||||
assert(wl_resource_instance_of(resource, &wl_pointer_interface,
|
||||
&pointer_impl));
|
||||
|
|
@ -69,7 +69,7 @@ static void pointer_set_cursor(struct wl_client *client,
|
|||
struct wl_resource *surface_resource,
|
||||
int32_t hotspot_x, int32_t hotspot_y) {
|
||||
struct wlr_seat_client *seat_client =
|
||||
seat_client_from_pointer_resource(pointer_resource);
|
||||
wlr_seat_client_from_pointer_resource(pointer_resource);
|
||||
if (seat_client == NULL) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
|||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &focused_client->pointers) {
|
||||
if (seat_client_from_pointer_resource(resource) == NULL) {
|
||||
if (wlr_seat_client_from_pointer_resource(resource) == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
|||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &client->pointers) {
|
||||
if (seat_client_from_pointer_resource(resource) == NULL) {
|
||||
if (wlr_seat_client_from_pointer_resource(resource) == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +183,14 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
|
|||
wlr_seat->pointer_state.focused_client = client;
|
||||
wlr_seat->pointer_state.focused_surface = surface;
|
||||
|
||||
// TODO: send focus change event
|
||||
struct wlr_seat_pointer_focus_change_event event = {
|
||||
.seat = wlr_seat,
|
||||
.new_surface = surface,
|
||||
.old_surface = focused_surface,
|
||||
.sx = sx,
|
||||
.sy = sy,
|
||||
};
|
||||
wlr_signal_emit_safe(&wlr_seat->pointer_state.events.focus_change, &event);
|
||||
}
|
||||
|
||||
void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat) {
|
||||
|
|
@ -199,7 +206,7 @@ void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
|||
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &client->pointers) {
|
||||
if (seat_client_from_pointer_resource(resource) == NULL) {
|
||||
if (wlr_seat_client_from_pointer_resource(resource) == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +226,7 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
|
|||
uint32_t serial = wl_display_next_serial(wlr_seat->display);
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &client->pointers) {
|
||||
if (seat_client_from_pointer_resource(resource) == NULL) {
|
||||
if (wlr_seat_client_from_pointer_resource(resource) == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +246,7 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time,
|
|||
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &client->pointers) {
|
||||
if (seat_client_from_pointer_resource(resource) == NULL) {
|
||||
if (wlr_seat_client_from_pointer_resource(resource) == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -349,7 +356,7 @@ void seat_client_create_pointer(struct wlr_seat_client *seat_client,
|
|||
|
||||
void seat_client_destroy_pointer(struct wl_resource *resource) {
|
||||
struct wlr_seat_client *seat_client =
|
||||
seat_client_from_pointer_resource(resource);
|
||||
wlr_seat_client_from_pointer_resource(resource);
|
||||
if (seat_client == NULL) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue