From c4f3cbd2b1e3955555096db0e3eabf6713af941f Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 4 Dec 2015 23:57:08 +0100 Subject: [PATCH] Tweak selected row color. #293 --- source/rofi.c | 2 +- source/textbox.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/rofi.c b/source/rofi.c index fc2a9abb..085ec98c 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1615,7 +1615,7 @@ MenuReturn menu ( Mode *sw, char **input, char *prompt, unsigned int *selected_l *input = g_strdup ( state.text->text ); 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]; } } diff --git a/source/textbox.c b/source/textbox.c index 6e594c8f..36dd9050 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -117,6 +117,10 @@ void textbox_font ( textbox *tb, TextBoxFontType tbft ) tb->color_fg = color->fg; break; } + if ( ( tbft & SELECTED ) == SELECTED ) { + tb->color_bg = color->hlbg; + tb->color_fg = color->hlfg; + } if ( tb->tbft != tbft ) { tb->update = TRUE; } @@ -287,13 +291,16 @@ static void texbox_update ( textbox *tb ) } // Set ARGB - Color col = tb->color_bg; - cairo_set_source_rgba ( tb->main_draw, col.red, col.green, col.blue, col.alpha ); + Color col = tb->color_bg; + 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 ); // Set ARGB 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_move_to ( tb->main_draw, x, y ); pango_cairo_show_layout ( tb->main_draw, tb->layout );