wlserver: Fix pending surfaces getting xwayland server set

Fixes Warhammer 40,000: Dawn of War II (15620)
This commit is contained in:
Joshua Ashton 2022-07-14 21:35:19 +00:00 committed by Simon Ser
parent 8b99305352
commit 71717b2ce3
3 changed files with 9 additions and 4 deletions

View file

@ -3221,7 +3221,7 @@ add_win(xwayland_ctx_t *ctx, Window id, Window prev, unsigned long sequence)
new_win->mouseMoved = 0;
wlserver_surface_init( &new_win->surface, id );
wlserver_surface_init( &new_win->surface, ctx->xwayland_server, id );
new_win->next = *p;
*p = new_win;

View file

@ -1021,7 +1021,7 @@ static void handle_surface_destroy( struct wl_listener *l, void *data )
{
struct wlserver_surface *surf = wl_container_of( l, surf, destroy );
wlserver_surface_finish( surf );
wlserver_surface_init( surf, surf->x11_id );
wlserver_surface_init( surf, surf->xwayland_server, surf->x11_id );
}
static void wlserver_surface_set_wlr( struct wlserver_surface *surf, struct wlr_surface *wlr_surf )
@ -1035,6 +1035,7 @@ static void wlserver_surface_set_wlr( struct wlserver_surface *surf, struct wlr_
wl_signal_add( &wlr_surf->events.destroy, &surf->destroy );
surf->wlr = wlr_surf;
wlr_surf->data = surf->xwayland_server;
if ( !wlr_surface_set_role(wlr_surf, &xwayland_surface_role, NULL, NULL, 0 ) )
{
@ -1042,11 +1043,12 @@ static void wlserver_surface_set_wlr( struct wlserver_surface *surf, struct wlr_
}
}
void wlserver_surface_init( struct wlserver_surface *surf, uint32_t x11_id )
void wlserver_surface_init( struct wlserver_surface *surf, gamescope_xwayland_server_t *server, uint32_t x11_id )
{
surf->wl_id = 0;
surf->x11_id = x11_id;
surf->wlr = nullptr;
surf->xwayland_server = server;
wl_list_init( &surf->pending_link );
wl_list_init( &surf->destroy.link );
}
@ -1061,6 +1063,7 @@ void gamescope_xwayland_server_t::set_wl_id( struct wlserver_surface *surf, uint
surf->wl_id = id;
surf->wlr = nullptr;
surf->xwayland_server = this;
wl_list_insert( &pending_surfaces, &surf->pending_link );
wl_list_init( &surf->destroy.link );

View file

@ -178,9 +178,11 @@ struct wlserver_surface
bool overridden;
struct wl_list pending_link;
struct wl_listener destroy;
gamescope_xwayland_server_t *xwayland_server;
};
void wlserver_surface_init( struct wlserver_surface *surf, uint32_t x11_id );
void wlserver_surface_init( struct wlserver_surface *surf, gamescope_xwayland_server_t *server, uint32_t x11_id );
void wlserver_surface_finish( struct wlserver_surface *surf );
void wlserver_set_xwayland_server_mode( size_t idx, int w, int h, int refresh );