perf ui browser: Return the current color when setting a new one

Tools that want to change parts of the line to a different color and
then restore the previous one will use this, starting with the annotate
browser that will change the color of addresses if not on the current
entry, i.e. the selected one.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-uiajpevhxo4mzrvna6remb4a@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 31d68e7b
...@@ -27,9 +27,12 @@ static int ui_browser__percent_color(struct ui_browser *browser, ...@@ -27,9 +27,12 @@ static int ui_browser__percent_color(struct ui_browser *browser,
return HE_COLORSET_NORMAL; return HE_COLORSET_NORMAL;
} }
void ui_browser__set_color(struct ui_browser *self __used, int color) int ui_browser__set_color(struct ui_browser *browser, int color)
{ {
int ret = browser->current_color;
browser->current_color = color;
SLsmg_set_color(color); SLsmg_set_color(color);
return ret;
} }
void ui_browser__set_percent_color(struct ui_browser *self, void ui_browser__set_percent_color(struct ui_browser *self,
......
...@@ -15,6 +15,7 @@ struct ui_browser { ...@@ -15,6 +15,7 @@ struct ui_browser {
u64 index, top_idx; u64 index, top_idx;
void *top, *entries; void *top, *entries;
u16 y, x, width, height; u16 y, x, width, height;
int current_color;
void *priv; void *priv;
const char *title; const char *title;
char *helpline; char *helpline;
...@@ -27,7 +28,7 @@ struct ui_browser { ...@@ -27,7 +28,7 @@ struct ui_browser {
bool use_navkeypressed; bool use_navkeypressed;
}; };
void ui_browser__set_color(struct ui_browser *self, int color); int ui_browser__set_color(struct ui_browser *browser, int color);
void ui_browser__set_percent_color(struct ui_browser *self, void ui_browser__set_percent_color(struct ui_browser *self,
double percent, bool current); double percent, bool current);
bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row); bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册