@ -280,37 +280,44 @@ static void render_saved_view(struct sway_view *view,
struct sway_output * output , pixman_region32_t * damage , float alpha ) {
struct sway_output * output , pixman_region32_t * damage , float alpha ) {
struct wlr_output * wlr_output = output - > wlr_output ;
struct wlr_output * wlr_output = output - > wlr_output ;
if ( ! view - > saved_buffer | | ! view - > saved_buffer - > texture ) {
if ( wl_list_empty ( & view - > saved_buffers ) ) {
return ;
return ;
}
}
struct wlr_box box = {
struct sway_saved_buffer * saved_buf ;
. x = view - > container - > surface_x - output - > lx -
wl_list_for_each ( saved_buf , & view - > saved_buffers , link ) {
view - > saved_geometry . x ,
if ( ! saved_buf - > buffer - > texture ) {
. y = view - > container - > surface_y - output - > ly -
continue ;
view - > saved_geometry . y ,
}
. width = view - > saved_buffer_width ,
. height = view - > saved_buffer_height ,
} ;
struct wlr_box output_box = {
. width = output - > width ,
. height = output - > height ,
} ;
struct wlr_box intersection ;
struct wlr_box box = {
bool intersects = wlr_box_intersection ( & intersection , & output_box , & box ) ;
. x = view - > container - > surface_x - output - > lx -
if ( ! intersects ) {
view - > saved_geometry . x + saved_buf - > x ,
return ;
. y = view - > container - > surface_y - output - > ly -
}
view - > saved_geometry . y + saved_buf - > y ,
. width = saved_buf - > width ,
. height = saved_buf - > height ,
} ;
struct wlr_box output_box = {
. width = output - > width ,
. height = output - > height ,
} ;
struct wlr_box intersection ;
bool intersects = wlr_box_intersection ( & intersection , & output_box , & box ) ;
if ( ! intersects ) {
continue ;
}
scale_box ( & box , wlr_output - > scale ) ;
scale_box ( & box , wlr_output - > scale ) ;
float matrix [ 9 ] ;
float matrix [ 9 ] ;
wlr_matrix_project_box ( matrix , & box , WL_OUTPUT_TRANSFORM_NORMAL , 0 ,
wlr_matrix_project_box ( matrix , & box , WL_OUTPUT_TRANSFORM_NORMAL , 0 ,
wlr_output - > transform_matrix ) ;
wlr_output - > transform_matrix ) ;
render_texture ( wlr_output , damage , view - > saved_buffer - > texture ,
render_texture ( wlr_output , damage , saved_buf - > buffer - > texture ,
& box , matrix , alpha ) ;
& box , matrix , alpha ) ;
}
// FIXME: we should set the surface that this saved buffer originates from
// FIXME: we should set the surface that this saved buffer originates from
// as sampled here.
// as sampled here.
@ -323,7 +330,7 @@ static void render_saved_view(struct sway_view *view,
static void render_view ( struct sway_output * output , pixman_region32_t * damage ,
static void render_view ( struct sway_output * output , pixman_region32_t * damage ,
struct sway_container * con , struct border_colors * colors ) {
struct sway_container * con , struct border_colors * colors ) {
struct sway_view * view = con - > view ;
struct sway_view * view = con - > view ;
if ( view - > saved_buffer ) {
if ( ! wl_list_empty ( & view - > saved_buffer s) ) {
render_saved_view ( view , output , damage , view - > container - > alpha ) ;
render_saved_view ( view , output , damage , view - > container - > alpha ) ;
} else if ( view - > surface ) {
} else if ( view - > surface ) {
render_view_toplevels ( view , output , damage , view - > container - > alpha ) ;
render_view_toplevels ( view , output , damage , view - > container - > alpha ) ;
@ -1020,7 +1027,7 @@ void output_render(struct sway_output *output, struct timespec *when,
}
}
if ( fullscreen_con - > view ) {
if ( fullscreen_con - > view ) {
if ( fullscreen_con - > view - > saved_buffer ) {
if ( ! wl_list_empty ( & fullscreen_con - > view - > saved_buffer s) ) {
render_saved_view ( fullscreen_con - > view , output , damage , 1.0f ) ;
render_saved_view ( fullscreen_con - > view , output , damage , 1.0f ) ;
} else if ( fullscreen_con - > view - > surface ) {
} else if ( fullscreen_con - > view - > surface ) {
render_view_toplevels ( fullscreen_con - > view ,
render_view_toplevels ( fullscreen_con - > view ,