Commit 550984c9 authored by Dima Ryazanov's avatar Dima Ryazanov Committed by Marek Chalupa

xwayland: Destroy xwl_output when wl_output gets removed

This makes Xwayland correctly handle a monitor getting unplugged.

[Marek]: use xorg_list_for_each_entry_safe
Signed-off-by: Dima Ryazanov's avatarDima Ryazanov <>
Signed-off-by: default avatarMarek Chalupa <>
parent 6ca496b7
......@@ -165,6 +165,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
xwl_output->output = wl_registry_bind(xwl_screen->registry, id,
&wl_output_interface, 2);
xwl_output->server_output_id = id;
wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);
snprintf(name, sizeof name, "XWAYLAND%d", serial++);
......@@ -410,7 +410,16 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
static void
global_remove(void *data, struct wl_registry *registry, uint32_t name)
/* Nothing to do here, wl_compositor and wl_shm should not be removed */
struct xwl_screen *xwl_screen = data;
struct xwl_output *xwl_output, *tmp_xwl_output;
xorg_list_for_each_entry_safe(xwl_output, tmp_xwl_output,
&xwl_screen->output_list, link) {
if (xwl_output->server_output_id == name) {
static const struct wl_registry_listener registry_listener = {
......@@ -142,6 +142,7 @@ struct xwl_seat {
struct xwl_output {
struct xorg_list link;
struct wl_output *output;
uint32_t server_output_id;
struct xwl_screen *xwl_screen;
RROutputPtr randr_output;
RRCrtcPtr randr_crtc;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment