mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	I like the new common/edge.h. I don't like how inconsistently we use it. Current situation: - enum wlr_edges and wlr_direction are designed to be used as bitset, and are defined compatibly - enum lab_edge is *also* designed to be used as bitset, but incompatible with the others (LEFT/RIGHT come before UP/DOWN) - we use an inconsistent mix of all three *AND* uint32_t (usually with the WLR_EDGE constants rather than the LAB_EDGE constants), and convert between them on an ad-hoc basis, sometimes implicitly Let's clean this up: - reorder enum lab_edge to be compatible with the two wlr enums (check this by static_assert) - use TOP/BOTTOM naming rather than UP/DOWN (matches wlr_edges) - add constants for the remaining possible combinations of the 4 edges - use lab_edge for all internal edge/direction fields, consistently - add lab_edge_is_cardinal() as a sanity check before casting to enum wlr_direction, and then eliminate all of direction.c/h Instead of "enum wlr_edges direction", we now have "enum lab_edge direction" which is not that much better. At least we are now clear that we're overloading one enum with two meanings.
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			510 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			510 B
		
	
	
	
		
			C
		
	
	
	
	
	
/* SPDX-License-Identifier: GPL-2.0-only */
 | 
						|
#ifndef LABWC_SNAP_CONSTRAINTS_H
 | 
						|
#define LABWC_SNAP_CONSTRAINTS_H
 | 
						|
 | 
						|
#include "common/edge.h"
 | 
						|
 | 
						|
struct view;
 | 
						|
struct wlr_box;
 | 
						|
 | 
						|
void snap_constraints_set(struct view *view, enum lab_edge direction,
 | 
						|
	struct wlr_box geom);
 | 
						|
 | 
						|
void snap_constraints_invalidate(struct view *view);
 | 
						|
 | 
						|
void snap_constraints_update(struct view *view);
 | 
						|
 | 
						|
struct wlr_box snap_constraints_effective(struct view *view,
 | 
						|
	enum lab_edge direction, bool use_pending);
 | 
						|
 | 
						|
#endif /* LABWC_SNAP_CONSTRAINTS_H */
 |