diff options
author | Dave Davenport <qball@gmpclient.org> | 2023-02-11 01:01:19 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2023-02-11 01:01:19 +0100 |
commit | 3c8a0249c7b6ad8f8a9fe36bba6edc44ca16b6e8 (patch) | |
tree | eb7b2c405117a190025ad014269cbcc40427bdfd | |
parent | 9080ec820e692c718824464e206e1f8ec2752a51 (diff) |
[Theme] Rename % to modulo to fix compiler.
-rw-r--r-- | doc/rofi-theme.5 | 25 | ||||
-rw-r--r-- | doc/rofi-theme.5.markdown | 20 | ||||
-rw-r--r-- | lexer/theme-lexer.l | 2 | ||||
-rw-r--r-- | lexer/theme-parser.y | 6 | ||||
-rw-r--r-- | test/theme-parser-test.c | 2 |
5 files changed, 29 insertions, 26 deletions
diff --git a/doc/rofi-theme.5 b/doc/rofi-theme.5 index a5887a46..9b488cbf 100644 --- a/doc/rofi-theme.5 +++ b/doc/rofi-theme.5 @@ -910,25 +910,25 @@ It supports the following operations: .RS .IP \(bu 2 -\fB\fC+\fR : Add +\fB\fC+\fR : Add .IP \(bu 2 -\fB\fC-\fR : Subtract +\fB\fC-\fR : Subtract .IP \(bu 2 -\fB\fC/\fR : Divide +\fB\fC/\fR : Divide .IP \(bu 2 -\fB\fC*\fR : Multiply +\fB\fC*\fR : Multiply .IP \(bu 2 -\fB\fC%\fR : Modulo +\fB\fCmodulo\fR : Modulo .IP \(bu 2 -\fB\fCmin\fR : Minimum of lvalue or rvalue; +\fB\fCmin\fR : Minimum of lvalue or rvalue; .IP \(bu 2 -\fB\fCmax\fR : Maximum of lvalue or rvalue; +\fB\fCmax\fR : Maximum of lvalue or rvalue; .IP \(bu 2 -\fB\fCfloor\fR : Round down lvalue to the next multiple of rvalue +\fB\fCfloor\fR : Round down lvalue to the next multiple of rvalue .IP \(bu 2 -\fB\fCceil\fR : Round up lvalue to the next multiple of rvalue +\fB\fCceil\fR : Round up lvalue to the next multiple of rvalue .IP \(bu 2 -\fB\fCround\fR : Round lvalue to the next multiple of rvalue +\fB\fCround\fR : Round lvalue to the next multiple of rvalue .RE @@ -1615,7 +1615,7 @@ property. These cannot be changed using the \fB\fCchildren\fR property. .PP -Each entries displayed by listview are captured by a \fB\fCbox\fR called \fB\fCelement\fR\&. +Each Entry displayed by listview is captured by a \fB\fCbox\fR called \fB\fCelement\fR\&. An \fB\fCelement\fR widget can contain the following special child widgets: .RS @@ -1630,7 +1630,8 @@ An \fB\fCelement\fR widget can contain the following special child widgets: .PP By default the \fB\fCelement-icon\fR and \fB\fCelement-text\fR child widgets are added to the -\fB\fCelement\fR\&. This can be modified using the \fB\fCchildren\fR property. +\fB\fCelement\fR\&. This can be modified using the \fB\fCchildren\fR property or the +\fB\fC[no]-show-icons\fR option. .PP A child added with another name is seen as a \fB\fCbox\fR, this can be used as dynamic diff --git a/doc/rofi-theme.5.markdown b/doc/rofi-theme.5.markdown index e65c7114..de288738 100644 --- a/doc/rofi-theme.5.markdown +++ b/doc/rofi-theme.5.markdown @@ -573,16 +573,16 @@ width: calc( 20% min 512 ); It supports the following operations: -* `+` : Add -* `-` : Subtract -* `/` : Divide -* `*` : Multiply -* `%` : Modulo -* `min` : Minimum of lvalue or rvalue; -* `max` : Maximum of lvalue or rvalue; -* `floor` : Round down lvalue to the next multiple of rvalue -* `ceil` : Round up lvalue to the next multiple of rvalue -* `round` : Round lvalue to the next multiple of rvalue +* `+` : Add +* `-` : Subtract +* `/` : Divide +* `*` : Multiply +* `modulo` : Modulo +* `min` : Minimum of lvalue or rvalue; +* `max` : Maximum of lvalue or rvalue; +* `floor` : Round down lvalue to the next multiple of rvalue +* `ceil` : Round up lvalue to the next multiple of rvalue +* `round` : Round lvalue to the next multiple of rvalue It uses the C precedence ordering. diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index bf704546..a7174226 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -205,6 +205,7 @@ MODIFIER_MAX (max) MODIFIER_ROUND (round) MODIFIER_FLOOR (floor) MODIFIER_CEIL (ceil) +MODIFIER_MODULO (modulo) /* Position */ CENTER (?i:center) @@ -545,6 +546,7 @@ if ( queue == NULL ) { <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>{MODIFIER_MODULO} { return T_MODIFIER_MODULO; } <PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{CALC} { return T_CALC; } <PROPERTIES,PROPERTIES_ENV,PROPERTIES_ARRAY,PROPERTIES_VAR_DEFAULT>{ENV} { diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index dd317ea9..6a4f6012 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -238,6 +238,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b ) %token T_MODIFIER_ADD "Add ('+')" %token T_MODIFIER_MULTIPLY "Multiply ('*')" +%token T_MODIFIER_MODULO "Modulo ('modulo')" %token T_MODIFIER_MAX "Max ('max')" %token T_MODIFIER_MIN "Min ('min')" @@ -817,7 +818,7 @@ t_property_distance_unit_math $$->right = $3; $$->modtype = ROFI_DISTANCE_MODIFIER_DIVIDE; } -| t_property_distance_unit_math T_PERCENT t_property_distance_unit { +| t_property_distance_unit_math T_MODIFIER_MODULO t_property_distance_unit { $$ = g_slice_new0(RofiDistanceUnit); $$->left = $1; $$->right = $3; @@ -904,8 +905,7 @@ t_property_distance t_property_number : T_INT { $$ = (double) $1; } | T_DOUBLE { $$ = $1; } -| T_MIN T_INT { $$ = -(double)$2; } -| T_MIN T_DOUBLE { $$ = -$2; } +| T_MIN t_property_number { $$ = -(double)$2; } /** distance unit. px, em, % */ t_property_unit diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index c413258f..9aa3c4c7 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -1456,7 +1456,7 @@ START_TEST(test_prepare_math_modulo) { widget wid; wid.name = "window"; wid.state = ""; - rofi_theme_parse_string("window { width: calc( 255 % 4 % 3 % );}"); + rofi_theme_parse_string("window { width: calc( 255 modulo 4 modulo 5 );}"); ck_assert_ptr_nonnull(rofi_theme); // ck_assert_ptr_null ( rofi_theme->widgets ); ck_assert_ptr_null(rofi_theme->properties); |