mirror of
				https://github.com/DreamMaoMao/maomaowm.git
				synced 2025-11-03 09:01:47 -05:00 
			
		
		
		
	opt: optimize code struct
This commit is contained in:
		
							parent
							
								
									f2eb995d56
								
							
						
					
					
						commit
						c11476ef12
					
				
					 1 changed files with 28 additions and 31 deletions
				
			
		
							
								
								
									
										59
									
								
								src/mango.c
									
										
									
									
									
								
							
							
						
						
									
										59
									
								
								src/mango.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1263,43 +1263,34 @@ void applyrules(Client *c) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void set_tagin_animation(Monitor *m, Client *c) {
 | 
			
		||||
	c->animation.tagining = true;
 | 
			
		||||
	if (c->animation.running) {
 | 
			
		||||
		c->animainit_geom.x = c->animation.current.x;
 | 
			
		||||
		c->animainit_geom.y = c->animation.current.y;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (m->pertag->curtag > m->pertag->prevtag) {
 | 
			
		||||
		if (c->animation.running) {
 | 
			
		||||
			c->animainit_geom.x = c->animation.current.x;
 | 
			
		||||
			c->animainit_geom.y = c->animation.current.y;
 | 
			
		||||
		} else {
 | 
			
		||||
			c->animainit_geom.x = tag_animation_direction == VERTICAL
 | 
			
		||||
									  ? c->animation.current.x
 | 
			
		||||
									  : c->mon->m.x + c->mon->m.width;
 | 
			
		||||
			c->animainit_geom.y = tag_animation_direction == VERTICAL
 | 
			
		||||
									  ? c->mon->m.y + c->mon->m.height
 | 
			
		||||
									  : c->animation.current.y;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		c->animainit_geom.x = tag_animation_direction == VERTICAL
 | 
			
		||||
								  ? c->animation.current.x
 | 
			
		||||
								  : c->mon->m.x + c->mon->m.width;
 | 
			
		||||
		c->animainit_geom.y = tag_animation_direction == VERTICAL
 | 
			
		||||
								  ? c->mon->m.y + c->mon->m.height
 | 
			
		||||
								  : c->animation.current.y;
 | 
			
		||||
 | 
			
		||||
	} else {
 | 
			
		||||
		if (c->animation.running) {
 | 
			
		||||
			c->animainit_geom.x = c->animation.current.x;
 | 
			
		||||
			c->animainit_geom.y = c->animation.current.y;
 | 
			
		||||
		} else {
 | 
			
		||||
			c->animainit_geom.x = tag_animation_direction == VERTICAL
 | 
			
		||||
									  ? c->animation.current.x
 | 
			
		||||
									  : m->m.x - c->geom.width;
 | 
			
		||||
			c->animainit_geom.y = tag_animation_direction == VERTICAL
 | 
			
		||||
									  ? m->m.y - c->geom.height
 | 
			
		||||
									  : c->animation.current.y;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		c->animainit_geom.x = tag_animation_direction == VERTICAL
 | 
			
		||||
								  ? c->animation.current.x
 | 
			
		||||
								  : m->m.x - c->geom.width;
 | 
			
		||||
		c->animainit_geom.y = tag_animation_direction == VERTICAL
 | 
			
		||||
								  ? m->m.y - c->geom.height
 | 
			
		||||
								  : c->animation.current.y;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void set_arrange_visible(Monitor *m, Client *c, bool want_animation) {
 | 
			
		||||
 | 
			
		||||
	m->visible_clients++;
 | 
			
		||||
 | 
			
		||||
	if (ISTILED(c)) {
 | 
			
		||||
		m->visible_tiling_clients++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!c->is_clip_to_hide || !ISTILED(c) || !is_scroller_layout(c->mon)) {
 | 
			
		||||
		c->is_clip_to_hide = false;
 | 
			
		||||
		wlr_scene_node_set_enabled(&c->scene->node, true);
 | 
			
		||||
| 
						 | 
				
			
			@ -1309,6 +1300,7 @@ void set_arrange_visible(Monitor *m, Client *c, bool want_animation) {
 | 
			
		|||
 | 
			
		||||
	if (!c->animation.tag_from_rule && want_animation &&
 | 
			
		||||
		m->pertag->prevtag != 0 && m->pertag->curtag != 0 && animations) {
 | 
			
		||||
		c->animation.tagining = true;
 | 
			
		||||
		set_tagin_animation(m, c);
 | 
			
		||||
	} else {
 | 
			
		||||
		c->animainit_geom.x = c->animation.current.x;
 | 
			
		||||
| 
						 | 
				
			
			@ -1322,8 +1314,6 @@ void set_arrange_visible(Monitor *m, Client *c, bool want_animation) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void set_tagout_animation(Monitor *m, Client *c) {
 | 
			
		||||
	c->animation.tagouting = true;
 | 
			
		||||
	c->animation.tagining = false;
 | 
			
		||||
	if (m->pertag->curtag > m->pertag->prevtag) {
 | 
			
		||||
		c->pending = c->geom;
 | 
			
		||||
		c->pending.x = tag_animation_direction == VERTICAL
 | 
			
		||||
| 
						 | 
				
			
			@ -1349,6 +1339,8 @@ void set_tagout_animation(Monitor *m, Client *c) {
 | 
			
		|||
void set_arrange_hidden(Monitor *m, Client *c, bool want_animation) {
 | 
			
		||||
	if ((c->tags & (1 << (m->pertag->prevtag - 1))) &&
 | 
			
		||||
		m->pertag->prevtag != 0 && m->pertag->curtag != 0 && animations) {
 | 
			
		||||
		c->animation.tagouting = true;
 | 
			
		||||
		c->animation.tagining = false;
 | 
			
		||||
		set_tagout_animation(m, c);
 | 
			
		||||
	} else {
 | 
			
		||||
		wlr_scene_node_set_enabled(&c->scene->node, false);
 | 
			
		||||
| 
						 | 
				
			
			@ -1380,6 +1372,11 @@ arrange(Monitor *m, bool want_animation) {
 | 
			
		|||
 | 
			
		||||
		if (c->mon == m) {
 | 
			
		||||
			if (VISIBLEON(c, m)) {
 | 
			
		||||
 | 
			
		||||
				m->visible_clients++;
 | 
			
		||||
				if (ISTILED(c))
 | 
			
		||||
					m->visible_tiling_clients++;
 | 
			
		||||
 | 
			
		||||
				set_arrange_visible(m, c, want_animation);
 | 
			
		||||
			} else {
 | 
			
		||||
				set_arrange_hidden(m, c, want_animation);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue