[util/rules] Move Fuzzy from rules to util
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
70d26b5b36
commit
97dc830db5
|
@ -26,7 +26,6 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_aux.h>
|
||||
|
|
1
client.c
1
client.c
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_aux.h>
|
||||
|
|
2
client.h
2
client.h
|
@ -22,8 +22,6 @@
|
|||
#ifndef AWESOME_CLIENT_H
|
||||
#define AWESOME_CLIENT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <xcb/xcb_icccm.h>
|
||||
|
||||
#include "structs.h"
|
||||
|
|
|
@ -133,6 +133,16 @@ char* a_strndup(const char* src, ssize_t l)
|
|||
return _tmpStr;
|
||||
}
|
||||
|
||||
Fuzzy
|
||||
fuzzy_get_from_str(const char *str)
|
||||
{
|
||||
if(!a_strcmp(str, "true") || !a_strcmp(str, "yes"))
|
||||
return Yes;
|
||||
else if(!a_strcmp(str, "false") || !a_strcmp(str, "no"))
|
||||
return No;
|
||||
return Maybe;
|
||||
}
|
||||
|
||||
/** \brief safe limited strcpy.
|
||||
*
|
||||
* Copies at most min(<tt>n-1</tt>, \c l) characters from \c src into \c dst,
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/** A list of possible position, not sex related */
|
||||
typedef enum
|
||||
|
@ -37,6 +38,14 @@ typedef enum
|
|||
Auto
|
||||
} Position;
|
||||
|
||||
/** Fuzzy logic */
|
||||
typedef enum
|
||||
{
|
||||
No = false,
|
||||
Yes = true,
|
||||
Maybe
|
||||
} Fuzzy;
|
||||
|
||||
/** Link a name to a function */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -252,6 +261,7 @@ void _warn(int, const char *, const char *, ...)
|
|||
__attribute__ ((format(printf, 3, 4)));
|
||||
|
||||
Position position_get_from_str(const char *);
|
||||
Fuzzy fuzzy_get_from_str(const char *);
|
||||
double compute_new_value_from_arg(const char *, double);
|
||||
void *name_func_lookup(const char *, const name_func_link_t *);
|
||||
|
||||
|
|
4
config.c
4
config.c
|
@ -540,9 +540,9 @@ config_parse(const char *confpatharg)
|
|||
rule->xprop = a_strdup(cfg_getstr(cfgsectmp, "xproperty_name"));
|
||||
rule->xpropval_r = rules_compile_regex(cfg_getstr(cfgsectmp, "xproperty_value"));
|
||||
rule->icon = a_strdup(cfg_getstr(cfgsectmp, "icon"));
|
||||
rule->isfloating = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "float"));
|
||||
rule->isfloating = fuzzy_get_from_str(cfg_getstr(cfgsectmp, "float"));
|
||||
rule->screen = cfg_getint(cfgsectmp, "screen");
|
||||
rule->ismaster = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "master"));
|
||||
rule->ismaster = fuzzy_get_from_str(cfg_getstr(cfgsectmp, "master"));
|
||||
rule->opacity = cfg_getfloat(cfgsectmp, "opacity");
|
||||
config_section_titlebar_init(cfg_getsec(cfgsectmp, "titlebar"), &rule->titlebar, 0);
|
||||
if(rule->screen >= globalconf.screens_info->nscreen)
|
||||
|
|
11
rules.c
11
rules.c
|
@ -111,15 +111,4 @@ rule_matching_client(Client *c)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Fuzzy
|
||||
rules_get_fuzzy_from_str(const char *str)
|
||||
{
|
||||
if(!a_strcmp(str, "true") || !a_strcmp(str, "yes"))
|
||||
return Yes;
|
||||
else if(!a_strcmp(str, "false") || !a_strcmp(str, "no"))
|
||||
return No;
|
||||
|
||||
return Maybe;
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
1
rules.h
1
rules.h
|
@ -28,7 +28,6 @@
|
|||
|
||||
regex_t * rules_compile_regex(char *);
|
||||
bool tag_match_rule(Tag *, Rule *);
|
||||
Fuzzy rules_get_fuzzy_from_str(const char *);
|
||||
Rule * rule_matching_client(Client *);
|
||||
|
||||
DO_SLIST(Rule, rule, p_delete)
|
||||
|
|
Loading…
Reference in New Issue