aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browser.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/ui/browser.c')
-rw-r--r--tools/perf/util/ui/browser.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index a54b926efe2..dce16ee4364 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -14,9 +14,10 @@
14 14
15int newtGetKey(void); 15int newtGetKey(void);
16 16
17static int ui_browser__percent_color(double percent, bool current) 17static int ui_browser__percent_color(struct ui_browser *browser,
18 double percent, bool current)
18{ 19{
19 if (current) 20 if (current && (!browser->use_navkeypressed || browser->navkeypressed))
20 return HE_COLORSET_SELECTED; 21 return HE_COLORSET_SELECTED;
21 if (percent >= MIN_RED) 22 if (percent >= MIN_RED)
22 return HE_COLORSET_TOP; 23 return HE_COLORSET_TOP;
@@ -33,7 +34,7 @@ void ui_browser__set_color(struct ui_browser *self __used, int color)
33void ui_browser__set_percent_color(struct ui_browser *self, 34void ui_browser__set_percent_color(struct ui_browser *self,
34 double percent, bool current) 35 double percent, bool current)
35{ 36{
36 int color = ui_browser__percent_color(percent, current); 37 int color = ui_browser__percent_color(self, percent, current);
37 ui_browser__set_color(self, color); 38 ui_browser__set_color(self, color);
38} 39}
39 40
@@ -241,12 +242,18 @@ static void ui_browser__scrollbar_set(struct ui_browser *browser)
241static int __ui_browser__refresh(struct ui_browser *browser) 242static int __ui_browser__refresh(struct ui_browser *browser)
242{ 243{
243 int row; 244 int row;
245 int width = browser->width;
244 246
245 row = browser->refresh(browser); 247 row = browser->refresh(browser);
246 ui_browser__set_color(browser, HE_COLORSET_NORMAL); 248 ui_browser__set_color(browser, HE_COLORSET_NORMAL);
249
250 if (!browser->use_navkeypressed || browser->navkeypressed)
251 ui_browser__scrollbar_set(browser);
252 else
253 width += 1;
254
247 SLsmg_fill_region(browser->y + row, browser->x, 255 SLsmg_fill_region(browser->y + row, browser->x,
248 browser->height - row, browser->width, ' '); 256 browser->height - row, width, ' ');
249 ui_browser__scrollbar_set(browser);
250 257
251 return 0; 258 return 0;
252} 259}
@@ -326,6 +333,17 @@ int ui_browser__run(struct ui_browser *self, int delay_secs)
326 continue; 333 continue;
327 } 334 }
328 335
336 if (self->use_navkeypressed && !self->navkeypressed) {
337 if (key == NEWT_KEY_DOWN || key == NEWT_KEY_UP ||
338 key == NEWT_KEY_PGDN || key == NEWT_KEY_PGUP ||
339 key == NEWT_KEY_HOME || key == NEWT_KEY_END ||
340 key == ' ') {
341 self->navkeypressed = true;
342 continue;
343 } else
344 return key;
345 }
346
329 switch (key) { 347 switch (key) {
330 case NEWT_KEY_DOWN: 348 case NEWT_KEY_DOWN:
331 if (self->index == self->nr_entries - 1) 349 if (self->index == self->nr_entries - 1)