add focus options to the new rc file
This commit is contained in:
parent
cbbf90a718
commit
bd12517c61
4 changed files with 54 additions and 25 deletions
10
Makefile
10
Makefile
|
@ -1,4 +1,12 @@
|
|||
all install uninstall:
|
||||
all uninstall:
|
||||
@$(MAKE) -$(MAKEFLAGS) -f build/Makefile.render $@
|
||||
@$(MAKE) -$(MAKEFLAGS) -f build/Makefile.kernel $@
|
||||
@$(MAKE) -$(MAKEFLAGS) -f build/Makefile.plugins $@
|
||||
@$(MAKE) -$(MAKEFLAGS) -f build/Makefile.engines $@
|
||||
@$(MAKE) -$(MAKEFLAGS) -f build/Makefile.data $@
|
||||
# @$(MAKE) -$(MAKEFLAGS) -f build/Makefile.themes $@
|
||||
|
||||
install: all
|
||||
@$(MAKE) -$(MAKEFLAGS) -f build/Makefile.render $@
|
||||
@$(MAKE) -$(MAKEFLAGS) -f build/Makefile.kernel $@
|
||||
@$(MAKE) -$(MAKEFLAGS) -f build/Makefile.plugins $@
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "prop.h"
|
||||
#include "dispatch.h"
|
||||
#include "focus.h"
|
||||
#include "parse.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <glib.h>
|
||||
|
@ -18,6 +19,25 @@ Window focus_backup = None;
|
|||
gboolean focus_new = TRUE;
|
||||
gboolean focus_follow = TRUE;
|
||||
|
||||
static void parse_assign(char *name, ParseToken *value)
|
||||
{
|
||||
if (!g_ascii_strcasecmp(name, "focusnew")) {
|
||||
if (value->type != TOKEN_BOOL)
|
||||
yyerror("invalid value");
|
||||
else {
|
||||
focus_new = value->data.bool;
|
||||
}
|
||||
} else if (!g_ascii_strcasecmp(name, "followmouse")) {
|
||||
if (value->type != TOKEN_BOOL)
|
||||
yyerror("invalid value");
|
||||
else {
|
||||
focus_follow = value->data.bool;
|
||||
}
|
||||
} else
|
||||
yyerror("invalid option");
|
||||
parse_free_token(value);
|
||||
}
|
||||
|
||||
void focus_startup()
|
||||
{
|
||||
/* create the window which gets focus when no clients get it. Have to
|
||||
|
@ -38,6 +58,8 @@ void focus_startup()
|
|||
|
||||
/* start with nothing focused */
|
||||
focus_set_client(NULL);
|
||||
|
||||
parse_reg_section("focus", NULL, parse_assign);
|
||||
}
|
||||
|
||||
void focus_shutdown()
|
||||
|
|
|
@ -147,22 +147,24 @@ int main(int argc, char **argv)
|
|||
extensions_query_all(); /* find which extensions are present */
|
||||
|
||||
if (screen_annex()) { /* it will be ours! */
|
||||
/* startup the parsing so everything can register sections of the rc */
|
||||
parse_startup();
|
||||
|
||||
/* anything that is going to read data from the rc file needs to be
|
||||
in this group */
|
||||
timer_startup();
|
||||
render_startup();
|
||||
font_startup();
|
||||
event_startup();
|
||||
grab_startup();
|
||||
engine_startup();
|
||||
focus_startup();
|
||||
plugin_startup();
|
||||
|
||||
/* startup the parsing so plugins can register sections of the rc */
|
||||
parse_startup();
|
||||
|
||||
/* load the plugins specified in the pluginrc */
|
||||
plugin_loadall();
|
||||
|
||||
/* parse/load user options */
|
||||
parse_rc();
|
||||
|
||||
/* we're done with parsing now, kill it */
|
||||
parse_shutdown();
|
||||
|
||||
|
@ -170,7 +172,6 @@ int main(int argc, char **argv)
|
|||
engine_load();
|
||||
|
||||
screen_startup();
|
||||
focus_startup();
|
||||
client_startup();
|
||||
|
||||
/* call startup for all the plugins */
|
||||
|
@ -188,8 +189,8 @@ int main(int argc, char **argv)
|
|||
|
||||
plugin_shutdown(); /* calls all the plugins' shutdown functions */
|
||||
client_shutdown();
|
||||
focus_shutdown();
|
||||
screen_shutdown();
|
||||
focus_shutdown();
|
||||
engine_shutdown();
|
||||
grab_shutdown();
|
||||
event_shutdown();
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
static GHashTable *reg = NULL;
|
||||
|
||||
struct Functions {
|
||||
ParseFunc func;
|
||||
AssignParseFunc afunc;
|
||||
ParseFunc f;
|
||||
AssignParseFunc af;
|
||||
} *funcs;
|
||||
|
||||
void destshit(gpointer key) { g_free(key); }
|
||||
void destshit(gpointer shit) { g_free(shit); }
|
||||
|
||||
void parse_startup()
|
||||
{
|
||||
|
@ -22,15 +22,10 @@ void parse_shutdown()
|
|||
|
||||
void parse_reg_section(char *section, ParseFunc func, AssignParseFunc afunc)
|
||||
{
|
||||
if (g_hash_table_lookup(reg, section) != NULL)
|
||||
g_warning("duplicate request for section '%s' in the rc file",
|
||||
section);
|
||||
else {
|
||||
struct Functions *f = g_new(struct Functions, 1);
|
||||
f->func = func;
|
||||
f->afunc = afunc;
|
||||
g_hash_table_insert(reg, g_ascii_strdown(section, -1), f);
|
||||
}
|
||||
struct Functions *f = g_new(struct Functions, 1);
|
||||
f->f = func;
|
||||
f->af = afunc;
|
||||
g_hash_table_insert(reg, g_ascii_strdown(section, -1), f);
|
||||
}
|
||||
|
||||
void parse_free_token(ParseToken *token)
|
||||
|
@ -64,14 +59,17 @@ void parse_free_token(ParseToken *token)
|
|||
|
||||
void parse_set_section(char *section)
|
||||
{
|
||||
funcs = g_hash_table_lookup(reg, section);
|
||||
char *sec;
|
||||
sec = g_ascii_strdown(section, -1);
|
||||
funcs = g_hash_table_lookup(reg, sec);
|
||||
g_free(sec);
|
||||
}
|
||||
|
||||
void parse_token(ParseToken *token)
|
||||
{
|
||||
if (funcs) {
|
||||
if (funcs->func != NULL)
|
||||
funcs->func(token);
|
||||
if (funcs->f)
|
||||
funcs->f(token);
|
||||
else if (token->type != TOKEN_NEWLINE)
|
||||
yyerror("syntax error");
|
||||
}
|
||||
|
@ -80,8 +78,8 @@ void parse_token(ParseToken *token)
|
|||
void parse_assign(char *name, ParseToken *value)
|
||||
{
|
||||
if (funcs) {
|
||||
if (funcs->afunc != NULL)
|
||||
funcs->afunc(name, value);
|
||||
if (funcs->af)
|
||||
funcs->af(name, value);
|
||||
else
|
||||
yyerror("syntax error");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue