use color, background-color and border-color

This commit is contained in:
Dave Davenport 2017-09-06 19:02:09 +02:00
parent 4dc9f29512
commit 6b43fed3aa
5 changed files with 8 additions and 54 deletions

View File

@ -133,16 +133,6 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
* @returns The distance value of this property for this widget.
*/
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.
* @param def The default value.
*
* Obtain the distance of the widget.
*
* @returns The distance value of this property for this widget.
*/
RofiDistance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def );
/**
* @param widget The widget to query
@ -166,16 +156,6 @@ int rofi_theme_get_integer ( const widget *widget, const char *property, int
*/
int rofi_theme_get_position ( 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 integer of the widget.
*
* @returns The integer value of this property for this widget.
*/
int rofi_theme_get_integer_exact ( const widget *widget, const char *property, int def );
/**
* @param widget The widget to query

View File

@ -26,4 +26,6 @@ const char * const PropertyTypeName[P_NUM_TYPES] = {
"List",
/** Orientation */
"Orientation",
/** Inherit */
"Inherit",
};

View File

@ -504,27 +504,10 @@ int rofi_theme_get_integer ( const widget *widget, const char *property, int def
g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );
return def;
}
int rofi_theme_get_integer_exact ( const widget *widget, const char *property, int def )
RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def )
{
// State is note considered when doing exact match, only base name.
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, NULL, TRUE );
Property *p = rofi_theme_find_property ( wid, P_INTEGER, property, TRUE );
if ( p ) {
if ( p->type == P_INHERIT ) {
if ( widget->parent ) {
return rofi_theme_get_integer_exact( widget->parent, property, def );
}
return def;
}
return p->value.i;
}
g_debug ( "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );
return def;
}
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 );
ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE );
Property *p = rofi_theme_find_property ( wid, P_PADDING, property, FALSE );
if ( p ) {
if ( p->type == P_INHERIT ) {
if ( widget->parent ) {
@ -543,15 +526,6 @@ static RofiDistance _rofi_theme_get_distance ( const widget *widget, const char
return (RofiDistance){ def, ROFI_PU_PX, ROFI_HL_SOLID };
}
RofiDistance rofi_theme_get_distance_exact ( const widget *widget, const char *property, int def )
{
return _rofi_theme_get_distance ( widget, property, def, TRUE );
}
RofiDistance 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 );

View File

@ -442,9 +442,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
// TODO check if this is still needed after flatning.
cairo_set_operator ( draw, CAIRO_OPERATOR_OVER );
cairo_set_source_rgb ( draw, 0.0, 0.0, 0.0 );
rofi_theme_get_color ( WIDGET ( tb ), "foreground", draw );
// Text
rofi_theme_get_color ( WIDGET ( tb ), "text", draw );
rofi_theme_get_color ( WIDGET ( tb ), "color", draw );
// draw the cursor
if ( tb->flags & TB_EDITABLE && tb->blink ) {
// We want to place the cursor based on the text shown.

View File

@ -205,7 +205,7 @@ void widget_draw ( widget *widget, cairo_t *d )
cairo_close_path ( d );
cairo_set_source_rgba ( d, 1.0, 1.0, 1.0, 1.0 );
rofi_theme_get_color ( widget, "background", d );
rofi_theme_get_color ( widget, "background-color", d );
cairo_fill_preserve ( d );
cairo_clip ( d );
@ -218,7 +218,7 @@ void widget_draw ( widget *widget, cairo_t *d )
cairo_save ( d );
cairo_translate ( d, widget->x, widget->y );
cairo_new_path ( d );
rofi_theme_get_color ( widget, "foreground", d );
rofi_theme_get_color ( widget, "border-color", d );
if ( left > 0 ) {
double offset = ( radius_tl > 0 ) ? floor ( top / 2.0 ) : 0;
cairo_set_line_width ( d, left );