1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

What is in a name.

This commit is contained in:
Dave Davenport 2022-01-24 20:33:19 +01:00
parent 28052a452c
commit 4bef336b9c
7 changed files with 84 additions and 81 deletions

View file

@ -32,8 +32,8 @@ typedef enum {
P_HIGHLIGHT,
/** List */
P_LIST,
/** Set */
P_SET,
/** Array */
P_ARRAY,
/** Orientation */
P_ORIENTATION,
/** Cursor */

View file

@ -471,5 +471,6 @@ void rofi_theme_print_parsed_files(int is_term);
* Returns a list of allocated RofiDistance objects that should be
* freed.
*/
GList *rofi_theme_get_set_distance(const widget *widget, const char *property);
GList *rofi_theme_get_array_distance(const widget *widget,
const char *property);
#endif

View file

@ -275,8 +275,8 @@ FORWARD_SLASH \/
LIST_OPEN \[
LIST_CLOSE \]
SET_OPEN \{
SET_CLOSE \}
ARRAY_OPEN \{
ARRAY_CLOSE \}
VAR_START "var"
ENV_START "env"
@ -300,7 +300,7 @@ CONFIGURATION (?i:configuration)
%x PROPERTIES_ENV_VAR
%x PROPERTIES_VAR_DEFAULT
%x PROPERTIES_LIST
%x PROPERTIES_SET
%x PROPERTIES_ARRAY
%x NAMESTR
%x SECTION
%x DEFAULTS
@ -500,17 +500,17 @@ if ( queue == NULL ) {
/* After Namestr/Classstr we want to go to state str, then to { */
<INITIAL,SECTION>{WHITESPACE}+ ; // ignore all whitespace
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,PROPERTIES_LIST,PROPERTIES_SET,PROPERTIES_ENV_VAR,PROPERTIES_VAR,MEDIA_CONTENT>{WHITESPACE}+ ; // ignore all whitespace
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,PROPERTIES_LIST,PROPERTIES_ARRAY,PROPERTIES_ENV_VAR,PROPERTIES_VAR,MEDIA_CONTENT>{WHITESPACE}+ ; // ignore all whitespace
<SECTION>":" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(PROPERTIES); return T_PSEP; }
<PROPERTIES>";" { BEGIN(GPOINTER_TO_INT ( g_queue_pop_head ( queue ))); return T_PCLOSE;}
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>(true|false) { yylval->bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;}
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{PNNUMBER}\.{NUMBER}+ { yylval->fval = g_ascii_strtod(yytext, NULL); return T_DOUBLE;}
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{PNNUMBER} { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;}
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{STRING} { yytext[yyleng-1] = '\0'; yylval->sval = g_strcompress(&yytext[1]); return T_STRING;}
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CHAR} { yytext[yyleng-1] = '\0'; yylval->cval = g_strcompress(&yytext[1])[0]; return T_CHAR;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>(true|false) { yylval->bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{PNNUMBER}\.{NUMBER}+ { yylval->fval = g_ascii_strtod(yytext, NULL); return T_DOUBLE;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{PNNUMBER} { yylval->ival = (int)g_ascii_strtoll(yytext, NULL, 10); return T_INT;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{STRING} { yytext[yyleng-1] = '\0'; yylval->sval = g_strcompress(&yytext[1]); return T_STRING;}
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CHAR} { yytext[yyleng-1] = '\0'; yylval->cval = g_strcompress(&yytext[1])[0]; return T_CHAR;}
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>@{WORD} {
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>@{WORD} {
yylval->sval = g_strdup(yytext+1);
return T_LINK;
}
@ -523,26 +523,26 @@ if ( queue == NULL ) {
return T_BOPEN;
}
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{EM} { return T_UNIT_EM; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{CH} { return T_UNIT_CH; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{PX} { return T_UNIT_PX; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{MM} { return T_UNIT_MM; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{PERCENT} { return T_PERCENT; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{LS_SOLID} { return T_SOLID; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{LS_DASH} { return T_DASH; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{EM} { return T_UNIT_EM; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{CH} { return T_UNIT_CH; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{PX} { return T_UNIT_PX; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT,MEDIA_CONTENT>{MM} { return T_UNIT_MM; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{PERCENT} { return T_PERCENT; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{LS_SOLID} { return T_SOLID; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{LS_DASH} { return T_DASH; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{INHERIT} { return T_INHERIT; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{MODIFIER_ADD} { return T_MODIFIER_ADD; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{MODIFIER_SUBTRACT} { return T_MODIFIER_SUBTRACT; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{MODIFIER_MULTIPLY} { return T_MODIFIER_MULTIPLY; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{MODIFIER_MIN} { return T_MODIFIER_MIN; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{MODIFIER_MAX} { return T_MODIFIER_MAX; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{MODIFIER_ROUND} { return T_MODIFIER_ROUND; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{MODIFIER_FLOOR} { return T_MODIFIER_FLOOR; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{MODIFIER_CEIL} { return T_MODIFIER_CEIL; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{CALC} { return T_CALC; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{INHERIT} { return T_INHERIT; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{MODIFIER_ADD} { return T_MODIFIER_ADD; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{MODIFIER_SUBTRACT} { return T_MODIFIER_SUBTRACT; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{MODIFIER_MULTIPLY} { return T_MODIFIER_MULTIPLY; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{MODIFIER_MIN} { return T_MODIFIER_MIN; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{MODIFIER_MAX} { return T_MODIFIER_MAX; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{MODIFIER_ROUND} { return T_MODIFIER_ROUND; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{MODIFIER_FLOOR} { return T_MODIFIER_FLOOR; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{MODIFIER_CEIL} { return T_MODIFIER_CEIL; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{CALC} { return T_CALC; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_SET,PROPERTIES_VAR_DEFAULT>{ENV} {
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{ENV} {
yytext[yyleng-1] = '\0';
const char *val = g_getenv(yytext+2);
if ( val ) {
@ -674,7 +674,7 @@ if ( queue == NULL ) {
}
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{S_T_PARENT_LEFT} { return T_PARENT_LEFT; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,PROPERTIES_LIST>{COMMA} { return T_COMMA; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,PROPERTIES_LIST>{COMMA} { return T_COMMA; }
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{LIST_OPEN} {
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
BEGIN(PROPERTIES_LIST);
@ -684,46 +684,46 @@ if ( queue == NULL ) {
BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue )));
return T_LIST_CLOSE;
}
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{SET_OPEN} {
<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ARRAY_OPEN} {
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
BEGIN(PROPERTIES_SET);
return T_SET_OPEN;
BEGIN(PROPERTIES_ARRAY);
return T_ARRAY_OPEN;
}
<PROPERTIES_SET>{SET_CLOSE} {
<PROPERTIES_ARRAY>{ARRAY_CLOSE} {
BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue )));
return T_SET_CLOSE;
return T_ARRAY_CLOSE;
}
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{FORWARD_SLASH} { return T_FORWARD_SLASH; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{FORWARD_SLASH} { return T_FORWARD_SLASH; }
/* Position */
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CENTER} { return T_POS_CENTER; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{EAST} { return T_POS_EAST; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{WEST} { return T_POS_WEST; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{SOUTH} { return T_POS_SOUTH; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{NORTH} { return T_POS_NORTH; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CENTER} { return T_POS_CENTER; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{EAST} { return T_POS_EAST; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{WEST} { return T_POS_WEST; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{SOUTH} { return T_POS_SOUTH; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{NORTH} { return T_POS_NORTH; }
/* Highlight style */
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{NONE} { return T_NONE; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{BOLD} { return T_BOLD; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ITALIC} { return T_ITALIC; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{UNDERLINE} { return T_UNDERLINE; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{STRIKETHROUGH} { return T_STRIKETHROUGH; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{SMALLCAPS} { return T_SMALLCAPS; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{NONE} { return T_NONE; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{BOLD} { return T_BOLD; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ITALIC} { return T_ITALIC; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{UNDERLINE} { return T_UNDERLINE; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{STRIKETHROUGH} { return T_STRIKETHROUGH; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{SMALLCAPS} { return T_SMALLCAPS; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ANGLE_DEG} { return T_ANGLE_DEG; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ANGLE_RAD} { return T_ANGLE_RAD; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ANGLE_GRAD} { return T_ANGLE_GRAD; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ANGLE_TURN} { return T_ANGLE_TURN; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ANGLE_DEG} { return T_ANGLE_DEG; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ANGLE_RAD} { return T_ANGLE_RAD; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ANGLE_GRAD} { return T_ANGLE_GRAD; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ANGLE_TURN} { return T_ANGLE_TURN; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ORIENTATION_HORI} { return ORIENTATION_HORI; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ORIENTATION_VERT} { return ORIENTATION_VERT; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ORIENTATION_HORI} { return ORIENTATION_HORI; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ORIENTATION_VERT} { return ORIENTATION_VERT; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CURSOR_DEF} { return CURSOR_DEF; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CURSOR_PTR} { return CURSOR_PTR; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CURSOR_TXT} { return CURSOR_TXT; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CURSOR_DEF} { return CURSOR_DEF; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CURSOR_PTR} { return CURSOR_PTR; }
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CURSOR_TXT} { return CURSOR_TXT; }
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{COLOR_TRANSPARENT} {
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{COLOR_TRANSPARENT} {
return T_COLOR_TRANSPARENT;
}
<PROPERTIES,PROPERTIES_SET,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{COLOR_NAME} {
<PROPERTIES,PROPERTIES_ARRAY,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{COLOR_NAME} {
for ( unsigned int iter = 0; iter < num_CSSColors; iter++) {
if ( strcasecmp(yytext, CSSColors[iter].name )== 0 ) {
yylval->colorval.alpha = 1.0;
@ -844,7 +844,7 @@ if ( queue == NULL ) {
return T_ELEMENT;
}
<PROPERTIES_ENV_VAR,PROPERTIES_VAR,PROPERTIES_SET,PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,PROPERTIES_LIST>. {
<PROPERTIES_ENV_VAR,PROPERTIES_VAR,PROPERTIES_ARRAY,PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT,PROPERTIES_LIST>. {
yytext[yyleng-1] = '\0';
return T_ERROR_PROPERTY;
}

View file

@ -234,8 +234,8 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b )
%token T_LIST_OPEN "List open ('[')"
%token T_LIST_CLOSE "List close (']')"
%token T_SET_OPEN "Set open ('{')"
%token T_SET_CLOSE "Set close ('}')"
%token T_ARRAY_OPEN "Set open ('{')"
%token T_ARRAY_CLOSE "Set close ('}')"
%token T_MODIFIER_ADD "Add ('+')"
%token T_MODIFIER_SUBTRACT "Subtract ('-')"
@ -585,8 +585,8 @@ t_property_element
$$ = rofi_theme_property_create ( P_LIST );
$$->value.list = $2;
}
| T_SET_OPEN t_property_element_set_optional T_SET_CLOSE {
$$ = rofi_theme_property_create ( P_SET );
| T_ARRAY_OPEN t_property_element_set_optional T_ARRAY_CLOSE {
$$ = rofi_theme_property_create ( P_ARRAY );
$$->value.list = $2;
}
| t_property_orientation {

View file

@ -28,8 +28,8 @@ const char *const PropertyTypeName[P_NUM_TYPES] = {
"Highlight",
/** List */
"List",
/** Set */
"Set",
/** Array */
"Array",
/** Orientation */
"Orientation",
/** Cursor */

View file

@ -137,7 +137,7 @@ Property *rofi_theme_property_copy(const Property *p) {
retv->value.list =
g_list_copy_deep(p->value.list, rofi_g_list_strdup, NULL);
break;
case P_SET:
case P_ARRAY:
retv->value.list = g_list_copy_deep(
p->value.list, (GCopyFunc)rofi_theme_property_copy, NULL);
break;
@ -210,7 +210,7 @@ void rofi_theme_property_free(Property *p) {
} else if (p->type == P_LIST) {
g_list_free_full(p->value.list, g_free);
p->value.list = 0;
} else if (p->type == P_SET) {
} else if (p->type == P_ARRAY) {
g_list_free_full(p->value.list, (GDestroyNotify)rofi_theme_property_free);
p->value.list = 0;
} else if (p->type == P_LINK) {
@ -375,7 +375,7 @@ static void int_rofi_theme_print_property(Property *p) {
}
printf(" ]");
break;
case P_SET:
case P_ARRAY:
printf("{ ");
for (GList *iter = p->value.list; iter != NULL; iter = g_list_next(iter)) {
int_rofi_theme_print_property((Property *)iter->data);
@ -1262,28 +1262,30 @@ GList *rofi_theme_get_list(const widget *widget, const char *property,
return rofi_theme_get_list_inside(p, widget, property, defaults);
}
static GList *rofi_theme_get_set_inside(Property *p, const widget *widget,
const char *property,
PropertyType child_type) {
static GList *rofi_theme_get_array_inside(Property *p, const widget *widget,
const char *property,
PropertyType child_type) {
if (p) {
if (p->type == P_INHERIT) {
if (widget->parent) {
ThemeWidget *parent =
rofi_theme_find_widget(widget->parent->name, widget->state, FALSE);
Property *pv = rofi_theme_find_property(parent, P_SET, property, FALSE);
return rofi_theme_get_set_inside(pv, widget->parent, property,
child_type);
Property *pv =
rofi_theme_find_property(parent, P_ARRAY, property, FALSE);
return rofi_theme_get_array_inside(pv, widget->parent, property,
child_type);
}
} else if (p->type == P_SET) {
} else if (p->type == P_ARRAY) {
return p->value.list;
}
}
return NULL;
}
GList *rofi_theme_get_set_distance(const widget *widget, const char *property) {
GList *rofi_theme_get_array_distance(const widget *widget,
const char *property) {
ThemeWidget *wid2 = rofi_theme_find_widget(widget->name, widget->state, TRUE);
Property *p = rofi_theme_find_property(wid2, P_SET, property, TRUE);
GList *list = rofi_theme_get_set_inside(p, widget, property, P_PADDING);
Property *p = rofi_theme_find_property(wid2, P_ARRAY, property, TRUE);
GList *list = rofi_theme_get_array_inside(p, widget, property, P_PADDING);
GList *retv = NULL;
for (GList *iter = g_list_first(list); iter != NULL;
iter = g_list_next(iter)) {

View file

@ -1294,7 +1294,7 @@ START_TEST(test_properties_types_names) {
ck_assert_str_eq(PropertyTypeName[P_POSITION], "Position");
ck_assert_str_eq(PropertyTypeName[P_HIGHLIGHT], "Highlight");
ck_assert_str_eq(PropertyTypeName[P_LIST], "List");
ck_assert_str_eq(PropertyTypeName[P_SET], "Set");
ck_assert_str_eq(PropertyTypeName[P_ARRAY], "Array");
ck_assert_str_eq(PropertyTypeName[P_ORIENTATION], "Orientation");
}
END_TEST