summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2023-02-10 19:33:20 +0100
committerDave Davenport <qball@gmpclient.org>2023-02-10 19:33:20 +0100
commit75a0b89621290c54ec922f9a1dda7d4b009467ff (patch)
tree16a07ca71bb9e5a934b1c7467efb5a6027a1d985
parent8197b9ae870ca2d4d05495926fa1f8366447cccf (diff)
[Theme] Allow float numbers.
-rw-r--r--lexer/theme-parser.y16
-rw-r--r--source/theme.c4
2 files changed, 18 insertions, 2 deletions
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y
index 0911cddc..08ef0199 100644
--- a/lexer/theme-parser.y
+++ b/lexer/theme-parser.y
@@ -779,6 +779,14 @@ t_property_distance_zero
$$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE;
$$.style = $2;
}
+| T_DOUBLE t_property_line_style {
+ $$.base.distance = $1;
+ $$.base.type = ROFI_PU_PX;
+ $$.base.left = NULL;
+ $$.base.right = NULL;
+ $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE;
+ $$.style = $2;
+}
| t_property_distance { $$ = $1;}
;
@@ -800,6 +808,14 @@ t_property_distance_unit
$$->right = NULL;
$$->modtype = ROFI_DISTANCE_MODIFIER_NONE;
}
+| T_DOUBLE {
+ $$ = g_slice_new0(RofiDistanceUnit);
+ $$->distance = (double)$1;
+ $$->type = ROFI_PU_PX;
+ $$->left = NULL;
+ $$->right = NULL;
+ $$->modtype = ROFI_DISTANCE_MODIFIER_NONE;
+}
| T_DOUBLE t_property_unit {
$$ = g_slice_new0(RofiDistanceUnit);
$$->distance = (double)$1;
diff --git a/source/theme.c b/source/theme.c
index 0f14edbf..e81ac35b 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -1336,8 +1336,8 @@ RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget,
}
return rofi_theme_get_highlight_inside(p, widget, property, th);
}
-static int get_pixels(RofiDistanceUnit *unit, RofiOrientation ori) {
- int val = unit->distance;
+static double get_pixels(RofiDistanceUnit *unit, RofiOrientation ori) {
+ double val = unit->distance;
if (unit->type == ROFI_PU_EM) {
val = unit->distance * textbox_get_estimated_char_height();