mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Remove min/max macros
...and replace with a local MAX macro, because:
- They contain a ({}) construct which is a GNU extension and that's
  against Drew's coding style
- min() is not used anyway
- MAX() clashes with cairo's macro, so best to not add this in labwc.h
			
			
This commit is contained in:
		
							parent
							
								
									b7c326ec6f
								
							
						
					
					
						commit
						bca57213a0
					
				
					 3 changed files with 8 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -46,16 +46,6 @@
 | 
			
		|||
#define XCURSOR_SIZE 24
 | 
			
		||||
#define XCURSOR_MOVE "grabbing"
 | 
			
		||||
 | 
			
		||||
#define max(a,b) \
 | 
			
		||||
	({ __typeof__ (a) _a = (a); \
 | 
			
		||||
		__typeof__ (b) _b = (b); \
 | 
			
		||||
		_a > _b ? _a : _b; })
 | 
			
		||||
 | 
			
		||||
#define min(a,b) \
 | 
			
		||||
	({ __typeof__ (a) _a = (a); \
 | 
			
		||||
		__typeof__ (b) _b = (b); \
 | 
			
		||||
		_a < _b ? _a : _b; })
 | 
			
		||||
 | 
			
		||||
enum input_mode {
 | 
			
		||||
	LAB_INPUT_STATE_PASSTHROUGH = 0,
 | 
			
		||||
	LAB_INPUT_STATE_MOVE,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -168,6 +168,7 @@ handle_set_app_id(struct wl_listener *listener, void *data)
 | 
			
		|||
	view_update_app_id(view);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define MAX(a, b)  (((a) > (b)) ? (a) : (b))
 | 
			
		||||
static void
 | 
			
		||||
xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -178,8 +179,8 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
 | 
			
		|||
	view->pending_move_resize.update_y = geo.y != view->y;
 | 
			
		||||
	view->pending_move_resize.x = geo.x;
 | 
			
		||||
	view->pending_move_resize.y = geo.y;
 | 
			
		||||
	view->pending_move_resize.width = max(geo.width, min_width);
 | 
			
		||||
	view->pending_move_resize.height = max(geo.height, min_height);
 | 
			
		||||
	view->pending_move_resize.width = MAX(geo.width, min_width);
 | 
			
		||||
	view->pending_move_resize.height = MAX(geo.height, min_height);
 | 
			
		||||
 | 
			
		||||
	uint32_t serial = wlr_xdg_toplevel_set_size(view->xdg_surface,
 | 
			
		||||
		(uint32_t)geo.width, (uint32_t)geo.height);
 | 
			
		||||
| 
						 | 
				
			
			@ -192,6 +193,7 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
 | 
			
		|||
		damage_all_outputs(view->server);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
#undef MAX
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
xdg_toplevel_view_move(struct view *view, double x, double y)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -93,6 +93,7 @@ handle_destroy(struct wl_listener *listener, void *data)
 | 
			
		|||
	free(view);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define MAX(a, b)  (((a) > (b)) ? (a) : (b))
 | 
			
		||||
static void
 | 
			
		||||
handle_request_configure(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -103,10 +104,11 @@ handle_request_configure(struct wl_listener *listener, void *data)
 | 
			
		|||
	view_min_size(view, &min_width, &min_height);
 | 
			
		||||
 | 
			
		||||
	wlr_xwayland_surface_configure(view->xwayland_surface,
 | 
			
		||||
		event->x, event->y, max(event->width, min_width),
 | 
			
		||||
		max(event->height, min_height));
 | 
			
		||||
		event->x, event->y, MAX(event->width, min_width),
 | 
			
		||||
		MAX(event->height, min_height));
 | 
			
		||||
	damage_all_outputs(view->server);
 | 
			
		||||
}
 | 
			
		||||
#undef MAX
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
handle_request_maximize(struct wl_listener *listener, void *data)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue