mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-04-14 08:22:20 -04:00
Add a wl_resource_instance_of function
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
96afa34776
commit
5ac5d55d81
4 changed files with 21 additions and 4 deletions
|
|
@ -737,8 +737,8 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
interface_equal(const struct wl_interface *a, const struct wl_interface *b)
|
wl_interface_equal(const struct wl_interface *a, const struct wl_interface *b)
|
||||||
{
|
{
|
||||||
/* In most cases the pointer equality test is sufficient.
|
/* In most cases the pointer equality test is sufficient.
|
||||||
* However, in some cases, depending on how things are split
|
* However, in some cases, depending on how things are split
|
||||||
|
|
@ -784,8 +784,8 @@ wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object != NULL && message->types[i] != NULL &&
|
if (object != NULL && message->types[i] != NULL &&
|
||||||
!interface_equal((object)->interface,
|
!wl_interface_equal((object)->interface,
|
||||||
message->types[i])) {
|
message->types[i])) {
|
||||||
printf("invalid object (%u), type (%s), "
|
printf("invalid object (%u), type (%s), "
|
||||||
"message %s(%s)\n",
|
"message %s(%s)\n",
|
||||||
id, (object)->interface->name,
|
id, (object)->interface->name,
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,9 @@ struct wl_connection;
|
||||||
struct wl_closure;
|
struct wl_closure;
|
||||||
struct wl_proxy;
|
struct wl_proxy;
|
||||||
|
|
||||||
|
int wl_interface_equal(const struct wl_interface *iface1,
|
||||||
|
const struct wl_interface *iface2);
|
||||||
|
|
||||||
struct wl_connection *wl_connection_create(int fd);
|
struct wl_connection *wl_connection_create(int fd);
|
||||||
void wl_connection_destroy(struct wl_connection *connection);
|
void wl_connection_destroy(struct wl_connection *connection);
|
||||||
void wl_connection_copy(struct wl_connection *connection, void *data, size_t size);
|
void wl_connection_copy(struct wl_connection *connection, void *data, size_t size);
|
||||||
|
|
|
||||||
|
|
@ -504,6 +504,15 @@ wl_resource_set_destructor(struct wl_resource *resource,
|
||||||
resource->destroy = destroy;
|
resource->destroy = destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WL_EXPORT int
|
||||||
|
wl_resource_instance_of(struct wl_resource *resource,
|
||||||
|
const struct wl_interface *interface,
|
||||||
|
const void *implementation)
|
||||||
|
{
|
||||||
|
return wl_interface_equal(resource->object.interface, interface) &&
|
||||||
|
resource->object.implementation == implementation;
|
||||||
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
wl_resource_add_destroy_listener(struct wl_resource *resource,
|
wl_resource_add_destroy_listener(struct wl_resource *resource,
|
||||||
struct wl_listener * listener)
|
struct wl_listener * listener)
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,11 @@ wl_resource_get_user_data(struct wl_resource *resource);
|
||||||
void
|
void
|
||||||
wl_resource_set_destructor(struct wl_resource *resource,
|
wl_resource_set_destructor(struct wl_resource *resource,
|
||||||
wl_resource_destroy_func_t destroy);
|
wl_resource_destroy_func_t destroy);
|
||||||
|
int
|
||||||
|
wl_resource_instance_of(struct wl_resource *resource,
|
||||||
|
const struct wl_interface *interface,
|
||||||
|
const void *implementation);
|
||||||
|
|
||||||
void
|
void
|
||||||
wl_resource_add_destroy_listener(struct wl_resource *resource,
|
wl_resource_add_destroy_listener(struct wl_resource *resource,
|
||||||
struct wl_listener * listener);
|
struct wl_listener * listener);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue