|
|
@ -39,7 +39,7 @@ empty_region(pixman_region32_t *region) |
|
|
|
|
|
|
|
|
|
|
|
static void unbind_resource(struct wl_resource *resource) |
|
|
|
static void unbind_resource(struct wl_resource *resource) |
|
|
|
{ |
|
|
|
{ |
|
|
|
wl_list_remove(&resource->link); |
|
|
|
wl_list_remove(wl_resource_get_link(resource)); |
|
|
|
free(resource); |
|
|
|
free(resource); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -143,7 +143,7 @@ default_grab_button(struct weston_pointer_grab *grab, |
|
|
|
|
|
|
|
|
|
|
|
resource = pointer->focus_resource; |
|
|
|
resource = pointer->focus_resource; |
|
|
|
if (resource) { |
|
|
|
if (resource) { |
|
|
|
display = wl_client_get_display(resource->client); |
|
|
|
display = wl_client_get_display(wl_resource_get_client(resource)); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
wl_pointer_send_button(resource, serial, time, button, state_w); |
|
|
|
wl_pointer_send_button(resource, serial, time, button, state_w); |
|
|
|
} |
|
|
|
} |
|
|
@ -175,7 +175,7 @@ default_grab_touch_down(struct weston_touch_grab *grab, uint32_t time, |
|
|
|
uint32_t serial; |
|
|
|
uint32_t serial; |
|
|
|
|
|
|
|
|
|
|
|
if (touch->focus_resource && touch->focus) { |
|
|
|
if (touch->focus_resource && touch->focus) { |
|
|
|
display = wl_client_get_display(touch->focus_resource->client); |
|
|
|
display = wl_client_get_display(wl_resource_get_client(touch->focus_resource)); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
wl_touch_send_down(touch->focus_resource, serial, time, |
|
|
|
wl_touch_send_down(touch->focus_resource, serial, time, |
|
|
|
touch->focus->resource, |
|
|
|
touch->focus->resource, |
|
|
@ -192,7 +192,7 @@ default_grab_touch_up(struct weston_touch_grab *grab, |
|
|
|
uint32_t serial; |
|
|
|
uint32_t serial; |
|
|
|
|
|
|
|
|
|
|
|
if (touch->focus_resource) { |
|
|
|
if (touch->focus_resource) { |
|
|
|
display = wl_client_get_display(touch->focus_resource->client); |
|
|
|
display = wl_client_get_display(wl_resource_get_client(touch->focus_resource)); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
wl_touch_send_up(touch->focus_resource, serial, time, touch_id); |
|
|
|
wl_touch_send_up(touch->focus_resource, serial, time, touch_id); |
|
|
|
} |
|
|
|
} |
|
|
@ -227,7 +227,7 @@ default_grab_key(struct weston_keyboard_grab *grab, |
|
|
|
|
|
|
|
|
|
|
|
resource = keyboard->focus_resource; |
|
|
|
resource = keyboard->focus_resource; |
|
|
|
if (resource) { |
|
|
|
if (resource) { |
|
|
|
display = wl_client_get_display(resource->client); |
|
|
|
display = wl_client_get_display(wl_resource_get_client(resource)); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
wl_keyboard_send_key(resource, serial, time, key, state); |
|
|
|
wl_keyboard_send_key(resource, serial, time, key, state); |
|
|
|
} |
|
|
|
} |
|
|
@ -236,17 +236,13 @@ default_grab_key(struct weston_keyboard_grab *grab, |
|
|
|
static struct wl_resource * |
|
|
|
static struct wl_resource * |
|
|
|
find_resource_for_surface(struct wl_list *list, struct weston_surface *surface) |
|
|
|
find_resource_for_surface(struct wl_list *list, struct weston_surface *surface) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_resource *r; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!surface) |
|
|
|
if (!surface) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(r, list, link) { |
|
|
|
if (!surface->resource) |
|
|
|
if (r->client == wl_resource_get_client(surface->resource)) |
|
|
|
return NULL; |
|
|
|
return r; |
|
|
|
|
|
|
|
} |
|
|
|
return wl_resource_find_for_client(list, wl_resource_get_client(surface->resource)); |
|
|
|
|
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
static void |
|
|
@ -408,7 +404,7 @@ weston_touch_destroy(struct weston_touch *touch) |
|
|
|
static void |
|
|
|
static void |
|
|
|
seat_send_updated_caps(struct weston_seat *seat) |
|
|
|
seat_send_updated_caps(struct weston_seat *seat) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct wl_resource *r; |
|
|
|
struct wl_list *link; |
|
|
|
enum wl_seat_capability caps = 0; |
|
|
|
enum wl_seat_capability caps = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (seat->pointer) |
|
|
|
if (seat->pointer) |
|
|
@ -418,8 +414,10 @@ seat_send_updated_caps(struct weston_seat *seat) |
|
|
|
if (seat->touch) |
|
|
|
if (seat->touch) |
|
|
|
caps |= WL_SEAT_CAPABILITY_TOUCH; |
|
|
|
caps |= WL_SEAT_CAPABILITY_TOUCH; |
|
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(r, &seat->base_resource_list, link) |
|
|
|
for (link = seat->base_resource_list.next; |
|
|
|
wl_seat_send_capabilities(r, caps); |
|
|
|
link != &seat->base_resource_list; link = link->next) { |
|
|
|
|
|
|
|
wl_seat_send_capabilities(wl_resource_from_link(link), caps); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WL_EXPORT void |
|
|
|
WL_EXPORT void |
|
|
@ -434,7 +432,7 @@ weston_pointer_set_focus(struct weston_pointer *pointer, |
|
|
|
|
|
|
|
|
|
|
|
resource = pointer->focus_resource; |
|
|
|
resource = pointer->focus_resource; |
|
|
|
if (resource && pointer->focus != surface) { |
|
|
|
if (resource && pointer->focus != surface) { |
|
|
|
display = wl_client_get_display(resource->client); |
|
|
|
display = wl_client_get_display(wl_resource_get_client(resource)); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
wl_pointer_send_leave(resource, serial, |
|
|
|
wl_pointer_send_leave(resource, serial, |
|
|
|
pointer->focus->resource); |
|
|
|
pointer->focus->resource); |
|
|
@ -446,7 +444,7 @@ weston_pointer_set_focus(struct weston_pointer *pointer, |
|
|
|
if (resource && |
|
|
|
if (resource && |
|
|
|
(pointer->focus != surface || |
|
|
|
(pointer->focus != surface || |
|
|
|
pointer->focus_resource != resource)) { |
|
|
|
pointer->focus_resource != resource)) { |
|
|
|
display = wl_client_get_display(resource->client); |
|
|
|
display = wl_client_get_display(wl_resource_get_client(resource)); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
if (kbd) { |
|
|
|
if (kbd) { |
|
|
|
kr = find_resource_for_surface(&kbd->resource_list, |
|
|
|
kr = find_resource_for_surface(&kbd->resource_list, |
|
|
@ -462,8 +460,8 @@ weston_pointer_set_focus(struct weston_pointer *pointer, |
|
|
|
} |
|
|
|
} |
|
|
|
wl_pointer_send_enter(resource, serial, surface->resource, |
|
|
|
wl_pointer_send_enter(resource, serial, surface->resource, |
|
|
|
sx, sy); |
|
|
|
sx, sy); |
|
|
|
wl_signal_add(&resource->destroy_signal, |
|
|
|
wl_resource_add_destroy_listener(resource, |
|
|
|
&pointer->focus_listener); |
|
|
|
&pointer->focus_listener); |
|
|
|
pointer->focus_serial = serial; |
|
|
|
pointer->focus_serial = serial; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -482,7 +480,7 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard, |
|
|
|
|
|
|
|
|
|
|
|
if (keyboard->focus_resource && keyboard->focus != surface) { |
|
|
|
if (keyboard->focus_resource && keyboard->focus != surface) { |
|
|
|
resource = keyboard->focus_resource; |
|
|
|
resource = keyboard->focus_resource; |
|
|
|
display = wl_client_get_display(resource->client); |
|
|
|
display = wl_client_get_display(wl_resource_get_client(resource)); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
wl_keyboard_send_leave(resource, serial, |
|
|
|
wl_keyboard_send_leave(resource, serial, |
|
|
|
keyboard->focus->resource); |
|
|
|
keyboard->focus->resource); |
|
|
@ -494,7 +492,7 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard, |
|
|
|
if (resource && |
|
|
|
if (resource && |
|
|
|
(keyboard->focus != surface || |
|
|
|
(keyboard->focus != surface || |
|
|
|
keyboard->focus_resource != resource)) { |
|
|
|
keyboard->focus_resource != resource)) { |
|
|
|
display = wl_client_get_display(resource->client); |
|
|
|
display = wl_client_get_display(wl_resource_get_client(resource)); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
serial = wl_display_next_serial(display); |
|
|
|
wl_keyboard_send_modifiers(resource, serial, |
|
|
|
wl_keyboard_send_modifiers(resource, serial, |
|
|
|
keyboard->modifiers.mods_depressed, |
|
|
|
keyboard->modifiers.mods_depressed, |
|
|
@ -503,8 +501,8 @@ weston_keyboard_set_focus(struct weston_keyboard *keyboard, |
|
|
|
keyboard->modifiers.group); |
|
|
|
keyboard->modifiers.group); |
|
|
|
wl_keyboard_send_enter(resource, serial, surface->resource, |
|
|
|
wl_keyboard_send_enter(resource, serial, surface->resource, |
|
|
|
&keyboard->keys); |
|
|
|
&keyboard->keys); |
|
|
|
wl_signal_add(&resource->destroy_signal, |
|
|
|
wl_resource_add_destroy_listener(resource, |
|
|
|
&keyboard->focus_listener); |
|
|
|
&keyboard->focus_listener); |
|
|
|
keyboard->focus_serial = serial; |
|
|
|
keyboard->focus_serial = serial; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -998,8 +996,8 @@ touch_set_focus(struct weston_seat *seat, struct weston_surface *surface) |
|
|
|
|
|
|
|
|
|
|
|
seat->touch->focus = surface; |
|
|
|
seat->touch->focus = surface; |
|
|
|
seat->touch->focus_resource = resource; |
|
|
|
seat->touch->focus_resource = resource; |
|
|
|
wl_signal_add(&resource->destroy_signal, |
|
|
|
wl_resource_add_destroy_listener(resource, |
|
|
|
&seat->touch->focus_listener); |
|
|
|
&seat->touch->focus_listener); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1104,7 +1102,7 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource, |
|
|
|
uint32_t serial, struct wl_resource *surface_resource, |
|
|
|
uint32_t serial, struct wl_resource *surface_resource, |
|
|
|
int32_t x, int32_t y) |
|
|
|
int32_t x, int32_t y) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_pointer *pointer = resource->data; |
|
|
|
struct weston_pointer *pointer = wl_resource_get_user_data(resource); |
|
|
|
struct weston_surface *surface = NULL; |
|
|
|
struct weston_surface *surface = NULL; |
|
|
|
|
|
|
|
|
|
|
|
if (surface_resource) |
|
|
|
if (surface_resource) |
|
|
@ -1155,7 +1153,7 @@ static void |
|
|
|
seat_get_pointer(struct wl_client *client, struct wl_resource *resource, |
|
|
|
seat_get_pointer(struct wl_client *client, struct wl_resource *resource, |
|
|
|
uint32_t id) |
|
|
|
uint32_t id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_seat *seat = resource->data; |
|
|
|
struct weston_seat *seat = wl_resource_get_user_data(resource); |
|
|
|
struct wl_resource *cr; |
|
|
|
struct wl_resource *cr; |
|
|
|
|
|
|
|
|
|
|
|
if (!seat->pointer) |
|
|
|
if (!seat->pointer) |
|
|
@ -1163,8 +1161,8 @@ seat_get_pointer(struct wl_client *client, struct wl_resource *resource, |
|
|
|
|
|
|
|
|
|
|
|
cr = wl_client_add_object(client, &wl_pointer_interface, |
|
|
|
cr = wl_client_add_object(client, &wl_pointer_interface, |
|
|
|
&pointer_interface, id, seat->pointer); |
|
|
|
&pointer_interface, id, seat->pointer); |
|
|
|
wl_list_insert(&seat->pointer->resource_list, &cr->link); |
|
|
|
wl_list_insert(&seat->pointer->resource_list, wl_resource_get_link(cr)); |
|
|
|
cr->destroy = unbind_resource; |
|
|
|
wl_resource_set_destructor(cr, unbind_resource); |
|
|
|
|
|
|
|
|
|
|
|
if (seat->pointer->focus && |
|
|
|
if (seat->pointer->focus && |
|
|
|
wl_resource_get_client(seat->pointer->focus->resource) == client) { |
|
|
|
wl_resource_get_client(seat->pointer->focus->resource) == client) { |
|
|
@ -1188,7 +1186,7 @@ static void |
|
|
|
seat_get_keyboard(struct wl_client *client, struct wl_resource *resource, |
|
|
|
seat_get_keyboard(struct wl_client *client, struct wl_resource *resource, |
|
|
|
uint32_t id) |
|
|
|
uint32_t id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_seat *seat = resource->data; |
|
|
|
struct weston_seat *seat = wl_resource_get_user_data(resource); |
|
|
|
struct wl_resource *cr; |
|
|
|
struct wl_resource *cr; |
|
|
|
|
|
|
|
|
|
|
|
if (!seat->keyboard) |
|
|
|
if (!seat->keyboard) |
|
|
@ -1196,8 +1194,8 @@ seat_get_keyboard(struct wl_client *client, struct wl_resource *resource, |
|
|
|
|
|
|
|
|
|
|
|
cr = wl_client_add_object(client, &wl_keyboard_interface, NULL, id, |
|
|
|
cr = wl_client_add_object(client, &wl_keyboard_interface, NULL, id, |
|
|
|
seat); |
|
|
|
seat); |
|
|
|
wl_list_insert(&seat->keyboard->resource_list, &cr->link); |
|
|
|
wl_list_insert(&seat->keyboard->resource_list, wl_resource_get_link(cr)); |
|
|
|
cr->destroy = unbind_resource; |
|
|
|
wl_resource_set_destructor(cr, unbind_resource); |
|
|
|
|
|
|
|
|
|
|
|
wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, |
|
|
|
wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, |
|
|
|
seat->xkb_info.keymap_fd, |
|
|
|
seat->xkb_info.keymap_fd, |
|
|
@ -1215,15 +1213,15 @@ static void |
|
|
|
seat_get_touch(struct wl_client *client, struct wl_resource *resource, |
|
|
|
seat_get_touch(struct wl_client *client, struct wl_resource *resource, |
|
|
|
uint32_t id) |
|
|
|
uint32_t id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct weston_seat *seat = resource->data; |
|
|
|
struct weston_seat *seat = wl_resource_get_user_data(resource); |
|
|
|
struct wl_resource *cr; |
|
|
|
struct wl_resource *cr; |
|
|
|
|
|
|
|
|
|
|
|
if (!seat->touch) |
|
|
|
if (!seat->touch) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
cr = wl_client_add_object(client, &wl_touch_interface, NULL, id, seat); |
|
|
|
cr = wl_client_add_object(client, &wl_touch_interface, NULL, id, seat); |
|
|
|
wl_list_insert(&seat->touch->resource_list, &cr->link); |
|
|
|
wl_list_insert(&seat->touch->resource_list, wl_resource_get_link(cr)); |
|
|
|
cr->destroy = unbind_resource; |
|
|
|
wl_resource_set_destructor(cr, unbind_resource); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static const struct wl_seat_interface seat_interface = { |
|
|
|
static const struct wl_seat_interface seat_interface = { |
|
|
@ -1241,8 +1239,8 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id) |
|
|
|
|
|
|
|
|
|
|
|
resource = wl_client_add_object(client, &wl_seat_interface, |
|
|
|
resource = wl_client_add_object(client, &wl_seat_interface, |
|
|
|
&seat_interface, id, data); |
|
|
|
&seat_interface, id, data); |
|
|
|
wl_list_insert(&seat->base_resource_list, &resource->link); |
|
|
|
wl_list_insert(&seat->base_resource_list, wl_resource_get_link(resource)); |
|
|
|
resource->destroy = unbind_resource; |
|
|
|
wl_resource_set_destructor(resource, unbind_resource); |
|
|
|
|
|
|
|
|
|
|
|
if (seat->pointer) |
|
|
|
if (seat->pointer) |
|
|
|
caps |= WL_SEAT_CAPABILITY_POINTER; |
|
|
|
caps |= WL_SEAT_CAPABILITY_POINTER; |
|
|
|