mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Don't send frame done to surfaces behind lockscreen
Also, when rendering, don't descend into the tree if the lockscreen is active. Just render the lockscreen's surfaces.
This commit is contained in:
		
							parent
							
								
									b8ee88344a
								
							
						
					
					
						commit
						58befcf2cd
					
				
					 1 changed files with 30 additions and 1 deletions
				
			
		| 
						 | 
					@ -948,8 +948,30 @@ static void render_output(struct sway_output *output, struct timespec *when,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct sway_container *workspace = output_get_active_workspace(output);
 | 
						struct sway_container *workspace = output_get_active_workspace(output);
 | 
				
			||||||
	struct sway_view *fullscreen_view = workspace->current.ws_fullscreen;
 | 
						struct sway_view *fullscreen_view = workspace->current.ws_fullscreen;
 | 
				
			||||||
 | 
						struct sway_seat *seat = input_manager_current_seat(input_manager);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fullscreen_view) {
 | 
						if (seat->exclusive_client && seat->focused_layer) {
 | 
				
			||||||
 | 
							float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							int nrects;
 | 
				
			||||||
 | 
							pixman_box32_t *rects = pixman_region32_rectangles(damage, &nrects);
 | 
				
			||||||
 | 
							for (int i = 0; i < nrects; ++i) {
 | 
				
			||||||
 | 
								scissor_output(wlr_output, &rects[i]);
 | 
				
			||||||
 | 
								wlr_renderer_clear(renderer, clear_color);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							struct wlr_layer_surface *wlr_layer_surface = seat->focused_layer;
 | 
				
			||||||
 | 
							struct sway_layer_surface *sway_layer_surface =
 | 
				
			||||||
 | 
								layer_from_wlr_layer_surface(seat->focused_layer);
 | 
				
			||||||
 | 
							struct render_data data = {
 | 
				
			||||||
 | 
								.output = output,
 | 
				
			||||||
 | 
								.damage = damage,
 | 
				
			||||||
 | 
								.alpha = 1.0f,
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
							surface_for_each_surface(wlr_layer_surface->surface,
 | 
				
			||||||
 | 
								sway_layer_surface->geo.x, sway_layer_surface->geo.y,
 | 
				
			||||||
 | 
								&data.root_geo, render_surface_iterator, &data);
 | 
				
			||||||
 | 
						} else if (fullscreen_view) {
 | 
				
			||||||
		float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
 | 
							float clear_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int nrects;
 | 
							int nrects;
 | 
				
			||||||
| 
						 | 
					@ -1019,11 +1041,16 @@ struct send_frame_done_data {
 | 
				
			||||||
	struct root_geometry root_geo;
 | 
						struct root_geometry root_geo;
 | 
				
			||||||
	struct sway_output *output;
 | 
						struct sway_output *output;
 | 
				
			||||||
	struct timespec *when;
 | 
						struct timespec *when;
 | 
				
			||||||
 | 
						struct wl_client *exclusive_client;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void send_frame_done_iterator(struct wlr_surface *surface,
 | 
					static void send_frame_done_iterator(struct wlr_surface *surface,
 | 
				
			||||||
		int sx, int sy, void *_data) {
 | 
							int sx, int sy, void *_data) {
 | 
				
			||||||
	struct send_frame_done_data *data = _data;
 | 
						struct send_frame_done_data *data = _data;
 | 
				
			||||||
 | 
						if (data->exclusive_client &&
 | 
				
			||||||
 | 
								data->exclusive_client != surface->resource->client) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool intersects = get_surface_box(&data->root_geo, data->output, surface,
 | 
						bool intersects = get_surface_box(&data->root_geo, data->output, surface,
 | 
				
			||||||
		sx, sy, NULL);
 | 
							sx, sy, NULL);
 | 
				
			||||||
| 
						 | 
					@ -1072,9 +1099,11 @@ static void send_frame_done_container(struct send_frame_done_data *data,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void send_frame_done(struct sway_output *output, struct timespec *when) {
 | 
					static void send_frame_done(struct sway_output *output, struct timespec *when) {
 | 
				
			||||||
 | 
						struct sway_seat *seat = input_manager_current_seat(input_manager);
 | 
				
			||||||
	struct send_frame_done_data data = {
 | 
						struct send_frame_done_data data = {
 | 
				
			||||||
		.output = output,
 | 
							.output = output,
 | 
				
			||||||
		.when = when,
 | 
							.when = when,
 | 
				
			||||||
 | 
							.exclusive_client = seat->exclusive_client,
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct sway_container *workspace = output_get_active_workspace(output);
 | 
						struct sway_container *workspace = output_get_active_workspace(output);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue