mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	surface: error out on invalid transform
This commit is contained in:
		
							parent
							
								
									69b9e2ae8f
								
							
						
					
					
						commit
						d238cc9f56
					
				
					 1 changed files with 8 additions and 3 deletions
				
			
		| 
						 | 
					@ -450,15 +450,20 @@ static void surface_commit(struct wl_client *client,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void surface_set_buffer_transform(struct wl_client *client,
 | 
					static void surface_set_buffer_transform(struct wl_client *client,
 | 
				
			||||||
		struct wl_resource *resource, int transform) {
 | 
							struct wl_resource *resource, int32_t transform) {
 | 
				
			||||||
 | 
						if (transform < WL_OUTPUT_TRANSFORM_NORMAL ||
 | 
				
			||||||
 | 
								transform > WL_OUTPUT_TRANSFORM_FLIPPED_270) {
 | 
				
			||||||
 | 
							wl_resource_post_error(resource, WL_SURFACE_ERROR_INVALID_TRANSFORM,
 | 
				
			||||||
 | 
								"Specified transform value (%d) is invalid", transform);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	struct wlr_surface *surface = wlr_surface_from_resource(resource);
 | 
						struct wlr_surface *surface = wlr_surface_from_resource(resource);
 | 
				
			||||||
	surface->pending.committed |= WLR_SURFACE_STATE_TRANSFORM;
 | 
						surface->pending.committed |= WLR_SURFACE_STATE_TRANSFORM;
 | 
				
			||||||
	surface->pending.transform = transform;
 | 
						surface->pending.transform = transform;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void surface_set_buffer_scale(struct wl_client *client,
 | 
					static void surface_set_buffer_scale(struct wl_client *client,
 | 
				
			||||||
		struct wl_resource *resource,
 | 
							struct wl_resource *resource, int32_t scale) {
 | 
				
			||||||
		int32_t scale) {
 | 
					 | 
				
			||||||
	if (scale <= 0) {
 | 
						if (scale <= 0) {
 | 
				
			||||||
		wl_resource_post_error(resource, WL_SURFACE_ERROR_INVALID_SCALE,
 | 
							wl_resource_post_error(resource, WL_SURFACE_ERROR_INVALID_SCALE,
 | 
				
			||||||
			"Specified scale value (%d) is not positive", scale);
 | 
								"Specified scale value (%d) is not positive", scale);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue