Init: Define layout_list statically
This commit is contained in:
parent
04bef9a4b8
commit
6f1624f43b
60
src/init.c
60
src/init.c
@ -32,6 +32,28 @@
|
||||
|
||||
#include "wmfs.h"
|
||||
|
||||
|
||||
const func_name_list_t layout_list[] =
|
||||
{
|
||||
{"tile", tile },
|
||||
{"tile_right", tile },
|
||||
{"tile_left", tile_left },
|
||||
{"tile_top", tile_top },
|
||||
{"tile_bottom", tile_bottom },
|
||||
{"tile_grid", grid },
|
||||
{"grid", grid },
|
||||
{"mirror_vertical", mirror_vertical },
|
||||
{"tile_mirror_vertical", mirror_vertical },
|
||||
{"mirror_horizontal", mirror_horizontal },
|
||||
{"tile_mirror_horizontal", mirror_horizontal },
|
||||
{"layer", layer },
|
||||
{"max", maxlayout },
|
||||
{"maxlayout", maxlayout },
|
||||
{"freelayout", freelayout },
|
||||
{"free", freelayout },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
/** Init WMFS
|
||||
*/
|
||||
void
|
||||
@ -39,7 +61,6 @@ init(void)
|
||||
{
|
||||
/* First init */
|
||||
ewmh_init_hints();
|
||||
init_layout();
|
||||
init_conf();
|
||||
init_gc();
|
||||
init_font();
|
||||
@ -154,43 +175,6 @@ init_root(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/** Init layout
|
||||
*/
|
||||
void
|
||||
init_layout(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
const func_name_list_t layout_list_tmp[] =
|
||||
{
|
||||
{"tile", tile },
|
||||
{"tile_right", tile },
|
||||
{"tile_left", tile_left },
|
||||
{"tile_top", tile_top },
|
||||
{"tile_bottom", tile_bottom },
|
||||
{"tile_grid", grid },
|
||||
{"grid", grid },
|
||||
{"mirror_vertical", mirror_vertical },
|
||||
{"tile_mirror_vertical", mirror_vertical },
|
||||
{"mirror_horizontal", mirror_horizontal },
|
||||
{"tile_mirror_horizontal", mirror_horizontal },
|
||||
{"layer", layer },
|
||||
{"max", maxlayout },
|
||||
{"maxlayout", maxlayout },
|
||||
{"freelayout", freelayout },
|
||||
{"free", freelayout },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
layout_list = emalloc(LEN(layout_list_tmp), sizeof(func_name_list_t));
|
||||
memset(layout_list, 0, LEN(layout_list_tmp));
|
||||
|
||||
for(i = 0; i < LEN(layout_list_tmp); ++i)
|
||||
layout_list[i] = layout_list_tmp[i];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** Init statustext shell script
|
||||
*/
|
||||
void
|
||||
|
||||
@ -111,7 +111,7 @@ _strdup(const char *str)
|
||||
usage. {{{
|
||||
*/
|
||||
void*
|
||||
name_to_func(char *name, func_name_list_t *l)
|
||||
name_to_func(char *name, const func_name_list_t *l)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -150,7 +150,7 @@ char_to_button(char *name, name_to_uint_t blist[])
|
||||
}
|
||||
|
||||
Layout
|
||||
layout_name_to_struct(Layout lt[], char *name, int n, func_name_list_t llist[])
|
||||
layout_name_to_struct(Layout lt[], char *name, int n, const func_name_list_t llist[])
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
@ -103,7 +103,6 @@ quit(void)
|
||||
IFREE(infobar);
|
||||
IFREE(keys);
|
||||
IFREE(func_list);
|
||||
IFREE(layout_list);
|
||||
IFREE(net_atom);
|
||||
|
||||
/* Clean conf alloced thing */
|
||||
|
||||
@ -249,10 +249,10 @@ long getcolor(char *color);
|
||||
void setwinstate(Window win, long state);
|
||||
char* _strdup(char const *str);
|
||||
/* Conf usage {{{ */
|
||||
void* name_to_func(char *name, func_name_list_t *l);
|
||||
void* name_to_func(char *name, const func_name_list_t *l);
|
||||
ulong char_to_modkey(char *name, key_name_list_t key_l[]);
|
||||
uint char_to_button(char *name, name_to_uint_t blist[]);
|
||||
Layout layout_name_to_struct(Layout lt[], char *name, int n, func_name_list_t llist[]);
|
||||
Layout layout_name_to_struct(Layout lt[], char *name, int n, const func_name_list_t llist[]);
|
||||
char* alias_to_str(char *conf_choice);
|
||||
/* }}} */
|
||||
XRectangle get_mouse_pos(void);
|
||||
@ -312,7 +312,6 @@ void layout_set_client_master(Client *c);
|
||||
/* init.c */
|
||||
void init(void);
|
||||
void init_root(void);
|
||||
void init_layout(void);
|
||||
void init_font(void);
|
||||
void init_gc(void);
|
||||
void init_cursor(void);
|
||||
@ -380,7 +379,7 @@ Client *sel;
|
||||
|
||||
/* Other */
|
||||
func_name_list_t *func_list;
|
||||
func_name_list_t *layout_list;
|
||||
extern const func_name_list_t layout_list[];
|
||||
uint numlockmask;
|
||||
|
||||
#endif /* WMFS_H */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user