From 9915857a2ec4d13d83a963252264394fb7ce3f28 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 2 Jun 2017 16:25:47 +0200 Subject: Change Distance struct to RofiDistance. --- source/theme.c | 20 ++++++++++---------- source/view.c | 6 +++--- source/widgets/box.c | 2 +- source/widgets/listview.c | 2 +- source/widgets/textbox.c | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'source') diff --git a/source/theme.c b/source/theme.c index 80ed1c2e..ad586ee7 100644 --- a/source/theme.c +++ b/source/theme.c @@ -64,7 +64,7 @@ const char *PropertyTypeName[] = { "Highlight", }; void yyerror ( YYLTYPE *yylloc, const char *, const char * ); -static gboolean distance_compare ( Distance d, Distance e ) +static gboolean distance_compare ( RofiDistance d, RofiDistance e ) { return d.type == e.type && d.distance == e.distance && d.style == e.style; } @@ -129,7 +129,7 @@ void rofi_theme_free ( ThemeWidget *widget ) /** * print */ -static void rofi_theme_print_distance ( Distance d ) +static void rofi_theme_print_distance ( RofiDistance d ) { if ( d.type == ROFI_PU_PX ) { printf ( "%upx ", (unsigned int) d.distance ); @@ -505,28 +505,28 @@ 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; } -static Distance _rofi_theme_get_distance ( const widget *widget, const char *property, int def , gboolean exact) +static RofiDistance _rofi_theme_get_distance ( const widget *widget, const char *property, int def , gboolean exact) { 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, ROFI_PU_PX, ROFI_HL_SOLID }; + return (RofiDistance){ p->value.i, ROFI_PU_PX, ROFI_HL_SOLID }; } else { return p->value.padding.left; } } g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property ); - return (Distance){ def, ROFI_PU_PX, ROFI_HL_SOLID }; + return (RofiDistance){ def, ROFI_PU_PX, ROFI_HL_SOLID }; } -Distance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def ) +RofiDistance 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 ) +RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def ) { return _rofi_theme_get_distance ( widget, property, def , FALSE); } @@ -597,7 +597,7 @@ Padding rofi_theme_get_padding ( const widget *widget, const char *property, Pad pad = p->value.padding; } else { - Distance d = (Distance){ p->value.i, ROFI_PU_PX, ROFI_HL_SOLID }; + RofiDistance d = (RofiDistance){ p->value.i, ROFI_PU_PX, ROFI_HL_SOLID }; return (Padding){ d, d, d, d }; } } @@ -637,7 +637,7 @@ ThemeHighlight rofi_theme_get_highlight ( widget *widget, const char *property, return th; } -int distance_get_pixel ( Distance d, Orientation ori ) +int distance_get_pixel ( RofiDistance d, Orientation ori ) { if ( d.type == ROFI_PU_EM ) { return d.distance * textbox_get_estimated_char_height (); @@ -657,7 +657,7 @@ int distance_get_pixel ( Distance d, Orientation ori ) return d.distance; } -void distance_get_linestyle ( Distance d, cairo_t *draw ) +void distance_get_linestyle ( RofiDistance d, cairo_t *draw ) { if ( d.style == ROFI_HL_DASH ) { const double dashes[1] = { 4 }; diff --git a/source/view.c b/source/view.c index 9b7595da..b66f327c 100644 --- a/source/view.c +++ b/source/view.c @@ -346,8 +346,8 @@ static void rofi_view_calculate_window_position ( RofiViewState *state ) break; } // Apply offset. - Distance x = rofi_theme_get_distance ( WIDGET ( state->main_window ), "x-offset", config.x_offset ); - Distance y = rofi_theme_get_distance ( WIDGET ( state->main_window ), "y-offset", config.y_offset ); + RofiDistance x = rofi_theme_get_distance ( WIDGET ( state->main_window ), "x-offset", config.x_offset ); + RofiDistance y = rofi_theme_get_distance ( WIDGET ( state->main_window ), "y-offset", config.y_offset ); state->x += distance_get_pixel ( x, ORIENTATION_HORIZONTAL ); state->y += distance_get_pixel ( y, ORIENTATION_VERTICAL ); } @@ -807,7 +807,7 @@ static void rofi_view_calculate_window_width ( RofiViewState *state ) state->width = config.menu_width < 101 ? ( CacheState.mon.w / 100.0f ) * ( float ) config.menu_width : config.menu_width; } // Use theme configured width, if set. - Distance width = rofi_theme_get_distance ( WIDGET ( state->main_window ), "width", state->width ); + RofiDistance width = rofi_theme_get_distance ( WIDGET ( state->main_window ), "width", state->width ); state->width = distance_get_pixel ( width, ORIENTATION_HORIZONTAL ); } diff --git a/source/widgets/box.c b/source/widgets/box.c index 1063625d..3b843e29 100644 --- a/source/widgets/box.c +++ b/source/widgets/box.c @@ -43,7 +43,7 @@ struct _box Orientation type; int max_size; // Padding between elements - Distance spacing; + RofiDistance spacing; GList *children; }; diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 3398429a..ea55a269 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -72,7 +72,7 @@ struct _listview unsigned int req_elements; unsigned int cur_elements; - Distance spacing; + RofiDistance spacing; unsigned int menu_lines; unsigned int max_displayed_lines; unsigned int menu_columns; diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 6c978b12..c867ac15 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -901,7 +901,7 @@ int textbox_get_desired_width ( widget *wid ) if ( wid->expand && tb->flags & TB_AUTOWIDTH ) { return textbox_get_font_width ( tb ) + widget_padding_get_padding_width ( wid ) + offset; } - Distance w = rofi_theme_get_distance ( WIDGET ( tb ), "width", 0 ); + RofiDistance w = rofi_theme_get_distance ( WIDGET ( tb ), "width", 0 ); int wi = distance_get_pixel ( w, ORIENTATION_HORIZONTAL ); if ( wi > 0 ) { -- cgit v1.2.3