diff options
-rw-r--r-- | include/theme.h | 20 | ||||
-rw-r--r-- | include/widgets/scrollbar.h | 2 | ||||
-rw-r--r-- | lexer/theme-parser.y | 2 | ||||
-rw-r--r-- | source/theme.c | 20 | ||||
-rw-r--r-- | source/view.c | 6 | ||||
-rw-r--r-- | source/widgets/box.c | 2 | ||||
-rw-r--r-- | source/widgets/listview.c | 2 | ||||
-rw-r--r-- | source/widgets/textbox.c | 2 | ||||
-rw-r--r-- | test/theme-parser-test.c | 18 |
9 files changed, 37 insertions, 37 deletions
diff --git a/include/theme.h b/include/theme.h index 101f7d5d..6fafce73 100644 --- a/include/theme.h +++ b/include/theme.h @@ -85,7 +85,7 @@ typedef struct RofiPixelUnit type; /** Style of the line */ RofiLineStyle style; -} Distance; +} RofiDistance; /** * Type of orientation. @@ -144,10 +144,10 @@ typedef struct */ typedef struct { - Distance top; - Distance right; - Distance bottom; - Distance left; + RofiDistance top; + RofiDistance right; + RofiDistance bottom; + RofiDistance left; } Padding; /** @@ -300,7 +300,7 @@ 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 ); +RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def ); /** * @param widget The widget to query * @param property The property to query. @@ -310,7 +310,7 @@ Distance rofi_theme_get_distance ( const widget *widget, const char *property, i * * @returns The distance value of this property for this widget. */ -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 ); /** * @param widget The widget to query @@ -424,17 +424,17 @@ ThemeHighlight rofi_theme_get_highlight ( widget *widget, const char *property, * @param d The distance handle. * @param ori The orientation. * - * Convert Distance into pixels. + * Convert RofiDistance into pixels. * @returns the number of pixels this distance represents. */ -int distance_get_pixel ( Distance d, Orientation ori ); +int distance_get_pixel ( RofiDistance d, Orientation ori ); /** * @param d The distance handle. * @param draw The cairo drawable. * * Set linestyle. */ -void distance_get_linestyle ( Distance d, cairo_t *draw ); +void distance_get_linestyle ( RofiDistance d, cairo_t *draw ); /** * Low-level functions. diff --git a/include/widgets/scrollbar.h b/include/widgets/scrollbar.h index 7bf97cc1..2806bc3f 100644 --- a/include/widgets/scrollbar.h +++ b/include/widgets/scrollbar.h @@ -46,7 +46,7 @@ typedef struct _scrollbar unsigned int length; unsigned int pos; unsigned int pos_length; - Distance width; + RofiDistance width; } scrollbar; /** diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 4d9dea69..e0d13139 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -144,7 +144,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) GList *list; Property *property; GHashTable *property_list; - Distance distance; + RofiDistance distance; } %token <ival> T_END 0 "end of file" 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 ) { diff --git a/test/theme-parser-test.c b/test/theme-parser-test.c index 7d6f67a7..121f15a5 100644 --- a/test/theme-parser-test.c +++ b/test/theme-parser-test.c @@ -222,7 +222,7 @@ START_TEST ( test_properties_distance_em) wid.state = NULL; rofi_theme_parse_string ( "* { test: 10em;}"); ck_assert_ptr_nonnull ( rofi_theme ); - Distance d = (Distance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "test", pi); ck_assert_int_eq ( p.left.distance , 10 ); @@ -238,7 +238,7 @@ START_TEST ( test_properties_distance_em_linestyle) wid.state = NULL; rofi_theme_parse_string ( "* { sol: 1.3em solid; dash: 1.5em dash;}"); ck_assert_ptr_nonnull ( rofi_theme ); - Distance d = (Distance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "sol", pi); ck_assert_double_eq ( p.left.distance , 1.3 ); @@ -258,7 +258,7 @@ START_TEST ( test_properties_distance_px) wid.state = NULL; rofi_theme_parse_string ( "* { test: 10px;}"); ck_assert_ptr_nonnull ( rofi_theme ); - Distance d = (Distance){ 1, ROFI_PU_EM, ROFI_HL_DASH}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_EM, ROFI_HL_DASH}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "test", pi); ck_assert_double_eq ( p.left.distance , 10.0 ); @@ -273,7 +273,7 @@ START_TEST ( test_properties_distance_px_linestyle) wid.state = NULL; rofi_theme_parse_string ( "* { sol: 10px solid; dash: 14px dash;}"); ck_assert_ptr_nonnull ( rofi_theme ); - Distance d = (Distance){ 1, ROFI_PU_EM, ROFI_HL_DASH}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_EM, ROFI_HL_DASH}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "sol", pi); ck_assert_double_eq ( p.left.distance , 10.0 ); @@ -292,7 +292,7 @@ START_TEST ( test_properties_distance_percent) wid.state = NULL; rofi_theme_parse_string ( "* { test: 10%;}"); ck_assert_ptr_nonnull ( rofi_theme ); - Distance d = (Distance){ 1, ROFI_PU_EM, ROFI_HL_DASH}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_EM, ROFI_HL_DASH}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "test", pi); ck_assert_double_eq ( p.left.distance , 10.0 ); @@ -307,7 +307,7 @@ START_TEST ( test_properties_distance_percent_linestyle) wid.state = NULL; rofi_theme_parse_string ( "* { sol: 10% solid; dash: 10% dash;}"); ck_assert_ptr_nonnull ( rofi_theme ); - Distance d = (Distance){ 1, ROFI_PU_EM, ROFI_HL_DASH}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_EM, ROFI_HL_DASH}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "sol", pi); ck_assert_double_eq ( p.left.distance , 10.0 ); @@ -961,7 +961,7 @@ START_TEST ( test_properties_padding_2 ) wid.name = "blaat"; wid.state = NULL; rofi_theme_parse_string ( "* { test: 10px 20px;}"); - Distance d = (Distance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "test", pi); ck_assert_double_eq ( p.left.distance , 20 ); @@ -981,7 +981,7 @@ START_TEST ( test_properties_padding_3 ) wid.name = "blaat"; wid.state = NULL; rofi_theme_parse_string ( "* { test: 10px 30px 20px;}"); - Distance d = (Distance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "test", pi); ck_assert_double_eq ( p.left.distance , 30 ); @@ -1001,7 +1001,7 @@ START_TEST ( test_properties_padding_4 ) wid.name = "blaat"; wid.state = NULL; rofi_theme_parse_string ( "* { test: 10px 30px 20px 40px;}"); - Distance d = (Distance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; + RofiDistance d = (RofiDistance){ 1, ROFI_PU_PX, ROFI_HL_SOLID}; Padding pi = (Padding){d,d,d,d}; Padding p = rofi_theme_get_padding ( &wid, "test", pi); ck_assert_double_eq ( p.left.distance , 40 ); |