aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-04-02 11:48:56 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-04-07 15:08:42 -0400
commit087091652bf8b351432a3f3fb50996ee3582d5e4 (patch)
tree2cfbff9c5f1262a5597a9250b108545e4e9663c0
parent31d68e7b66f168e623902e194af1e52b8cf75d71 (diff)
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.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/ui/browser.c5
-rw-r--r--tools/perf/util/ui/browser.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 556829124b0..076a5ffc8f5 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -27,9 +27,12 @@ static int ui_browser__percent_color(struct ui_browser *browser,
27 return HE_COLORSET_NORMAL; 27 return HE_COLORSET_NORMAL;
28} 28}
29 29
30void ui_browser__set_color(struct ui_browser *self __used, int color) 30int ui_browser__set_color(struct ui_browser *browser, int color)
31{ 31{
32 int ret = browser->current_color;
33 browser->current_color = color;
32 SLsmg_set_color(color); 34 SLsmg_set_color(color);
35 return ret;
33} 36}
34 37
35void ui_browser__set_percent_color(struct ui_browser *self, 38void ui_browser__set_percent_color(struct ui_browser *self,
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 6ee82f60fea..65b25921529 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -15,6 +15,7 @@ struct ui_browser {
15 u64 index, top_idx; 15 u64 index, top_idx;
16 void *top, *entries; 16 void *top, *entries;
17 u16 y, x, width, height; 17 u16 y, x, width, height;
18 int current_color;
18 void *priv; 19 void *priv;
19 const char *title; 20 const char *title;
20 char *helpline; 21 char *helpline;
@@ -27,7 +28,7 @@ struct ui_browser {
27 bool use_navkeypressed; 28 bool use_navkeypressed;
28}; 29};
29 30
30void ui_browser__set_color(struct ui_browser *self, int color); 31int ui_browser__set_color(struct ui_browser *browser, int color);
31void ui_browser__set_percent_color(struct ui_browser *self, 32void ui_browser__set_percent_color(struct ui_browser *self,
32 double percent, bool current); 33 double percent, bool current);
33bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row); 34bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);