perf ui browser: Return the current color when setting a new one
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 2 Apr 2012 15:48:56 +0000 (12:48 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 7 Apr 2012 19:08:42 +0000 (16:08 -0300)
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>
tools/perf/util/ui/browser.c
tools/perf/util/ui/browser.h

index 556829124b0246fff72fe09ad96ceab35119037b..076a5ffc8f56f062306ec72200bf01de2939da96 100644 (file)
@@ -27,9 +27,12 @@ static int ui_browser__percent_color(struct ui_browser *browser,
        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);
+       return ret;
 }
 
 void ui_browser__set_percent_color(struct ui_browser *self,
index 6ee82f60feaf2988ba31a0040ad9d85a00183f97..65b25921529eead8673ab37b2a5f2d5a24f7f80c 100644 (file)
@@ -15,6 +15,7 @@ struct ui_browser {
        u64           index, top_idx;
        void          *top, *entries;
        u16           y, x, width, height;
+       int           current_color;
        void          *priv;
        const char    *title;
        char          *helpline;
@@ -27,7 +28,7 @@ struct ui_browser {
        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,
                                   double percent, bool current);
 bool ui_browser__is_current_entry(struct ui_browser *self, unsigned row);
This page took 0.025989 seconds and 5 git commands to generate.