mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	surface: add wlr_surface.previous
This commit is contained in:
		
							parent
							
								
									78555abba3
								
							
						
					
					
						commit
						012e38fbe5
					
				
					 2 changed files with 9 additions and 8 deletions
				
			
		| 
						 | 
					@ -64,9 +64,10 @@ struct wlr_surface {
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * `current` contains the current, committed surface state. `pending`
 | 
						 * `current` contains the current, committed surface state. `pending`
 | 
				
			||||||
	 * accumulates state changes from the client between commits and shouldn't
 | 
						 * accumulates state changes from the client between commits and shouldn't
 | 
				
			||||||
	 * be accessed by the compositor directly.
 | 
						 * be accessed by the compositor directly. `previous` contains the state of
 | 
				
			||||||
 | 
						 * the previous commit.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	struct wlr_surface_state current, pending;
 | 
						struct wlr_surface_state current, pending, previous;
 | 
				
			||||||
	const char *role; // the lifetime-bound role or null
 | 
						const char *role; // the lifetime-bound role or null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct {
 | 
						struct {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -339,6 +339,7 @@ static void surface_commit_pending(struct wlr_surface *surface) {
 | 
				
			||||||
	surface_update_damage(&surface->buffer_damage,
 | 
						surface_update_damage(&surface->buffer_damage,
 | 
				
			||||||
		&surface->current, &surface->pending);
 | 
							&surface->current, &surface->pending);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						surface_state_move(&surface->previous, &surface->current);
 | 
				
			||||||
	surface_state_move(&surface->current, &surface->pending);
 | 
						surface_state_move(&surface->current, &surface->pending);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (invalid_buffer) {
 | 
						if (invalid_buffer) {
 | 
				
			||||||
| 
						 | 
					@ -548,6 +549,7 @@ static void surface_handle_resource_destroy(struct wl_resource *resource) {
 | 
				
			||||||
	wl_list_remove(&surface->renderer_destroy.link);
 | 
						wl_list_remove(&surface->renderer_destroy.link);
 | 
				
			||||||
	surface_state_finish(&surface->pending);
 | 
						surface_state_finish(&surface->pending);
 | 
				
			||||||
	surface_state_finish(&surface->current);
 | 
						surface_state_finish(&surface->current);
 | 
				
			||||||
 | 
						surface_state_finish(&surface->previous);
 | 
				
			||||||
	pixman_region32_fini(&surface->buffer_damage);
 | 
						pixman_region32_fini(&surface->buffer_damage);
 | 
				
			||||||
	wlr_buffer_unref(surface->buffer);
 | 
						wlr_buffer_unref(surface->buffer);
 | 
				
			||||||
	free(surface);
 | 
						free(surface);
 | 
				
			||||||
| 
						 | 
					@ -586,6 +588,7 @@ struct wlr_surface *wlr_surface_create(struct wl_client *client,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	surface_state_init(&surface->current);
 | 
						surface_state_init(&surface->current);
 | 
				
			||||||
	surface_state_init(&surface->pending);
 | 
						surface_state_init(&surface->pending);
 | 
				
			||||||
 | 
						surface_state_init(&surface->previous);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_signal_init(&surface->events.commit);
 | 
						wl_signal_init(&surface->events.commit);
 | 
				
			||||||
	wl_signal_init(&surface->events.destroy);
 | 
						wl_signal_init(&surface->events.destroy);
 | 
				
			||||||
| 
						 | 
					@ -792,16 +795,13 @@ static void subsurface_role_committed(struct wlr_surface *surface, void *data) {
 | 
				
			||||||
			dy = tmp;
 | 
								dy = tmp;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// TODO: take the previous size
 | 
					 | 
				
			||||||
		pixman_region32_union_rect(&surface->buffer_damage,
 | 
							pixman_region32_union_rect(&surface->buffer_damage,
 | 
				
			||||||
			&surface->buffer_damage,
 | 
								&surface->buffer_damage,
 | 
				
			||||||
			dx * surface->current.scale, dy * surface->current.scale,
 | 
								dx * surface->previous.scale, dy * surface->previous.scale,
 | 
				
			||||||
			surface->current.width,
 | 
								surface->previous.width, surface->previous.height);
 | 
				
			||||||
			surface->current.height);
 | 
					 | 
				
			||||||
		pixman_region32_union_rect(&surface->buffer_damage,
 | 
							pixman_region32_union_rect(&surface->buffer_damage,
 | 
				
			||||||
			&surface->buffer_damage, 0, 0,
 | 
								&surface->buffer_damage, 0, 0,
 | 
				
			||||||
			surface->pending.width,
 | 
								surface->current.width, surface->current.height);
 | 
				
			||||||
			surface->pending.height);
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue