diff --git a/hw/xwayland/xwayland-drm-lease.c b/hw/xwayland/xwayland-drm-lease.c index 8bbb27e70f4dc88990d3c7fe8076e36278dc1c37..d623b4b7976557a59073fedaee52f84807dc785a 100644 --- a/hw/xwayland/xwayland-drm-lease.c +++ b/hw/xwayland/xwayland-drm-lease.c @@ -336,6 +336,7 @@ drm_lease_device_handle_connector(void *data, struct wp_drm_lease_connector_v1 *connector) { struct xwl_drm_lease_device *lease_device = data; + struct xwl_screen *xwl_screen = lease_device->xwl_screen; struct xwl_output *xwl_output; char name[256]; @@ -345,18 +346,19 @@ drm_lease_device_handle_connector(void *data, return; } - snprintf(name, sizeof name, "XWAYLAND%d", xwl_get_next_output_serial()); + snprintf(name, sizeof name, "XWAYLAND%d", + xwl_screen_get_next_output_serial(xwl_screen)); xwl_output->lease_device = lease_device; - xwl_output->xwl_screen = lease_device->xwl_screen; + xwl_output->xwl_screen = xwl_screen; xwl_output->lease_connector = connector; - xwl_output->randr_crtc = RRCrtcCreate(lease_device->xwl_screen->screen, xwl_output); + xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output); if (!xwl_output->randr_crtc) { ErrorF("Failed creating RandR CRTC\n"); goto err; } RRCrtcSetRotations(xwl_output->randr_crtc, ALL_ROTATIONS); - xwl_output->randr_output = RROutputCreate(lease_device->xwl_screen->screen, + xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name, strlen(name), xwl_output); if (!xwl_output->randr_output) { ErrorF("Failed creating RandR Output\n"); @@ -373,7 +375,7 @@ drm_lease_device_handle_connector(void *data, &lease_connector_listener, xwl_output); - xorg_list_append(&xwl_output->link, &lease_device->xwl_screen->output_list); + xorg_list_append(&xwl_output->link, &xwl_screen->output_list); return; err: diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 1dd5a5f896437e33dbaf74ee24951e7551d420ab..4a6a98f52030b6175371389ac2c28accd9b6a3f1 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -768,7 +768,8 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) xwl_output->server_output_id = id; wl_output_add_listener(xwl_output->output, &output_listener, xwl_output); - snprintf(name, sizeof name, "XWAYLAND%d", xwl_get_next_output_serial()); + snprintf(name, sizeof name, "XWAYLAND%d", + xwl_screen_get_next_output_serial(xwl_screen)); xwl_output->xwl_screen = xwl_screen; xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output); @@ -1011,10 +1012,3 @@ xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen) xorg_list_for_each_entry(it, &xwl_screen->output_list, link) xwl_output_get_xdg_output(it); } - -int -xwl_get_next_output_serial(void) -{ - static int output_name_serial = 0; - return output_name_serial++; -} diff --git a/hw/xwayland/xwayland-output.h b/hw/xwayland/xwayland-output.h index 74a46994fec3d6f64b31cc09a8a882772e73f3b6..10a353ddc9e72c9e8ab91765b38e5045f53cf987 100644 --- a/hw/xwayland/xwayland-output.h +++ b/hw/xwayland/xwayland-output.h @@ -94,6 +94,4 @@ void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen, void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen); -int xwl_get_next_output_serial(void); - #endif /* XWAYLAND_OUTPUT_H */ diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c index dd520819baa86656c98237ffa659ca8ece34fcf2..c9b93a2da07d341209f9664cbb9a35994ce53092 100644 --- a/hw/xwayland/xwayland-screen.c +++ b/hw/xwayland/xwayland-screen.c @@ -580,6 +580,13 @@ xwl_screen_roundtrip(struct xwl_screen *xwl_screen) xwl_give_up("could not connect to wayland server\n"); } + +int +xwl_screen_get_next_output_serial(struct xwl_screen *xwl_screen) +{ + return xwl_screen->output_name_serial++; +} + Bool xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) { diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h index f8aee2bdc5798a9bc8622b91597a3b79169dde18..a4738882a45383f3e684d646b88addc77d706c0a 100644 --- a/hw/xwayland/xwayland-screen.h +++ b/hw/xwayland/xwayland-screen.h @@ -48,6 +48,7 @@ struct xwl_screen { int width; int height; int depth; + int output_name_serial; ScreenPtr screen; int wm_client_id; int expecting_event; @@ -140,5 +141,6 @@ void xwl_screen_roundtrip (struct xwl_screen *xwl_screen); void xwl_surface_damage(struct xwl_screen *xwl_screen, struct wl_surface *surface, int32_t x, int32_t y, int32_t width, int32_t height); +int xwl_screen_get_next_output_serial(struct xwl_screen * xwl_screen); #endif /* XWAYLAND_SCREEN_H */