Merge pull request #1116 from emersion/surface-role

surface: replace wlr_surface_set_role_committed with wlr_surface_role
This commit is contained in:
Drew DeVault 2018-07-11 15:27:42 -07:00 committed by GitHub
commit c0b4217fce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 256 additions and 167 deletions

View file

@ -60,6 +60,10 @@ static struct wlr_seat_client *seat_client_from_pointer_resource(
return wl_resource_get_user_data(resource);
}
static const struct wlr_surface_role pointer_cursor_surface_role = {
.name = "wl_pointer-cursor",
};
static void pointer_set_cursor(struct wl_client *client,
struct wl_resource *pointer_resource, uint32_t serial,
struct wl_resource *surface_resource,
@ -73,8 +77,8 @@ static void pointer_set_cursor(struct wl_client *client,
struct wlr_surface *surface = NULL;
if (surface_resource != NULL) {
surface = wlr_surface_from_resource(surface_resource);
if (wlr_surface_set_role(surface, "wl_pointer-cursor", surface_resource,
WL_POINTER_ERROR_ROLE) < 0) {
if (!wlr_surface_set_role(surface, &pointer_cursor_surface_role, NULL,
surface_resource, WL_POINTER_ERROR_ROLE)) {
return;
}
}
@ -351,3 +355,7 @@ void seat_client_destroy_pointer(struct wl_resource *resource) {
}
wl_resource_set_user_data(resource, NULL);
}
bool wlr_surface_is_pointer_cursor(struct wlr_surface *surface) {
return surface->role == &pointer_cursor_surface_role;
}