mirror of
				https://github.com/DreamMaoMao/maomaowm.git
				synced 2025-11-03 09:01:47 -05:00 
			
		
		
		
	fix: deck and tile layout gap error
This commit is contained in:
		
							parent
							
								
									2e553e3dc5
								
							
						
					
					
						commit
						4b8a3d77c3
					
				
					 2 changed files with 48 additions and 52 deletions
				
			
		| 
						 | 
					@ -245,12 +245,10 @@ void deck(Monitor *m) {
 | 
				
			||||||
	int i, n = 0;
 | 
						int i, n = 0;
 | 
				
			||||||
	Client *c;
 | 
						Client *c;
 | 
				
			||||||
	unsigned int cur_gappih = enablegaps ? m->gappih : 0;
 | 
						unsigned int cur_gappih = enablegaps ? m->gappih : 0;
 | 
				
			||||||
	unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
 | 
					 | 
				
			||||||
	unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
 | 
						unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
 | 
				
			||||||
	unsigned int cur_gappov = enablegaps ? m->gappov : 0;
 | 
						unsigned int cur_gappov = enablegaps ? m->gappov : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
 | 
						cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
 | 
				
			||||||
	cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
 | 
					 | 
				
			||||||
	cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
 | 
						cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
 | 
				
			||||||
	cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
 | 
						cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -273,15 +271,15 @@ void deck(Monitor *m) {
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		if (i < m->nmaster) {
 | 
							if (i < m->nmaster) {
 | 
				
			||||||
			// Master area clients
 | 
								// Master area clients
 | 
				
			||||||
			resize(c,
 | 
								resize(
 | 
				
			||||||
				   (struct wlr_box){
 | 
									c,
 | 
				
			||||||
					   .x = m->w.x + cur_gappoh,
 | 
									(struct wlr_box){.x = m->w.x + cur_gappoh,
 | 
				
			||||||
								 .y = m->w.y + cur_gappov + my,
 | 
													 .y = m->w.y + cur_gappov + my,
 | 
				
			||||||
								 .width = mw,
 | 
													 .width = mw,
 | 
				
			||||||
					   .height = (m->w.height - cur_gappov - my - cur_gappiv) /
 | 
													 .height = (m->w.height - 2 * cur_gappov - my) /
 | 
				
			||||||
										   (MIN(n, m->nmaster) - i)},
 | 
															   (MIN(n, m->nmaster) - i)},
 | 
				
			||||||
				0);
 | 
									0);
 | 
				
			||||||
			my += c->geom.height + cur_gappiv;
 | 
								my += c->geom.height;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			// Stack area clients
 | 
								// Stack area clients
 | 
				
			||||||
			resize(c,
 | 
								resize(c,
 | 
				
			||||||
| 
						 | 
					@ -444,48 +442,48 @@ void tile(Monitor *m) {
 | 
				
			||||||
	if (n == 0)
 | 
						if (n == 0)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	unsigned int cur_gappih = enablegaps ? m->gappih : 0;
 | 
					 | 
				
			||||||
	unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
 | 
						unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
 | 
				
			||||||
	unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
 | 
						unsigned int cur_gappih = enablegaps ? m->gappih : 0;
 | 
				
			||||||
	unsigned int cur_gappov = enablegaps ? m->gappov : 0;
 | 
						unsigned int cur_gappov = enablegaps ? m->gappov : 0;
 | 
				
			||||||
 | 
						unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
 | 
					 | 
				
			||||||
	cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
 | 
						cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
 | 
				
			||||||
	cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
 | 
						cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
 | 
				
			||||||
	cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
 | 
						cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
 | 
				
			||||||
 | 
						cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
 | 
						if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
 | 
				
			||||||
		mw = selmon->pertag->nmasters[selmon->pertag->curtag]
 | 
							mw = selmon->pertag->nmasters[selmon->pertag->curtag]
 | 
				
			||||||
				 ? (m->w.width + cur_gappiv * ie) *
 | 
									 ? (m->w.width + cur_gappih * ie) *
 | 
				
			||||||
					   selmon->pertag->mfacts[selmon->pertag->curtag]
 | 
										   selmon->pertag->mfacts[selmon->pertag->curtag]
 | 
				
			||||||
				 : 0;
 | 
									 : 0;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		mw = m->w.width - 2 * cur_gappov + cur_gappiv * ie;
 | 
							mw = m->w.width - 2 * cur_gappoh + cur_gappih * ie;
 | 
				
			||||||
	i = 0;
 | 
						i = 0;
 | 
				
			||||||
	my = ty = cur_gappoh;
 | 
						my = ty = cur_gappov;
 | 
				
			||||||
	wl_list_for_each(c, &clients, link) {
 | 
						wl_list_for_each(c, &clients, link) {
 | 
				
			||||||
		if (!VISIBLEON(c, m) || !ISTILED(c))
 | 
							if (!VISIBLEON(c, m) || !ISTILED(c))
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
 | 
							if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
 | 
				
			||||||
			r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
 | 
								r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
 | 
				
			||||||
			h = (m->w.height - my - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
 | 
								h = (m->w.height - my - cur_gappov - cur_gappiv * ie * (r - 1)) / r;
 | 
				
			||||||
			resize(c,
 | 
								resize(c,
 | 
				
			||||||
				   (struct wlr_box){.x = m->w.x + cur_gappov,
 | 
									   (struct wlr_box){.x = m->w.x + cur_gappoh,
 | 
				
			||||||
									.y = m->w.y + my,
 | 
														.y = m->w.y + my,
 | 
				
			||||||
									.width = mw - cur_gappiv * ie,
 | 
														.width = mw - cur_gappih * ie,
 | 
				
			||||||
									.height = h},
 | 
														.height = h},
 | 
				
			||||||
				   0);
 | 
									   0);
 | 
				
			||||||
			my += c->geom.height + cur_gappih * ie;
 | 
								my += c->geom.height + cur_gappiv * ie;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			r = n - i;
 | 
								r = n - i;
 | 
				
			||||||
			h = (m->w.height - ty - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
 | 
								h = (m->w.height - ty - cur_gappov - cur_gappiv * ie * (r - 1)) / r;
 | 
				
			||||||
			resize(c,
 | 
								resize(c,
 | 
				
			||||||
				   (struct wlr_box){.x = m->w.x + mw + cur_gappov,
 | 
									   (struct wlr_box){.x = m->w.x + mw + cur_gappoh,
 | 
				
			||||||
									.y = m->w.y + ty,
 | 
														.y = m->w.y + ty,
 | 
				
			||||||
									.width = m->w.width - mw - 2 * cur_gappov,
 | 
														.width = m->w.width - mw - 2 * cur_gappoh,
 | 
				
			||||||
									.height = h},
 | 
														.height = h},
 | 
				
			||||||
				   0);
 | 
									   0);
 | 
				
			||||||
			ty += c->geom.height + cur_gappih * ie;
 | 
								ty += c->geom.height + cur_gappiv * ie;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		i++;
 | 
							i++;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -239,12 +239,10 @@ void vertical_deck(Monitor *m) {
 | 
				
			||||||
	unsigned int mh, mx;
 | 
						unsigned int mh, mx;
 | 
				
			||||||
	int i, n = 0;
 | 
						int i, n = 0;
 | 
				
			||||||
	Client *c;
 | 
						Client *c;
 | 
				
			||||||
	unsigned int cur_gappih = enablegaps ? m->gappih : 0;
 | 
					 | 
				
			||||||
	unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
 | 
						unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
 | 
				
			||||||
	unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
 | 
						unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
 | 
				
			||||||
	unsigned int cur_gappov = enablegaps ? m->gappov : 0;
 | 
						unsigned int cur_gappov = enablegaps ? m->gappov : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
 | 
					 | 
				
			||||||
	cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
 | 
						cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
 | 
				
			||||||
	cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
 | 
						cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
 | 
				
			||||||
	cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
 | 
						cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
 | 
				
			||||||
| 
						 | 
					@ -265,15 +263,15 @@ void vertical_deck(Monitor *m) {
 | 
				
			||||||
		if (!VISIBLEON(c, m) || !ISTILED(c))
 | 
							if (!VISIBLEON(c, m) || !ISTILED(c))
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		if (i < m->nmaster) {
 | 
							if (i < m->nmaster) {
 | 
				
			||||||
			resize(c,
 | 
								resize(
 | 
				
			||||||
				   (struct wlr_box){
 | 
									c,
 | 
				
			||||||
					   .x = m->w.x + cur_gappoh + mx,
 | 
									(struct wlr_box){.x = m->w.x + cur_gappoh + mx,
 | 
				
			||||||
								 .y = m->w.y + cur_gappov,
 | 
													 .y = m->w.y + cur_gappov,
 | 
				
			||||||
					   .width = (m->w.width - cur_gappoh - mx - cur_gappih) /
 | 
													 .width = (m->w.width - 2 * cur_gappoh - mx) /
 | 
				
			||||||
										  (MIN(n, m->nmaster) - i),
 | 
															  (MIN(n, m->nmaster) - i),
 | 
				
			||||||
								 .height = mh},
 | 
													 .height = mh},
 | 
				
			||||||
				0);
 | 
									0);
 | 
				
			||||||
			mx += c->geom.width + cur_gappih;
 | 
								mx += c->geom.width;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			resize(c,
 | 
								resize(c,
 | 
				
			||||||
				   (struct wlr_box){.x = m->w.x + cur_gappoh,
 | 
									   (struct wlr_box){.x = m->w.x + cur_gappoh,
 | 
				
			||||||
| 
						 | 
					@ -429,49 +427,49 @@ void vertical_tile(Monitor *m) {
 | 
				
			||||||
	if (n == 0)
 | 
						if (n == 0)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	unsigned int cur_gappih = enablegaps ? m->gappih : 0;
 | 
					 | 
				
			||||||
	unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
 | 
						unsigned int cur_gappiv = enablegaps ? m->gappiv : 0;
 | 
				
			||||||
	unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
 | 
						unsigned int cur_gappih = enablegaps ? m->gappih : 0;
 | 
				
			||||||
	unsigned int cur_gappov = enablegaps ? m->gappov : 0;
 | 
						unsigned int cur_gappov = enablegaps ? m->gappov : 0;
 | 
				
			||||||
 | 
						unsigned int cur_gappoh = enablegaps ? m->gappoh : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
 | 
					 | 
				
			||||||
	cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
 | 
						cur_gappiv = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappiv;
 | 
				
			||||||
	cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
 | 
						cur_gappih = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappih;
 | 
				
			||||||
	cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
 | 
						cur_gappov = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappov;
 | 
				
			||||||
 | 
						cur_gappoh = smartgaps && m->visible_tiling_clients == 1 ? 0 : cur_gappoh;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
 | 
						if (n > selmon->pertag->nmasters[selmon->pertag->curtag])
 | 
				
			||||||
		mh = selmon->pertag->nmasters[selmon->pertag->curtag]
 | 
							mh = selmon->pertag->nmasters[selmon->pertag->curtag]
 | 
				
			||||||
				 ? (m->w.height + cur_gappih * ie) *
 | 
									 ? (m->w.height + cur_gappiv * ie) *
 | 
				
			||||||
					   selmon->pertag->mfacts[selmon->pertag->curtag]
 | 
										   selmon->pertag->mfacts[selmon->pertag->curtag]
 | 
				
			||||||
				 : 0;
 | 
									 : 0;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		mh = m->w.height - 2 * cur_gappov + cur_gappih * ie;
 | 
							mh = m->w.height - 2 * cur_gappoh + cur_gappiv * ie;
 | 
				
			||||||
	i = 0;
 | 
						i = 0;
 | 
				
			||||||
	mx = tx = cur_gappoh;
 | 
						mx = tx = cur_gappov;
 | 
				
			||||||
	wl_list_for_each(c, &clients, link) {
 | 
						wl_list_for_each(c, &clients, link) {
 | 
				
			||||||
		if (!VISIBLEON(c, m) || !ISTILED(c))
 | 
							if (!VISIBLEON(c, m) || !ISTILED(c))
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
 | 
							if (i < selmon->pertag->nmasters[selmon->pertag->curtag]) {
 | 
				
			||||||
			r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
 | 
								r = MIN(n, selmon->pertag->nmasters[selmon->pertag->curtag]) - i;
 | 
				
			||||||
			w = (m->w.width - mx - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
 | 
								w = (m->w.width - mx - cur_gappov - cur_gappiv * ie * (r - 1)) / r;
 | 
				
			||||||
			resize(c,
 | 
								resize(c,
 | 
				
			||||||
				   (struct wlr_box){.x = m->w.x + mx,
 | 
									   (struct wlr_box){.x = m->w.x + mx,
 | 
				
			||||||
									.y = m->w.y + cur_gappov,
 | 
														.y = m->w.y + cur_gappoh,
 | 
				
			||||||
									.width = w,
 | 
														.width = w,
 | 
				
			||||||
									.height = mh - cur_gappiv * ie},
 | 
														.height = mh - cur_gappih * ie},
 | 
				
			||||||
				   0);
 | 
									   0);
 | 
				
			||||||
			mx += c->geom.width + cur_gappih * ie;
 | 
								mx += c->geom.width + cur_gappiv * ie;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			r = n - i;
 | 
								r = n - i;
 | 
				
			||||||
			w = (m->w.width - tx - cur_gappoh - cur_gappih * ie * (r - 1)) / r;
 | 
								w = (m->w.width - tx - cur_gappov - cur_gappiv * ie * (r - 1)) / r;
 | 
				
			||||||
			resize(
 | 
								resize(
 | 
				
			||||||
				c,
 | 
									c,
 | 
				
			||||||
				(struct wlr_box){.x = m->w.x + tx,
 | 
									(struct wlr_box){.x = m->w.x + tx,
 | 
				
			||||||
								 .y = m->w.y + mh + cur_gappov,
 | 
													 .y = m->w.y + mh + cur_gappoh,
 | 
				
			||||||
								 .width = w,
 | 
													 .width = w,
 | 
				
			||||||
								 .height = m->w.height - mh - 2 * cur_gappov},
 | 
													 .height = m->w.height - mh - 2 * cur_gappoh},
 | 
				
			||||||
				0);
 | 
									0);
 | 
				
			||||||
			tx += c->geom.width + cur_gappih * ie;
 | 
								tx += c->geom.width + cur_gappiv * ie;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		i++;
 | 
							i++;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue