summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDima Ryazanov <dima@gmail.com>2015-05-15 22:38:28 -0700
committerMarek Chalupa <mchqwerty@gmail.com>2015-09-25 15:22:18 +0200
commit550984c95ef0bee1886dbb54e35edc0852772e2f (patch)
tree75ed524f14e9755f9d479db7361bd7e6d69fdbc2 /hw
parent6ca496b7c3ccfd677c8c1bee88cc509a5e3c9e04 (diff)
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/xwayland/xwayland-output.c1
-rw-r--r--hw/xwayland/xwayland.c11
-rw-r--r--hw/xwayland/xwayland.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index dd169e806..927224ac2 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -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++);
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index f25bc006b..e31becf5e 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -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 = {
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index 53ca420cf..a7d71193d 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -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;