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 <dima@gmail.com> Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
This commit is contained in:
parent
6ca496b7c3
commit
550984c95e
|
@ -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) {
|
||||
xwl_output_destroy(xwl_output);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user