Tweak selected row color. #293

This commit is contained in:
Dave Davenport 2015-12-04 23:57:08 +01:00
parent 248e75827c
commit c4f3cbd2b1
2 changed files with 11 additions and 4 deletions

View file

@ -1615,7 +1615,7 @@ MenuReturn menu ( Mode *sw, char **input, char *prompt, unsigned int *selected_l
*input = g_strdup ( state.text->text ); *input = g_strdup ( state.text->text );
if ( next_pos ) { if ( next_pos ) {
if((state.selected+1)< state.num_lines){ if ( ( state.selected + 1 ) < state.num_lines ) {
*( next_pos ) = state.line_map[state.selected + 1]; *( next_pos ) = state.line_map[state.selected + 1];
} }
} }

View file

@ -117,6 +117,10 @@ void textbox_font ( textbox *tb, TextBoxFontType tbft )
tb->color_fg = color->fg; tb->color_fg = color->fg;
break; break;
} }
if ( ( tbft & SELECTED ) == SELECTED ) {
tb->color_bg = color->hlbg;
tb->color_fg = color->hlfg;
}
if ( tb->tbft != tbft ) { if ( tb->tbft != tbft ) {
tb->update = TRUE; tb->update = TRUE;
} }
@ -287,13 +291,16 @@ static void texbox_update ( textbox *tb )
} }
// Set ARGB // Set ARGB
Color col = tb->color_bg; Color col = tb->color_bg;
cairo_set_source_rgba ( tb->main_draw, col.red, col.green, col.blue, col.alpha ); double scale = 1.0;
if ( ( tb->tbft & SELECTED ) == SELECTED && ( tb->tbft & FMOD_MASK ) != HIGHLIGHT ) {
scale = 0.4;
}
cairo_set_source_rgba ( tb->main_draw, col.red, col.green, col.blue, col.alpha * scale );
cairo_paint ( tb->main_draw ); cairo_paint ( tb->main_draw );
// Set ARGB // Set ARGB
col = tb->color_fg; col = tb->color_fg;
double scale = tb->tbft & SELECTED ? 0.5 : 1.0;
cairo_set_source_rgba ( tb->main_draw, col.red, col.green, col.blue, col.alpha * scale ); cairo_set_source_rgba ( tb->main_draw, col.red, col.green, col.blue, col.alpha * scale );
cairo_move_to ( tb->main_draw, x, y ); cairo_move_to ( tb->main_draw, x, y );
pango_cairo_show_layout ( tb->main_draw, tb->layout ); pango_cairo_show_layout ( tb->main_draw, tb->layout );