mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Reload buttons in SIGHUP
Call xbm_load() from theme_init()
This commit is contained in:
		
							parent
							
								
									2514fb0b99
								
							
						
					
					
						commit
						9af7bd744f
					
				
					 4 changed files with 15 additions and 7 deletions
				
			
		| 
						 | 
					@ -43,11 +43,11 @@ extern struct theme theme;
 | 
				
			||||||
void parse_hexstr(const char *hex, float *rgba);
 | 
					void parse_hexstr(const char *hex, float *rgba);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * theme_read - read theme into global theme struct
 | 
					 * theme_init - read theme incl. buttons into global theme struct
 | 
				
			||||||
 * @theme_name: theme-name in <theme-dir>/<theme-name>/openbox-3/themerc
 | 
					 * @theme_name: theme-name in <theme-dir>/<theme-name>/openbox-3/themerc
 | 
				
			||||||
 * Note <theme-dir> is obtained in theme-dir.c
 | 
					 * Note <theme-dir> is obtained in theme-dir.c
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
void theme_read(const char *theme_name);
 | 
					void theme_init(struct wlr_renderer *renderer, const char *theme_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * theme_builin - apply built-in theme similar to Clearlooks
 | 
					 * theme_builin - apply built-in theme similar to Clearlooks
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,8 +76,7 @@ main(int argc, char *argv[])
 | 
				
			||||||
	server_init(&server);
 | 
						server_init(&server);
 | 
				
			||||||
	server_start(&server);
 | 
						server_start(&server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	theme_read(rc.theme_name);
 | 
						theme_init(server.renderer, rc.theme_name);
 | 
				
			||||||
	xbm_load(server.renderer);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct menu rootmenu = { 0 };
 | 
						struct menu rootmenu = { 0 };
 | 
				
			||||||
	menu_init_rootmenu(&server, &rootmenu);
 | 
						menu_init_rootmenu(&server, &rootmenu);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@
 | 
				
			||||||
#include "config/rcxml.h"
 | 
					#include "config/rcxml.h"
 | 
				
			||||||
#include "labwc.h"
 | 
					#include "labwc.h"
 | 
				
			||||||
#include "layers.h"
 | 
					#include "layers.h"
 | 
				
			||||||
 | 
					#include "menu/menu.h"
 | 
				
			||||||
#include "theme/theme.h"
 | 
					#include "theme/theme.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct wlr_compositor *compositor;
 | 
					static struct wlr_compositor *compositor;
 | 
				
			||||||
| 
						 | 
					@ -23,10 +24,10 @@ static struct server *g_server;
 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
reload_config_and_theme(void)
 | 
					reload_config_and_theme(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	rcxml_finish();
 | 
					 | 
				
			||||||
	/* TODO: use rc.config_path */
 | 
						/* TODO: use rc.config_path */
 | 
				
			||||||
 | 
						rcxml_finish();
 | 
				
			||||||
	rcxml_read(NULL);
 | 
						rcxml_read(NULL);
 | 
				
			||||||
	theme_read(rc.theme_name);
 | 
						theme_init(g_server->renderer, rc.theme_name);
 | 
				
			||||||
	menu_reconfigure(g_server, g_server->rootmenu);
 | 
						menu_reconfigure(g_server, g_server->rootmenu);
 | 
				
			||||||
	damage_all_outputs(g_server);
 | 
						damage_all_outputs(g_server);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,6 +10,7 @@
 | 
				
			||||||
#include "common/log.h"
 | 
					#include "common/log.h"
 | 
				
			||||||
#include "common/string-helpers.h"
 | 
					#include "common/string-helpers.h"
 | 
				
			||||||
#include "theme/theme.h"
 | 
					#include "theme/theme.h"
 | 
				
			||||||
 | 
					#include "xbm/xbm.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
hex_to_dec(char c)
 | 
					hex_to_dec(char c)
 | 
				
			||||||
| 
						 | 
					@ -97,7 +98,7 @@ process_line(char *line)
 | 
				
			||||||
	entry(key, value);
 | 
						entry(key, value);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					static void
 | 
				
			||||||
theme_read(const char *theme_name)
 | 
					theme_read(const char *theme_name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	FILE *stream = NULL;
 | 
						FILE *stream = NULL;
 | 
				
			||||||
| 
						 | 
					@ -126,3 +127,10 @@ theme_read(const char *theme_name)
 | 
				
			||||||
	free(line);
 | 
						free(line);
 | 
				
			||||||
	fclose(stream);
 | 
						fclose(stream);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					theme_init(struct wlr_renderer *renderer, const char *theme_name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						theme_read(theme_name);
 | 
				
			||||||
 | 
						xbm_load(renderer);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue