diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-01 15:34:42 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-07 11:36:54 -0400 |
commit | fa70b5d66d6e9de3331f57e434a16bc0eee980a8 (patch) | |
tree | 56a22045e135b3ca2fa1bb5f31730fa517b68134 /tools/perf/ui | |
parent | 62c95ae33f64ecf398f490886f026a6132fb1520 (diff) |
perf ui browser: Allow overriding refresh_dimensions method
Some browsers, like the hist_browser, may want to be notified everytime
a refresh_dimensions is needed, so that it can reset ui_browser->rows,
for instance, or do some other related reaction to screen resizings.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
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-ielvluuemzn30bneh0zk3twi@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r-- | tools/perf/ui/browser.c | 7 | ||||
-rw-r--r-- | tools/perf/ui/browser.h | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index adb294a3ec08..6680fa5cb9dd 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c | |||
@@ -250,7 +250,10 @@ int ui_browser__show(struct ui_browser *browser, const char *title, | |||
250 | int err; | 250 | int err; |
251 | va_list ap; | 251 | va_list ap; |
252 | 252 | ||
253 | ui_browser__refresh_dimensions(browser); | 253 | if (browser->refresh_dimensions == NULL) |
254 | browser->refresh_dimensions = ui_browser__refresh_dimensions; | ||
255 | |||
256 | browser->refresh_dimensions(browser); | ||
254 | 257 | ||
255 | pthread_mutex_lock(&ui__lock); | 258 | pthread_mutex_lock(&ui__lock); |
256 | __ui_browser__show_title(browser, title); | 259 | __ui_browser__show_title(browser, title); |
@@ -367,7 +370,7 @@ int ui_browser__run(struct ui_browser *browser, int delay_secs) | |||
367 | 370 | ||
368 | if (key == K_RESIZE) { | 371 | if (key == K_RESIZE) { |
369 | ui__refresh_dimensions(false); | 372 | ui__refresh_dimensions(false); |
370 | ui_browser__refresh_dimensions(browser); | 373 | browser->refresh_dimensions(browser); |
371 | __ui_browser__show_title(browser, browser->title); | 374 | __ui_browser__show_title(browser, browser->title); |
372 | ui_helpline__puts(browser->helpline); | 375 | ui_helpline__puts(browser->helpline); |
373 | continue; | 376 | continue; |
diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h index cb8f39a1646f..92ae72113965 100644 --- a/tools/perf/ui/browser.h +++ b/tools/perf/ui/browser.h | |||
@@ -19,6 +19,7 @@ struct ui_browser { | |||
19 | void *priv; | 19 | void *priv; |
20 | const char *title; | 20 | const char *title; |
21 | char *helpline; | 21 | char *helpline; |
22 | void (*refresh_dimensions)(struct ui_browser *browser); | ||
22 | unsigned int (*refresh)(struct ui_browser *browser); | 23 | unsigned int (*refresh)(struct ui_browser *browser); |
23 | void (*write)(struct ui_browser *browser, void *entry, int row); | 24 | void (*write)(struct ui_browser *browser, void *entry, int row); |
24 | void (*seek)(struct ui_browser *browser, off_t offset, int whence); | 25 | void (*seek)(struct ui_browser *browser, off_t offset, int whence); |