diff options
author | Dave Davenport <DaveDavenport@users.noreply.github.com> | 2020-04-24 19:54:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-24 19:54:08 +0200 |
commit | 151547a99ed142168ec4a11e526102994f6736a9 (patch) | |
tree | 523506cae7120bc80c1234c94c1f0a4e1cd66bc6 /include | |
parent | f90ad971d9d334b26280fbf14dda700877f75d67 (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.h | 29 | ||||
-rw-r--r-- | include/theme.h | 1 |
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 |