Help with proxy queues please

John Cox jc at kynesim.co.uk
Mon Sep 11 11:53:15 UTC 2023


Hi
I am clearly deeply confused by event queues and proxies - I have this
snippet of code (from some VLC work I'm doing):

sys->eventq = wl_display_create_queue(video_display(sys));
if (sys->eventq == NULL) {
    msg_Err(vd, "Failed to create event Q");
    goto error;
}
if ((sys->wrapped_display =
wl_proxy_create_wrapper(video_display(sys))) == NULL)
{
    msg_Err(vd, "Failed to create wrapper");
    goto error;
}
wl_proxy_set_queue((struct wl_proxy *)sys->wrapped_display, sys->eventq);

struct wl_callback * cb;
struct wl_registry *const registry =
wl_display_get_registry(sys->wrapped_display);
if (registry == NULL) {
    msg_Err(vd, "Cannot get registry for display");
    goto error;
}

wl_registry_add_listener(registry, &registry_cbs, vd);
cb = wl_display_sync(sys->wrapped_display);
wl_callback_add_listener(cb, &reg_done_sync_listener, vd);

msg_Info(vd, "Roundtrip start");
wl_display_roundtrip_queue(sys->wrapped_display, sys->eventq);
msg_Info(vd, "Roundtrip done");
wl_registry_destroy(registry);

video_display() returns the display we are rendering to. My
expectation was that the registry & sync listeners would be called
somewhere between the roundtrip start/end debug lines, but what seems
to happen is that the roundtrip just returns immediately.

I have clearly misunderstood something at a fundamental level. I
thought that the wrapped display would set the Q that the listeners
would send events on and th eroundtrip would wait for that. The
wl_proxy_create_wrapper docn on
https://wayland.freedesktop.org/docs/html/apb.html#Client-classwl__proxy
also seems to imply this.

Any hints would be gratefully received - thanks

John Cox


More information about the wayland-devel mailing list