1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00

Add debug output to themer that indicates unset properties.

This commit is contained in:
Dave Davenport 2017-01-04 14:01:28 +01:00
parent 44581fd90b
commit 645fe24890
2 changed files with 36 additions and 28 deletions

View file

@ -9,6 +9,8 @@
#include "widgets/textbox.h"
#include "view.h"
#define LOG_DOMAIN "Theme"
void yyerror ( YYLTYPE *ylloc, const char *);
ThemeWidget *rofi_theme_find_or_create_class ( ThemeWidget *base, const char *class )
@ -296,6 +298,7 @@ int rofi_theme_get_integer ( const char *wclass, const char *name, const char *
if ( p ){
return p->value.i;
}
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", name, state?state:"", property );
return def;
}
Distance rofi_theme_get_distance ( const char *wclass, const char *name, const char *state, const char *property, int def )
@ -310,6 +313,7 @@ Distance rofi_theme_get_distance ( const char *wclass, const char *name, const
if ( p ){
return (Distance){(double)p->value.i, PW_PX};
}
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", name, state?state:"", property );
return (Distance){def, PW_PX};
}
@ -320,6 +324,7 @@ int rofi_theme_get_boolean ( const char *wclass, const char *name, const char *
if ( p ){
return p->value.b;
}
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", name, state?state:"", property );
return def;
}
@ -330,6 +335,7 @@ char *rofi_theme_get_string ( const char *wclass, const char *name, const char
if ( p ){
return p->value.s;
}
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", name, state?state:"", property );
return def;
}
double rofi_theme_get_double ( const char *wclass, const char *name, const char *state, const char *property, double def )
@ -339,6 +345,7 @@ double rofi_theme_get_double ( const char *wclass, const char *name, const char
if ( p ){
return p->value.b;
}
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", name, state?state:"", property );
return def;
}
void rofi_theme_get_color ( const char *wclass, const char *name, const char *state, const char *property, cairo_t *d)
@ -352,7 +359,8 @@ void rofi_theme_get_color ( const char *wclass, const char *name, const char *s
p->value.color.blue,
p->value.color.alpha
);
} else {
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", name, state?state:"", property );
}
}
Padding rofi_theme_get_padding ( const char *wclass, const char *name, const char *state, const char *property, Padding pad )
@ -368,6 +376,7 @@ Padding rofi_theme_get_padding ( const char *wclass, const char *name, const ch
pad = (Padding){d,d,d,d};
}
}
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", name, state?state:"", property );
return pad;
}
int distance_get_pixel ( Distance d, Orientation ori )

View file

@ -118,34 +118,33 @@ void widget_draw ( widget *widget, cairo_t *d )
int top = distance_get_pixel ( widget->border.top, ORIENTATION_HORIZONTAL );
int right = distance_get_pixel ( widget->border.right, ORIENTATION_VERTICAL );
int bottom = distance_get_pixel ( widget->border.bottom, ORIENTATION_VERTICAL );
rofi_theme_get_color ( widget->class_name, widget->name, widget->state, "foreground", d );
if ( left > 0 ) {
cairo_set_line_width ( d, left );
cairo_move_to ( d, margin_left + left/2.0, margin_top );
cairo_line_to ( d, margin_left + left/2.0, widget->h-margin_bottom);
cairo_stroke ( d );
if ( left || top || right || bottom ) {
rofi_theme_get_color ( widget->class_name, widget->name, widget->state, "foreground", d );
if ( left > 0 ) {
cairo_set_line_width ( d, left );
cairo_move_to ( d, margin_left + left/2.0, margin_top );
cairo_line_to ( d, margin_left + left/2.0, widget->h-margin_bottom);
cairo_stroke ( d );
}
if ( right > 0 ) {
cairo_set_line_width ( d, right );
cairo_move_to ( d, widget->w - margin_right - right/2.0, 0 );
cairo_line_to ( d, widget->w - margin_right - right/2.0, widget->h-margin_bottom );
cairo_stroke ( d );
}
if ( top > 0 ) {
cairo_set_line_width ( d, top );
cairo_move_to ( d, margin_left,margin_top+ top/2.0 );
cairo_line_to ( d, widget->w-margin_right, margin_top+top/2.0 );
cairo_stroke ( d );
}
if ( bottom > 0 ) {
cairo_set_line_width ( d, bottom );
cairo_move_to ( d, margin_left, widget->h-bottom/2.0-margin_bottom);
cairo_line_to ( d, widget->w-margin_right, widget->h-bottom/2.0-margin_bottom);
cairo_stroke ( d );
}
}
if ( right > 0 ) {
cairo_set_line_width ( d, right );
cairo_move_to ( d, widget->w - margin_right - right/2.0, 0 );
cairo_line_to ( d, widget->w - margin_right - right/2.0, widget->h-margin_bottom );
cairo_stroke ( d );
}
if ( top > 0 ) {
cairo_set_line_width ( d, top );
cairo_move_to ( d, margin_left,margin_top+ top/2.0 );
cairo_line_to ( d, widget->w-margin_right, margin_top+top/2.0 );
cairo_stroke ( d );
}
if ( bottom > 0 ) {
cairo_set_line_width ( d, bottom );
cairo_move_to ( d, margin_left, widget->h-bottom/2.0-margin_bottom);
cairo_line_to ( d, widget->w-margin_right, widget->h-bottom/2.0-margin_bottom);
cairo_stroke ( d );
}
widget->draw ( widget, d );
widget->need_redraw = FALSE;