[PATCH v2 3/3] xwayland: Destroy xwl_output when wl_output gets removed
Marek Chalupa
mchqwerty at gmail.com
Wed Jul 15 02:21:41 PDT 2015
On 05/16/2015 07:38 AM, Dima Ryazanov wrote:
> This makes Xwayland correctly handle a monitor getting unplugged.
>
> Signed-off-by: Dima Ryazanov <dima at gmail.com>
> ---
> hw/xwayland/xwayland-output.c | 1 +
> hw/xwayland/xwayland.c | 10 +++++++++-
> hw/xwayland/xwayland.h | 1 +
> 3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
> index 41937b8..9ef8a48 100644
> --- a/hw/xwayland/xwayland-output.c
> +++ b/hw/xwayland/xwayland-output.c
> @@ -163,6 +163,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++);
> diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
> index 7e8d667..7c2eaed 100644
> --- a/hw/xwayland/xwayland.c
> +++ b/hw/xwayland/xwayland.c
> @@ -410,7 +410,15 @@ 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;
> +
> + xorg_list_for_each_entry(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 = {
> diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
> index cfb343d..70875e7 100644
> --- a/hw/xwayland/xwayland.h
> +++ b/hw/xwayland/xwayland.h
> @@ -130,6 +130,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;
>
As I wrote before, I'm not in favor of patch 1 in this series. However,
this patch needs patch 1 to work properly, so I'm in for using the
version 1 of patch 1
(http://lists.freedesktop.org/archives/wayland-devel/2015-May/021909.html)
With above mentioned this series is:
Reviewed-by: Marek Chalupa <mchqwerty at gmail.com>
Regards,
Marek
More information about the wayland-devel
mailing list