mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-07 13:29:55 -05:00
server: Assign global id as part of wl_display_add_global()
This commit is contained in:
parent
e065b7eafa
commit
3ac8757ec3
2 changed files with 1 additions and 13 deletions
|
|
@ -618,7 +618,6 @@ wl_display_create(void)
|
||||||
(void (**)(void)) &display_interface;
|
(void (**)(void)) &display_interface;
|
||||||
display->resource.data = display;
|
display->resource.data = display;
|
||||||
|
|
||||||
wl_display_add_object(display, &display->resource.object);
|
|
||||||
if (wl_display_add_global(display, &display->resource.object, NULL)) {
|
if (wl_display_add_global(display, &display->resource.object, NULL)) {
|
||||||
wl_event_loop_destroy(display->loop);
|
wl_event_loop_destroy(display->loop);
|
||||||
free(display);
|
free(display);
|
||||||
|
|
@ -649,12 +648,6 @@ wl_display_destroy(struct wl_display *display)
|
||||||
free(display);
|
free(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
|
||||||
wl_display_add_object(struct wl_display *display, struct wl_object *object)
|
|
||||||
{
|
|
||||||
object->id = display->id++;
|
|
||||||
}
|
|
||||||
|
|
||||||
WL_EXPORT int
|
WL_EXPORT int
|
||||||
wl_display_add_global(struct wl_display *display,
|
wl_display_add_global(struct wl_display *display,
|
||||||
struct wl_object *object, wl_global_bind_func_t bind)
|
struct wl_object *object, wl_global_bind_func_t bind)
|
||||||
|
|
@ -665,6 +658,7 @@ wl_display_add_global(struct wl_display *display,
|
||||||
if (global == NULL)
|
if (global == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
object->id = display->id++;
|
||||||
global->object = object;
|
global->object = object;
|
||||||
global->bind = bind;
|
global->bind = bind;
|
||||||
wl_list_insert(display->global_list.prev, &global->link);
|
wl_list_insert(display->global_list.prev, &global->link);
|
||||||
|
|
@ -886,14 +880,12 @@ wl_compositor_init(struct wl_compositor *compositor,
|
||||||
compositor->resource.object.implementation =
|
compositor->resource.object.implementation =
|
||||||
(void (**)(void)) interface;
|
(void (**)(void)) interface;
|
||||||
compositor->resource.data = compositor;
|
compositor->resource.data = compositor;
|
||||||
wl_display_add_object(display, &compositor->resource.object);
|
|
||||||
if (wl_display_add_global(display, &compositor->resource.object,
|
if (wl_display_add_global(display, &compositor->resource.object,
|
||||||
compositor_bind))
|
compositor_bind))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
compositor->argb_visual.object.interface = &wl_visual_interface;
|
compositor->argb_visual.object.interface = &wl_visual_interface;
|
||||||
compositor->argb_visual.object.implementation = NULL;
|
compositor->argb_visual.object.implementation = NULL;
|
||||||
wl_display_add_object(display, &compositor->argb_visual.object);
|
|
||||||
if (wl_display_add_global(display,
|
if (wl_display_add_global(display,
|
||||||
&compositor->argb_visual.object, NULL))
|
&compositor->argb_visual.object, NULL))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -901,8 +893,6 @@ wl_compositor_init(struct wl_compositor *compositor,
|
||||||
compositor->premultiplied_argb_visual.object.interface =
|
compositor->premultiplied_argb_visual.object.interface =
|
||||||
&wl_visual_interface;
|
&wl_visual_interface;
|
||||||
compositor->premultiplied_argb_visual.object.implementation = NULL;
|
compositor->premultiplied_argb_visual.object.implementation = NULL;
|
||||||
wl_display_add_object(display,
|
|
||||||
&compositor->premultiplied_argb_visual.object);
|
|
||||||
if (wl_display_add_global(display,
|
if (wl_display_add_global(display,
|
||||||
&compositor->premultiplied_argb_visual.object,
|
&compositor->premultiplied_argb_visual.object,
|
||||||
NULL))
|
NULL))
|
||||||
|
|
@ -910,7 +900,6 @@ wl_compositor_init(struct wl_compositor *compositor,
|
||||||
|
|
||||||
compositor->rgb_visual.object.interface = &wl_visual_interface;
|
compositor->rgb_visual.object.interface = &wl_visual_interface;
|
||||||
compositor->rgb_visual.object.implementation = NULL;
|
compositor->rgb_visual.object.implementation = NULL;
|
||||||
wl_display_add_object(display, &compositor->rgb_visual.object);
|
|
||||||
if (wl_display_add_global(display,
|
if (wl_display_add_global(display,
|
||||||
&compositor->rgb_visual.object, NULL))
|
&compositor->rgb_visual.object, NULL))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,6 @@ wl_shm_init(struct wl_display *display,
|
||||||
shm->resource.object.interface = &wl_shm_interface;
|
shm->resource.object.interface = &wl_shm_interface;
|
||||||
shm->resource.object.implementation = (void (**)(void)) &shm_interface;
|
shm->resource.object.implementation = (void (**)(void)) &shm_interface;
|
||||||
shm->resource.data = shm;
|
shm->resource.data = shm;
|
||||||
wl_display_add_object(display, &shm->resource.object);
|
|
||||||
wl_display_add_global(display, &shm->resource.object, NULL);
|
wl_display_add_global(display, &shm->resource.object, NULL);
|
||||||
|
|
||||||
shm->callbacks = callbacks;
|
shm->callbacks = callbacks;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue