mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
Also check for interface version wl_display_get_object_id().
This commit is contained in:
parent
97079ad52c
commit
8049cbb88a
3 changed files with 8 additions and 6 deletions
|
|
@ -47,7 +47,7 @@ screenshooter_create(struct wl_display *display)
|
||||||
struct screenshooter *screenshooter;
|
struct screenshooter *screenshooter;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
|
||||||
id = wl_display_get_object_id(display, "screenshooter");
|
id = wl_display_get_object_id(display, "screenshooter", 1);
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
fprintf(stderr, "server doesn't support screenshooter interface\n");
|
fprintf(stderr, "server doesn't support screenshooter interface\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ wl_display_create(const char *name, size_t name_size)
|
||||||
wl_list_init(&display->visual_list);
|
wl_list_init(&display->visual_list);
|
||||||
|
|
||||||
display->proxy.interface = &wl_display_interface;
|
display->proxy.interface = &wl_display_interface;
|
||||||
display->proxy.id = wl_display_get_object_id(display, "display");
|
display->proxy.id = wl_display_get_object_id(display, "display", 1);
|
||||||
display->proxy.display = display;
|
display->proxy.display = display;
|
||||||
|
|
||||||
display->connection = wl_connection_create(display->fd,
|
display->connection = wl_connection_create(display->fd,
|
||||||
|
|
@ -188,14 +188,16 @@ wl_display_destroy(struct wl_display *display)
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT uint32_t
|
WL_EXPORT uint32_t
|
||||||
wl_display_get_object_id(struct wl_display *display, const char *interface)
|
wl_display_get_object_id(struct wl_display *display,
|
||||||
|
const char *interface, uint32_t version)
|
||||||
{
|
{
|
||||||
struct wl_global *global;
|
struct wl_global *global;
|
||||||
|
|
||||||
global = container_of(display->global_list.next,
|
global = container_of(display->global_list.next,
|
||||||
struct wl_global, link);
|
struct wl_global, link);
|
||||||
while (&global->link != &display->global_list) {
|
while (&global->link != &display->global_list) {
|
||||||
if (strcmp(global->interface, interface) == 0)
|
if (strcmp(global->interface, interface) == 0 &&
|
||||||
|
global->version >= version)
|
||||||
return global->id;
|
return global->id;
|
||||||
|
|
||||||
global = container_of(global->link.next,
|
global = container_of(global->link.next,
|
||||||
|
|
@ -342,7 +344,7 @@ wl_display_get_compositor(struct wl_display *display)
|
||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
|
||||||
id = wl_display_get_object_id(display, "compositor");
|
id = wl_display_get_object_id(display, "compositor", 1);
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ void wl_surface_damage(struct wl_surface *surface,
|
||||||
* objects. */
|
* objects. */
|
||||||
|
|
||||||
uint32_t wl_display_get_object_id(struct wl_display *display,
|
uint32_t wl_display_get_object_id(struct wl_display *display,
|
||||||
const char *interface);
|
const char *interface, uint32_t version);
|
||||||
uint32_t wl_display_allocate_id(struct wl_display *display);
|
uint32_t wl_display_allocate_id(struct wl_display *display);
|
||||||
void wl_display_write(struct wl_display *display,
|
void wl_display_write(struct wl_display *display,
|
||||||
const void *data,
|
const void *data,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue