diff --git a/include/theme.h b/include/theme.h index 8bdeddc1..2ebd187c 100644 --- a/include/theme.h +++ b/include/theme.h @@ -293,6 +293,16 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table ) * @returns The distance value of this property for this widget. */ Distance rofi_theme_get_distance ( const widget *widget, const char *property, int def ); +/** + * @param widget The widget to query + * @param property The property to query. + * @param def The default value. + * + * Obtain the distance of the widget. + * + * @returns The distance value of this property for this widget. + */ +Distance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def ); /** * @param widget The widget to query @@ -354,7 +364,7 @@ const char *rofi_theme_get_string ( const widget *widget, const char *property * @param property The property to query. * @param def The default value. * - * Obtain the padding of the widget. + * Obtain the double of the widget. * * @returns The double value of this property for this widget. */ diff --git a/source/theme.c b/source/theme.c index 601738ea..468e1a8c 100644 --- a/source/theme.c +++ b/source/theme.c @@ -502,11 +502,10 @@ int rofi_theme_get_integer_exact ( const widget *widget, const char *property, i g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property ); return def; } - -Distance rofi_theme_get_distance ( const widget *widget, const char *property, int def ) +static Distance _rofi_theme_get_distance ( const widget *widget, const char *property, int def , gboolean exact) { - ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE ); - Property *p = rofi_theme_find_property ( wid, P_PADDING, property, FALSE ); + ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, exact ); + Property *p = rofi_theme_find_property ( wid, P_PADDING, property, exact ); if ( p ) { if ( p->type == P_INTEGER ) { return (Distance){ p->value.i, PW_PX, SOLID }; @@ -519,6 +518,16 @@ Distance rofi_theme_get_distance ( const widget *widget, const char *property, i return (Distance){ def, PW_PX, SOLID }; } + +Distance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def ) +{ + return _rofi_theme_get_distance ( widget, property, def , TRUE ); +} +Distance rofi_theme_get_distance ( const widget *widget, const char *property, int def ) +{ + return _rofi_theme_get_distance ( widget, property, def , FALSE); +} + int rofi_theme_get_boolean ( const widget *widget, const char *property, int def ) { ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE ); diff --git a/source/view.c b/source/view.c index ae62abc8..6c44c289 100644 --- a/source/view.c +++ b/source/view.c @@ -1667,10 +1667,10 @@ RofiViewState *rofi_view_create ( Mode *sw, listview_set_num_lines ( state->list_view, lines ); listview_set_max_lines ( state->list_view, state->num_lines ); - if ( rofi_theme_get_boolean ( state->main_window, "listview-in-inputbar", FALSE)){ + if ( rofi_theme_get_boolean ( WIDGET ( state->main_window ), "listview-in-inputbar", FALSE)){ box_add ( state->input_bar, WIDGET ( state->list_view ), TRUE, 3 ); - Distance d = rofi_theme_get_distance ( WIDGET ( state->text ) , "width", 150); + Distance d = rofi_theme_get_distance_exact ( WIDGET ( state->text ) , "width", 150); state->text->widget.expand = FALSE; widget_resize ( WIDGET( state->text ), distance_get_pixel ( d, ORIENTATION_HORIZONTAL ), -1); } else {