mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Change Padding to RofiPadding
This commit is contained in:
parent
ea7d20d150
commit
3e46228074
7 changed files with 47 additions and 47 deletions
|
@ -110,7 +110,7 @@ typedef enum
|
|||
P_BOOLEAN,
|
||||
/** Color */
|
||||
P_COLOR,
|
||||
/** Padding */
|
||||
/** RofiPadding */
|
||||
P_PADDING,
|
||||
/** Link to global setting */
|
||||
P_LINK,
|
||||
|
@ -140,7 +140,7 @@ typedef struct
|
|||
} ThemeColor;
|
||||
|
||||
/**
|
||||
* Padding
|
||||
* RofiPadding
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ typedef struct
|
|||
RofiDistance right;
|
||||
RofiDistance bottom;
|
||||
RofiDistance left;
|
||||
} Padding;
|
||||
} RofiPadding;
|
||||
|
||||
/**
|
||||
* Theme highlight.
|
||||
|
@ -172,8 +172,8 @@ typedef union {
|
|||
gboolean b;
|
||||
/** Color */
|
||||
ThemeColor color;
|
||||
/** Padding */
|
||||
Padding padding;
|
||||
/** RofiPadding */
|
||||
RofiPadding padding;
|
||||
/** Reference */
|
||||
struct
|
||||
{
|
||||
|
@ -407,7 +407,7 @@ void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t
|
|||
*
|
||||
* @returns The padding of this property for this widget.
|
||||
*/
|
||||
Padding rofi_theme_get_padding ( const widget *widget, const char *property, Padding pad );
|
||||
RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property, RofiPadding pad );
|
||||
|
||||
/**
|
||||
* @param widget The widget to query
|
||||
|
|
|
@ -44,15 +44,15 @@ struct _widget
|
|||
short w;
|
||||
/** Height of the widget */
|
||||
short h;
|
||||
/** Padding */
|
||||
Padding def_margin;
|
||||
Padding def_padding;
|
||||
Padding def_border;
|
||||
Padding def_border_radius;
|
||||
Padding margin;
|
||||
Padding padding;
|
||||
Padding border;
|
||||
Padding border_radius;
|
||||
/** RofiPadding */
|
||||
RofiPadding def_margin;
|
||||
RofiPadding def_padding;
|
||||
RofiPadding def_border;
|
||||
RofiPadding def_border_radius;
|
||||
RofiPadding margin;
|
||||
RofiPadding padding;
|
||||
RofiPadding border;
|
||||
RofiPadding border_radius;
|
||||
|
||||
/** enabled or not */
|
||||
gboolean enabled;
|
||||
|
|
|
@ -333,22 +333,22 @@ t_property
|
|||
| t_property_name T_PSEP t_property_distance T_PCLOSE {
|
||||
$$ = rofi_theme_property_create ( P_PADDING );
|
||||
$$->name = $1;
|
||||
$$->value.padding = (Padding){ $3, $3, $3, $3 };
|
||||
$$->value.padding = (RofiPadding){ $3, $3, $3, $3 };
|
||||
}
|
||||
| t_property_name T_PSEP t_property_distance t_property_distance T_PCLOSE {
|
||||
$$ = rofi_theme_property_create ( P_PADDING );
|
||||
$$->name = $1;
|
||||
$$->value.padding = (Padding){ $3, $4, $3, $4 };
|
||||
$$->value.padding = (RofiPadding){ $3, $4, $3, $4 };
|
||||
}
|
||||
| t_property_name T_PSEP t_property_distance t_property_distance t_property_distance T_PCLOSE {
|
||||
$$ = rofi_theme_property_create ( P_PADDING );
|
||||
$$->name = $1;
|
||||
$$->value.padding = (Padding){ $3, $4, $5, $4 };
|
||||
$$->value.padding = (RofiPadding){ $3, $4, $5, $4 };
|
||||
}
|
||||
| t_property_name T_PSEP t_property_distance t_property_distance t_property_distance t_property_distance T_PCLOSE {
|
||||
$$ = rofi_theme_property_create ( P_PADDING );
|
||||
$$->name = $1;
|
||||
$$->value.padding = (Padding){ $3, $4, $5, $6 };
|
||||
$$->value.padding = (RofiPadding){ $3, $4, $5, $6 };
|
||||
}
|
||||
| t_property_name T_PSEP t_property_position T_PCLOSE{
|
||||
$$ = rofi_theme_property_create ( P_POSITION );
|
||||
|
|
|
@ -54,8 +54,8 @@ const char *PropertyTypeName[] = {
|
|||
"Boolean",
|
||||
/** Color */
|
||||
"Color",
|
||||
/** Padding */
|
||||
"Padding",
|
||||
/** RofiPadding */
|
||||
"RofiPadding",
|
||||
/** Link to global setting */
|
||||
"Reference",
|
||||
/** Position */
|
||||
|
@ -447,7 +447,7 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con
|
|||
if ( p->type == type ) {
|
||||
return p;
|
||||
}
|
||||
// Padding and integer can be converted.
|
||||
// RofiPadding and integer can be converted.
|
||||
if ( p->type == P_INTEGER && type == P_PADDING ) {
|
||||
return p;
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t
|
|||
g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );
|
||||
}
|
||||
}
|
||||
Padding rofi_theme_get_padding ( const widget *widget, const char *property, Padding pad )
|
||||
RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property, RofiPadding pad )
|
||||
{
|
||||
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE );
|
||||
Property *p = rofi_theme_find_property ( wid, P_PADDING, property, FALSE );
|
||||
|
@ -598,7 +598,7 @@ Padding rofi_theme_get_padding ( const widget *widget, const char *property, Pad
|
|||
}
|
||||
else {
|
||||
RofiDistance d = (RofiDistance){ p->value.i, ROFI_PU_PX, ROFI_HL_SOLID };
|
||||
return (Padding){ d, d, d, d };
|
||||
return (RofiPadding){ d, d, d, d };
|
||||
}
|
||||
}
|
||||
g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );
|
||||
|
|
|
@ -42,7 +42,7 @@ struct _box
|
|||
widget widget;
|
||||
RofiOrientation type;
|
||||
int max_size;
|
||||
// Padding between elements
|
||||
// RofiPadding between elements
|
||||
RofiDistance spacing;
|
||||
|
||||
GList *children;
|
||||
|
|
|
@ -38,10 +38,10 @@ void widget_init ( widget *widget, WidgetType type, const char *name )
|
|||
{
|
||||
widget->type = type;
|
||||
widget->name = g_strdup ( name );
|
||||
widget->def_padding = (Padding){ { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID } };
|
||||
widget->def_border = (Padding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
|
||||
widget->def_border_radius = (Padding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
|
||||
widget->def_margin = (Padding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
|
||||
widget->def_padding = (RofiPadding){ { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID }, { WIDGET_DEFAULT_PADDING, ROFI_PU_PX, ROFI_HL_SOLID } };
|
||||
widget->def_border = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
|
||||
widget->def_border_radius = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
|
||||
widget->def_margin = (RofiPadding){ { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID }, { 0, ROFI_PU_PX, ROFI_HL_SOLID } };
|
||||
|
||||
widget->padding = rofi_theme_get_padding ( widget, "padding", widget->def_padding );
|
||||
widget->border = rofi_theme_get_padding ( widget, "border", widget->def_border );
|
||||
|
|
|
@ -223,8 +223,8 @@ START_TEST ( test_properties_distance_em)
|
|||
rofi_theme_parse_string ( "* { test: 10em;}");
|
||||
ck_assert_ptr_nonnull ( rofi_theme );
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
|
||||
ck_assert_int_eq ( p.left.distance , 10 );
|
||||
ck_assert_int_eq( p.left.type , ROFI_PU_EM );
|
||||
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
|
||||
|
@ -239,8 +239,8 @@ START_TEST ( test_properties_distance_em_linestyle)
|
|||
rofi_theme_parse_string ( "* { sol: 1.3em solid; dash: 1.5em dash;}");
|
||||
ck_assert_ptr_nonnull ( rofi_theme );
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi);
|
||||
ck_assert_double_eq ( p.left.distance , 1.3 );
|
||||
ck_assert_int_eq( p.left.type , ROFI_PU_EM );
|
||||
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
|
||||
|
@ -259,8 +259,8 @@ START_TEST ( test_properties_distance_px)
|
|||
rofi_theme_parse_string ( "* { test: 10px;}");
|
||||
ck_assert_ptr_nonnull ( rofi_theme );
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
|
||||
ck_assert_double_eq ( p.left.distance , 10.0 );
|
||||
ck_assert_int_eq( p.left.type , ROFI_PU_PX );
|
||||
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
|
||||
|
@ -274,8 +274,8 @@ START_TEST ( test_properties_distance_px_linestyle)
|
|||
rofi_theme_parse_string ( "* { sol: 10px solid; dash: 14px dash;}");
|
||||
ck_assert_ptr_nonnull ( rofi_theme );
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi);
|
||||
ck_assert_double_eq ( p.left.distance , 10.0 );
|
||||
ck_assert_int_eq( p.left.type , ROFI_PU_PX );
|
||||
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
|
||||
|
@ -293,8 +293,8 @@ START_TEST ( test_properties_distance_percent)
|
|||
rofi_theme_parse_string ( "* { test: 10%;}");
|
||||
ck_assert_ptr_nonnull ( rofi_theme );
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
|
||||
ck_assert_double_eq ( p.left.distance , 10.0 );
|
||||
ck_assert_int_eq( p.left.type , ROFI_PU_PERCENT);
|
||||
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
|
||||
|
@ -308,8 +308,8 @@ START_TEST ( test_properties_distance_percent_linestyle)
|
|||
rofi_theme_parse_string ( "* { sol: 10% solid; dash: 10% dash;}");
|
||||
ck_assert_ptr_nonnull ( rofi_theme );
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "sol", pi);
|
||||
ck_assert_double_eq ( p.left.distance , 10.0 );
|
||||
ck_assert_int_eq( p.left.type , ROFI_PU_PERCENT);
|
||||
ck_assert_int_eq( p.left.style, ROFI_HL_SOLID);
|
||||
|
@ -962,8 +962,8 @@ START_TEST ( test_properties_padding_2 )
|
|||
wid.state = NULL;
|
||||
rofi_theme_parse_string ( "* { test: 10px 20px;}");
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
|
||||
ck_assert_double_eq ( p.left.distance , 20 );
|
||||
ck_assert_int_eq ( p.left.type , ROFI_PU_PX );
|
||||
ck_assert_double_eq ( p.right.distance , 20 );
|
||||
|
@ -982,8 +982,8 @@ START_TEST ( test_properties_padding_3 )
|
|||
wid.state = NULL;
|
||||
rofi_theme_parse_string ( "* { test: 10px 30px 20px;}");
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
|
||||
ck_assert_double_eq ( p.left.distance , 30 );
|
||||
ck_assert_int_eq ( p.left.type , ROFI_PU_PX );
|
||||
ck_assert_double_eq ( p.right.distance , 30 );
|
||||
|
@ -1002,8 +1002,8 @@ START_TEST ( test_properties_padding_4 )
|
|||
wid.state = NULL;
|
||||
rofi_theme_parse_string ( "* { test: 10px 30px 20px 40px;}");
|
||||
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);
|
||||
RofiPadding pi = (RofiPadding){d,d,d,d};
|
||||
RofiPadding p = rofi_theme_get_padding ( &wid, "test", pi);
|
||||
ck_assert_double_eq ( p.left.distance , 40 );
|
||||
ck_assert_int_eq ( p.left.type , ROFI_PU_PX );
|
||||
ck_assert_double_eq ( p.right.distance , 30 );
|
||||
|
|
Loading…
Reference in a new issue