diff options
-rw-r--r-- | include/widgets/widget-internal.h | 3 | ||||
-rw-r--r-- | source/widgets/widget.c | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/include/widgets/widget-internal.h b/include/widgets/widget-internal.h index 01813e86..d1aeae1c 100644 --- a/include/widgets/widget-internal.h +++ b/include/widgets/widget-internal.h @@ -16,6 +16,9 @@ struct _widget /** Height of the widget */ short h; /** Padding */ + Padding def_margin; + Padding def_padding; + Padding def_border; Padding margin; Padding padding; Padding border; diff --git a/source/widgets/widget.c b/source/widgets/widget.c index 32d1fe6f..c8e23acb 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -9,13 +9,13 @@ void widget_init ( widget *widget, const char *name ) { widget->name = g_strdup ( name ); - widget->padding = (Padding){ { WIDGET_DEFAULT_PADDING, PW_PX, SOLID }, { WIDGET_DEFAULT_PADDING, PW_PX, SOLID }, { WIDGET_DEFAULT_PADDING, PW_PX, SOLID }, { WIDGET_DEFAULT_PADDING, PW_PX, SOLID } }; - widget->border = (Padding){ { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID } }; - widget->margin = (Padding){ { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID } }; + widget->def_padding = (Padding){ { WIDGET_DEFAULT_PADDING, PW_PX, SOLID }, { WIDGET_DEFAULT_PADDING, PW_PX, SOLID }, { WIDGET_DEFAULT_PADDING, PW_PX, SOLID }, { WIDGET_DEFAULT_PADDING, PW_PX, SOLID } }; + widget->def_border = (Padding){ { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID } }; + widget->def_margin = (Padding){ { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID }, { 0, PW_PX, SOLID } }; - widget->padding = rofi_theme_get_padding ( widget, "padding", widget->padding ); - widget->border = rofi_theme_get_padding ( widget, "border", widget->border ); - widget->margin = rofi_theme_get_padding ( widget, "margin", widget->margin ); + widget->padding = rofi_theme_get_padding ( widget, "padding", widget->def_padding ); + widget->border = rofi_theme_get_padding ( widget, "border", widget->def_border ); + widget->margin = rofi_theme_get_padding ( widget, "margin", widget->def_margin ); } void widget_set_state ( widget *widget, const char *state ) @@ -23,7 +23,7 @@ void widget_set_state ( widget *widget, const char *state ) if ( g_strcmp0 ( widget->state, state ) ) { widget->state = state; // Update border. - widget->border = rofi_theme_get_padding ( widget, "border", widget->border ); + widget->border = rofi_theme_get_padding ( widget, "border", widget->def_border ); widget_queue_redraw ( widget ); } |