mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	pointer-constraints: use proper wayland-scanner functions
This commit is contained in:
		
							parent
							
								
									792b1f5cbf
								
							
						
					
					
						commit
						d98181dab8
					
				
					 2 changed files with 17 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -85,6 +85,9 @@ struct wlr_pointer_constraint_v1 *
 | 
			
		|||
 | 
			
		||||
void wlr_pointer_constraint_v1_send_activated(
 | 
			
		||||
	struct wlr_pointer_constraint_v1 *constraint);
 | 
			
		||||
/**
 | 
			
		||||
 * Deactivate the constraint. May destroy the constraint.
 | 
			
		||||
 */
 | 
			
		||||
void wlr_pointer_constraint_v1_send_deactivated(
 | 
			
		||||
	struct wlr_pointer_constraint_v1 *constraint);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -346,22 +346,27 @@ struct wlr_pointer_constraint_v1 *
 | 
			
		|||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Thankfully zwp_confined_pointer_v1_send_{un,}confined work
 | 
			
		||||
// on both locked and confined pointer constraints.
 | 
			
		||||
void wlr_pointer_constraint_v1_send_activated(
 | 
			
		||||
		struct wlr_pointer_constraint_v1 *constraint) {
 | 
			
		||||
	wlr_log(WLR_DEBUG, "constrained %p", constraint);
 | 
			
		||||
	if (constraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED) {
 | 
			
		||||
		zwp_locked_pointer_v1_send_locked(constraint->resource);
 | 
			
		||||
	} else {
 | 
			
		||||
		zwp_confined_pointer_v1_send_confined(constraint->resource);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void wlr_pointer_constraint_v1_send_deactivated(
 | 
			
		||||
		struct wlr_pointer_constraint_v1 *constraint) {
 | 
			
		||||
	if (wl_resource_get_user_data(constraint->resource)) {
 | 
			
		||||
	wlr_log(WLR_DEBUG, "unconstrained %p", constraint);
 | 
			
		||||
	if (constraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED) {
 | 
			
		||||
		zwp_locked_pointer_v1_send_unlocked(constraint->resource);
 | 
			
		||||
	} else {
 | 
			
		||||
		zwp_confined_pointer_v1_send_unconfined(constraint->resource);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (constraint->lifetime ==
 | 
			
		||||
			ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT) {
 | 
			
		||||
		pointer_constraint_destroy(constraint);
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue