summaryrefslogtreecommitdiffstats
path: root/source/theme.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-09-06 10:03:44 +0200
committerDave Davenport <qball@gmpclient.org>2017-09-06 10:03:44 +0200
commit50998b8f04c6335c43bcc1923aa8f1d6d75db01d (patch)
tree9b38a2faa2af4111fa7178cb10841a68ffd3a173 /source/theme.c
parent9b0a430fd48b390b7a1c14dab3b0e5fe4cd2b63a (diff)
Flatten hierarchy, don't inherit by default.
* add keyword inherit to language parser and theme structure.
Diffstat (limited to 'source/theme.c')
-rw-r--r--source/theme.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/theme.c b/source/theme.c
index 454ead5e..8bcabbc3 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -429,6 +429,9 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con
while ( widget ) {
if ( widget->properties && g_hash_table_contains ( widget->properties, property ) ) {
Property *p = g_hash_table_lookup ( widget->properties, property );
+ if ( p ->type == P_INHERIT ) {
+ return p;
+ }
if ( p->type == P_LINK ) {
if ( p->value.link.ref == NULL ) {
// Resolve link.
@@ -454,14 +457,15 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con
if ( exact ) {
return NULL;
}
- widget = widget->parent;
+ // Fall back to defaults.
+ widget = widget == rofi_theme?NULL:rofi_theme;
}
return NULL;
}
ThemeWidget *rofi_theme_find_widget ( const char *name, const char *state, gboolean exact )
{
// First find exact match based on name.
- ThemeWidget *widget = rofi_theme_find ( rofi_theme, name, exact );
+ ThemeWidget *widget = rofi_theme_find ( rofi_theme, name, FALSE );
widget = rofi_theme_find ( widget, state, exact );
return widget;
@@ -472,6 +476,9 @@ int rofi_theme_get_position ( const widget *widget, const char *property, int de
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE );
Property *p = rofi_theme_find_property ( wid, P_POSITION, property, FALSE );
if ( p ) {
+ if ( p->type == P_INHERIT ) {
+ return rofi_theme_get_position ( widget->parent, property, def );
+ }
return p->value.i;
}
g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );