mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	scene/layer_shell_v1.c: fix bug in width/height calculations
...in wlr_scene_layer_surface_v1_configure() Reproduce bug with waybar by setting `"margin": 5,` in ~/.config/waybar/config. It will result in the right edge of the panel extending outside the edge of the output. The bug can also be reproduced with gtk-layer-demo by anchoring left/right/top/bottom and setting respective margins Relates-to: https://github.com/labwc/labwc/issues/382
This commit is contained in:
		
							parent
							
								
									96b594110d
								
							
						
					
					
						commit
						d57d2e0e36
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -94,7 +94,7 @@ void wlr_scene_layer_surface_v1_configure(
 | 
				
			||||||
	if (box.width == 0) {
 | 
						if (box.width == 0) {
 | 
				
			||||||
		box.x = bounds.x + state->margin.left;
 | 
							box.x = bounds.x + state->margin.left;
 | 
				
			||||||
		box.width = bounds.width -
 | 
							box.width = bounds.width -
 | 
				
			||||||
			state->margin.left + state->margin.right;
 | 
								(state->margin.left + state->margin.right);
 | 
				
			||||||
	} else if (state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT &&
 | 
						} else if (state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT &&
 | 
				
			||||||
			state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT) {
 | 
								state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT) {
 | 
				
			||||||
		box.x = bounds.x + bounds.width/2 -box.width/2;
 | 
							box.x = bounds.x + bounds.width/2 -box.width/2;
 | 
				
			||||||
| 
						 | 
					@ -110,7 +110,7 @@ void wlr_scene_layer_surface_v1_configure(
 | 
				
			||||||
	if (box.height == 0) {
 | 
						if (box.height == 0) {
 | 
				
			||||||
		box.y = bounds.y + state->margin.top;
 | 
							box.y = bounds.y + state->margin.top;
 | 
				
			||||||
		box.height = bounds.height -
 | 
							box.height = bounds.height -
 | 
				
			||||||
			state->margin.top + state->margin.bottom;
 | 
								(state->margin.top + state->margin.bottom);
 | 
				
			||||||
	} else if (state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP &&
 | 
						} else if (state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP &&
 | 
				
			||||||
			state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM) {
 | 
								state->anchor & ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM) {
 | 
				
			||||||
		box.y = bounds.y + bounds.height/2 - box.height/2;
 | 
							box.y = bounds.y + bounds.height/2 - box.height/2;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue