mirror of
				https://github.com/swaywm/sway.git
				synced 2025-10-29 05:40:18 -04:00 
			
		
		
		
	swaybar: render with minimum height, nominally text height
This commit is contained in:
		
							parent
							
								
									6e6476c3d5
								
							
						
					
					
						commit
						1844a5bafb
					
				
					 2 changed files with 10 additions and 7 deletions
				
			
		|  | @ -28,7 +28,6 @@ | ||||||
| 
 | 
 | ||||||
| static void bar_init(struct swaybar *bar) { | static void bar_init(struct swaybar *bar) { | ||||||
| 	bar->config = init_config(); | 	bar->config = init_config(); | ||||||
| 	bar->visible = true; |  | ||||||
| 	wl_list_init(&bar->outputs); | 	wl_list_init(&bar->outputs); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -227,9 +226,6 @@ static void xdg_output_handle_done(void *data, | ||||||
| 
 | 
 | ||||||
| 		output->surface = wl_compositor_create_surface(bar->compositor); | 		output->surface = wl_compositor_create_surface(bar->compositor); | ||||||
| 		assert(output->surface); | 		assert(output->surface); | ||||||
| 		if (bar->visible) { |  | ||||||
| 			add_layer_surface(output); |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -377,10 +373,15 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) { | ||||||
| 	pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); | 	pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); | ||||||
| 	assert(pointer->cursor_surface); | 	assert(pointer->cursor_surface); | ||||||
| 
 | 
 | ||||||
|  | 	bar->visible = true; | ||||||
| 	if (bar->config->workspace_buttons) { | 	if (bar->config->workspace_buttons) { | ||||||
| 		if (ipc_get_workspaces(bar)) { | 		ipc_get_workspaces(bar); | ||||||
| 			set_bar_dirty(bar); | 	} | ||||||
|  | 	if (determine_bar_visibility(bar, false)) { | ||||||
|  | 		wl_list_for_each(output, &bar->outputs, link) { | ||||||
|  | 			add_layer_surface(output); | ||||||
| 		} | 		} | ||||||
|  | 		set_bar_dirty(bar); | ||||||
| 	} | 	} | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -448,7 +448,9 @@ static uint32_t render_to_cairo(cairo_t *cairo, struct swaybar_output *output) { | ||||||
| 	} | 	} | ||||||
| 	cairo_paint(cairo); | 	cairo_paint(cairo); | ||||||
| 
 | 
 | ||||||
| 	uint32_t max_height = 0; | 	int th; | ||||||
|  | 	get_text_size(cairo, config->font, NULL, &th, NULL, output->scale, false, ""); | ||||||
|  | 	uint32_t max_height = (th + WS_VERTICAL_PADDING * 4) / output->scale; | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * Each render_* function takes the actual height of the bar, and returns | 	 * Each render_* function takes the actual height of the bar, and returns | ||||||
| 	 * the ideal height. If the actual height is too short, the render function | 	 * the ideal height. If the actual height is too short, the render function | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ian Fan
						Ian Fan