mirror of
				https://github.com/DreamMaoMao/maomaowm.git
				synced 2025-11-03 09:01:47 -05:00 
			
		
		
		
	feat: The floating Windows do not overlap
This commit is contained in:
		
							parent
							
								
									8799f383ce
								
							
						
					
					
						commit
						0dfc1270df
					
				
					 1 changed files with 24 additions and 0 deletions
				
			
		
							
								
								
									
										24
									
								
								src/mango.c
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								src/mango.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -705,6 +705,7 @@ static bool check_trackpad_disabled(struct wlr_pointer *pointer);
 | 
			
		|||
static unsigned int get_tag_status(unsigned int tag, Monitor *m);
 | 
			
		||||
static void enable_adaptive_sync(Monitor *m, struct wlr_output_state *state);
 | 
			
		||||
static Client *get_next_stack_client(Client *c, bool reverse);
 | 
			
		||||
static void set_float_malposition(Client *tc);
 | 
			
		||||
 | 
			
		||||
#include "data/static_keymap.h"
 | 
			
		||||
#include "dispatch/bind_declare.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -1188,6 +1189,25 @@ int applyrulesgeom(Client *c) {
 | 
			
		|||
	return hit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void set_float_malposition(Client *tc) {
 | 
			
		||||
	Client *c = NULL;
 | 
			
		||||
	int x, y, offset;
 | 
			
		||||
	x = tc->geom.x;
 | 
			
		||||
	y = tc->geom.y;
 | 
			
		||||
	offset = MIN(tc->mon->m.width / 20, tc->mon->m.height / 20);
 | 
			
		||||
 | 
			
		||||
	wl_list_for_each(c, &clients, link) {
 | 
			
		||||
		if (c->isfloating && c != tc && VISIBLEON(c, tc->mon) &&
 | 
			
		||||
			x - c->geom.x < offset && y - c->geom.y < offset) {
 | 
			
		||||
			x = c->geom.x + offset;
 | 
			
		||||
			y = c->geom.y + offset;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tc->float_geom.x = tc->geom.x = x;
 | 
			
		||||
	tc->float_geom.y = tc->geom.y = y;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void applyrules(Client *c) {
 | 
			
		||||
	/* rule matching */
 | 
			
		||||
	const char *appid, *title;
 | 
			
		||||
| 
						 | 
				
			
			@ -1307,6 +1327,10 @@ void applyrules(Client *c) {
 | 
			
		|||
		arrange(c->mon, false);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (c->isfloating && !hit_rule_pos) {
 | 
			
		||||
		set_float_malposition(c);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// apply named scratchpad rule
 | 
			
		||||
	if (c->isnamedscratchpad) {
 | 
			
		||||
		apply_named_scratchpad(c);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue