summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Davenport <DaveDavenport@users.noreply.github.com>2020-04-24 19:54:08 +0200
committerGitHub <noreply@github.com>2020-04-24 19:54:08 +0200
commit151547a99ed142168ec4a11e526102994f6736a9 (patch)
tree523506cae7120bc80c1234c94c1f0a4e1cd66bc6 /include
parentf90ad971d9d334b26280fbf14dda700877f75d67 (diff)
[Themes] add calc() support to distance in theme format. (#1105)
* Initial test to allow math in distances. Support + and - Needs spaces around + and -. * [THEME] Fix printing theme with math in distance. * [Theme] use calc() syntax. * [Theme] Add * and / to calc(). * [Theme] Fix the precedense ordering in parsing. Also avoid making copies. * [Theme] Don't print unneeded (). * [Theme] Add modulo to calc.
Diffstat (limited to 'include')
-rw-r--r--include/rofi-types.h29
-rw-r--r--include/theme.h1
2 files changed, 29 insertions, 1 deletions
diff --git a/include/rofi-types.h b/include/rofi-types.h
index bb294dad..ced7e321 100644
--- a/include/rofi-types.h
+++ b/include/rofi-types.h
@@ -89,12 +89,39 @@ typedef enum
/**
* Structure representing a distance.
*/
-typedef struct
+typedef enum
+{
+ ROFI_DISTANCE_MODIFIER_NONE,
+ ROFI_DISTANCE_MODIFIER_ADD,
+ ROFI_DISTANCE_MODIFIER_SUBTRACT,
+ ROFI_DISTANCE_MODIFIER_DIVIDE,
+ ROFI_DISTANCE_MODIFIER_MULTIPLY,
+ ROFI_DISTANCE_MODIFIER_MODULO,
+ ROFI_DISTANCE_MODIFIER_GROUP,
+} RofiDistanceModifier;
+
+typedef struct RofiDistanceUnit
{
/** Distance */
double distance;
/** Unit type of the distance */
RofiPixelUnit type;
+
+ /** Type */
+ RofiDistanceModifier modtype;
+
+ /** Modifier */
+ struct RofiDistanceUnit *left;
+
+ /** Modifier */
+ struct RofiDistanceUnit *right;
+
+} RofiDistanceUnit;
+
+typedef struct
+{
+ /** Base */
+ RofiDistanceUnit base;
/** Style of the line (optional)*/
RofiLineStyle style;
} RofiDistance;
diff --git a/include/theme.h b/include/theme.h
index 0ed71460..055bea71 100644
--- a/include/theme.h
+++ b/include/theme.h
@@ -387,4 +387,5 @@ void rofi_theme_parse_merge_widgets ( ThemeWidget *parent, ThemeWidget *child );
* Returns the media type described by type.
*/
ThemeMediaType rofi_theme_parse_media_type ( const char *type );
+RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance );
#endif