mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Add tearing support (#1390)
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
This commit is contained in:
		
							parent
							
								
									72f3ce6b41
								
							
						
					
					
						commit
						bce0c6ce56
					
				
					 13 changed files with 111 additions and 1 deletions
				
			
		
							
								
								
									
										23
									
								
								src/output.c
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								src/output.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -27,6 +27,25 @@
 | 
			
		|||
#include "view.h"
 | 
			
		||||
#include "xwayland.h"
 | 
			
		||||
 | 
			
		||||
static bool
 | 
			
		||||
get_tearing_preference(struct output *output)
 | 
			
		||||
{
 | 
			
		||||
	struct server *server = output->server;
 | 
			
		||||
 | 
			
		||||
	/* Never allow tearing when disabled */
 | 
			
		||||
	if (!rc.allow_tearing) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Tearing is only allowed for the output with the active view */
 | 
			
		||||
	if (!server->active_view || server->active_view->output != output) {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* If the active view requests tearing, or it is toggled on with action, allow it */
 | 
			
		||||
	return server->active_view->tearing_hint;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
output_frame_notify(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +87,9 @@ output_frame_notify(struct wl_listener *listener, void *data)
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	wlr_scene_output_commit(output->scene_output, NULL);
 | 
			
		||||
	output->wlr_output->pending.tearing_page_flip =
 | 
			
		||||
		get_tearing_preference(output);
 | 
			
		||||
	lab_wlr_scene_output_commit(output->scene_output);
 | 
			
		||||
 | 
			
		||||
	struct timespec now = { 0 };
 | 
			
		||||
	clock_gettime(CLOCK_MONOTONIC, &now);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue