mirror of
https://github.com/swaywm/sway.git
synced 2024-11-11 21:14:10 +01:00
Fix flash of background when xwayland views are mapped
A flash of background was happening for two reasons: 1) We were using the xsurface's dimensions to check if the surface is ready, but these are pending dimensions. 2) In my particular setup, the default geometry of the xsurface does not intersect any output, which prevented it from receiving a frame done event. This made the transaction time out and the client would only redraw once it's been rendered.
This commit is contained in:
parent
3a6ed5110c
commit
96c8c02483
@ -298,6 +298,13 @@ void transaction_commit(struct sway_transaction *transaction) {
|
||||
instruction->state.view_width,
|
||||
instruction->state.view_height);
|
||||
++transaction->num_waiting;
|
||||
|
||||
// From here on we are rendering a saved buffer of the view, which
|
||||
// means we can send a frame done event to make the client redraw it
|
||||
// as soon as possible. Additionally, this is required if a view is
|
||||
// mapping and its default geometry doesn't intersect an output.
|
||||
struct timespec when;
|
||||
wlr_surface_send_frame_done(con->sway_view->surface, &when);
|
||||
}
|
||||
list_add(con->instructions, instruction);
|
||||
}
|
||||
|
@ -269,10 +269,11 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||
wl_container_of(listener, xwayland_view, commit);
|
||||
struct sway_view *view = &xwayland_view->view;
|
||||
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||
struct wlr_surface_state *surface_state = xsurface->surface->current;
|
||||
|
||||
if (view->swayc->instructions->length) {
|
||||
transaction_notify_view_ready_by_size(view,
|
||||
xsurface->width, xsurface->height);
|
||||
surface_state->width, surface_state->height);
|
||||
}
|
||||
view_damage_from(view);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user