aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browser.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-10-26 10:04:37 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-10-26 11:15:07 -0400
commit4610e4137b5fb93042a248928a2c0049ef7d4190 (patch)
tree163cd2366d5870a67619aa4774cfc04cf7a97d6f /tools/perf/util/ui/browser.c
parent0458122db0a2ebd1d3779469cb6184d8b195be09 (diff)
perf ui browser: Handle K_RESIZE in dialog windows
Just provide wrappers for things like ui__warning, ui__dialog_yesno and if they return K_RESIZE, refresh dimensions, redraw the entries, etc. 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-3ih7hyk9weryxaxb501sfq4u@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui/browser.c')
-rw-r--r--tools/perf/util/ui/browser.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 8607efa1356..d2051be04f1 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -169,6 +169,46 @@ void ui_browser__refresh_dimensions(struct ui_browser *self)
169 self->x = 0; 169 self->x = 0;
170} 170}
171 171
172void ui_browser__handle_resize(struct ui_browser *browser)
173{
174 ui__refresh_dimensions(false);
175 ui_browser__show(browser, browser->title, ui_helpline__current);
176 ui_browser__refresh(browser);
177}
178
179int ui_browser__warning(struct ui_browser *browser, const char *format, ...)
180{
181 va_list args;
182 int key;
183
184 va_start(args, format);
185 while ((key = __ui__warning("Warning!", format, args)) == K_RESIZE)
186 ui_browser__handle_resize(browser);
187 va_end(args);
188
189 return key;
190}
191
192int ui_browser__help_window(struct ui_browser *browser, const char *text)
193{
194 int key;
195
196 while ((key = ui__help_window(text)) == K_RESIZE)
197 ui_browser__handle_resize(browser);
198
199 return key;
200}
201
202bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text)
203{
204 int key;
205
206 while ((key = ui__dialog_yesno(text)) == K_RESIZE)
207 ui_browser__handle_resize(browser);
208
209 return key == K_ENTER || toupper(key) == 'Y';
210}
211
172void ui_browser__reset_index(struct ui_browser *self) 212void ui_browser__reset_index(struct ui_browser *self)
173{ 213{
174 self->index = self->top_idx = 0; 214 self->index = self->top_idx = 0;