aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-10-20 14:59:15 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-10-20 14:59:15 -0400
commitcf9580036a830f9e95f32dbcedfc57ea1697f120 (patch)
treecad288bb3c8d10fca08210a2d68cf271a269ccee /tools
parent29208e573a9409ee56599cc0157f31b42c7a0235 (diff)
perf ui browser: Use libslang to read keys
Just another step in stopping the use of libnewt in perf. 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-uy6s534uqxq8tenh6s3k8ocj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Makefile1
-rw-r--r--tools/perf/builtin-annotate.c8
-rw-r--r--tools/perf/util/hist.h9
-rw-r--r--tools/perf/util/ui/browser.c79
-rw-r--r--tools/perf/util/ui/browsers/annotate.c19
-rw-r--r--tools/perf/util/ui/browsers/hists.c33
-rw-r--r--tools/perf/util/ui/keysyms.h25
-rw-r--r--tools/perf/util/ui/libslang.h2
-rw-r--r--tools/perf/util/ui/setup.c13
9 files changed, 125 insertions, 64 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 37fe93019bc6..b98e3075646b 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -472,6 +472,7 @@ else
472 LIB_H += util/ui/browser.h 472 LIB_H += util/ui/browser.h
473 LIB_H += util/ui/browsers/map.h 473 LIB_H += util/ui/browsers/map.h
474 LIB_H += util/ui/helpline.h 474 LIB_H += util/ui/helpline.h
475 LIB_H += util/ui/keysyms.h
475 LIB_H += util/ui/libslang.h 476 LIB_H += util/ui/libslang.h
476 LIB_H += util/ui/progress.h 477 LIB_H += util/ui/progress.h
477 LIB_H += util/ui/util.h 478 LIB_H += util/ui/util.h
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 3ea764a78053..46b4c24f338e 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -118,7 +118,7 @@ static void hists__find_annotations(struct hists *self, int evidx,
118 int nr_events) 118 int nr_events)
119{ 119{
120 struct rb_node *nd = rb_first(&self->entries), *next; 120 struct rb_node *nd = rb_first(&self->entries), *next;
121 int key = KEY_RIGHT; 121 int key = K_RIGHT;
122 122
123 while (nd) { 123 while (nd) {
124 struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); 124 struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
@@ -130,7 +130,7 @@ static void hists__find_annotations(struct hists *self, int evidx,
130 notes = symbol__annotation(he->ms.sym); 130 notes = symbol__annotation(he->ms.sym);
131 if (notes->src == NULL) { 131 if (notes->src == NULL) {
132find_next: 132find_next:
133 if (key == KEY_LEFT) 133 if (key == K_LEFT)
134 nd = rb_prev(nd); 134 nd = rb_prev(nd);
135 else 135 else
136 nd = rb_next(nd); 136 nd = rb_next(nd);
@@ -141,10 +141,10 @@ find_next:
141 key = hist_entry__tui_annotate(he, evidx, nr_events, 141 key = hist_entry__tui_annotate(he, evidx, nr_events,
142 NULL, NULL, 0); 142 NULL, NULL, 0);
143 switch (key) { 143 switch (key) {
144 case KEY_RIGHT: 144 case K_RIGHT:
145 next = rb_next(nd); 145 next = rb_next(nd);
146 break; 146 break;
147 case KEY_LEFT: 147 case K_LEFT:
148 next = rb_prev(nd); 148 next = rb_prev(nd);
149 break; 149 break;
150 default: 150 default:
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 575bcbc41355..ff93ddc91c5c 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -125,16 +125,13 @@ static inline int hist_entry__tui_annotate(struct hist_entry *self __used,
125{ 125{
126 return 0; 126 return 0;
127} 127}
128#define KEY_LEFT -1 128#define K_LEFT -1
129#define KEY_RIGHT -2 129#define K_RIGHT -2
130#else 130#else
131#include <newt.h> 131#include "ui/keysyms.h"
132int hist_entry__tui_annotate(struct hist_entry *he, int evidx, int nr_events, 132int hist_entry__tui_annotate(struct hist_entry *he, int evidx, int nr_events,
133 void(*timer)(void *arg), void *arg, int delay_secs); 133 void(*timer)(void *arg), void *arg, int delay_secs);
134 134
135#define KEY_LEFT NEWT_KEY_LEFT
136#define KEY_RIGHT NEWT_KEY_RIGHT
137
138int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, 135int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help,
139 void(*timer)(void *arg), void *arg, 136 void(*timer)(void *arg), void *arg,
140 int refresh); 137 int refresh);
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 06fc9ebd8d3f..5359f371d30a 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -11,10 +11,9 @@
11#include <sys/ttydefaults.h> 11#include <sys/ttydefaults.h>
12#include "browser.h" 12#include "browser.h"
13#include "helpline.h" 13#include "helpline.h"
14#include "keysyms.h"
14#include "../color.h" 15#include "../color.h"
15 16
16int newtGetKey(void);
17
18static int ui_browser__percent_color(struct ui_browser *browser, 17static int ui_browser__percent_color(struct ui_browser *browser,
19 double percent, bool current) 18 double percent, bool current)
20{ 19{
@@ -292,16 +291,55 @@ void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries)
292 browser->seek(browser, browser->top_idx, SEEK_SET); 291 browser->seek(browser, browser->top_idx, SEEK_SET);
293} 292}
294 293
294static int ui__getch(int delay_secs)
295{
296 struct timeval timeout, *ptimeout = delay_secs ? &timeout : NULL;
297 fd_set read_set;
298 int err, key;
299
300 FD_ZERO(&read_set);
301 FD_SET(0, &read_set);
302
303 if (delay_secs) {
304 timeout.tv_sec = delay_secs;
305 timeout.tv_usec = 0;
306 }
307
308 err = select(1, &read_set, NULL, NULL, ptimeout);
309
310 if (err == 0)
311 return K_TIMER;
312
313 if (err == -1) {
314 if (errno == EINTR)
315 return K_RESIZE;
316 return K_ERROR;
317 }
318
319 key = SLang_getkey();
320 if (key != K_ESC)
321 return key;
322
323 FD_ZERO(&read_set);
324 FD_SET(0, &read_set);
325 timeout.tv_sec = 0;
326 timeout.tv_usec = 20;
327 err = select(1, &read_set, NULL, NULL, &timeout);
328 if (err == 0)
329 return K_ESC;
330
331 SLang_ungetkey(key);
332 return SLkp_getkey();
333}
334
295int ui_browser__run(struct ui_browser *self, int delay_secs) 335int ui_browser__run(struct ui_browser *self, int delay_secs)
296{ 336{
297 int err, key; 337 int err, key;
298 struct timeval timeout, *ptimeout = delay_secs ? &timeout : NULL;
299 338
300 pthread__unblock_sigwinch(); 339 pthread__unblock_sigwinch();
301 340
302 while (1) { 341 while (1) {
303 off_t offset; 342 off_t offset;
304 fd_set read_set;
305 343
306 pthread_mutex_lock(&ui__lock); 344 pthread_mutex_lock(&ui__lock);
307 err = __ui_browser__refresh(self); 345 err = __ui_browser__refresh(self);
@@ -310,20 +348,9 @@ int ui_browser__run(struct ui_browser *self, int delay_secs)
310 if (err < 0) 348 if (err < 0)
311 break; 349 break;
312 350
313 FD_ZERO(&read_set); 351 key = ui__getch(delay_secs);
314 FD_SET(0, &read_set);
315 352
316 if (delay_secs) { 353 if (key == K_RESIZE) {
317 timeout.tv_sec = delay_secs;
318 timeout.tv_usec = 0;
319 }
320
321 err = select(1, &read_set, NULL, NULL, ptimeout);
322 if (err > 0 && FD_ISSET(0, &read_set))
323 key = newtGetKey();
324 else if (err == 0)
325 break;
326 else {
327 pthread_mutex_lock(&ui__lock); 354 pthread_mutex_lock(&ui__lock);
328 SLtt_get_screen_size(); 355 SLtt_get_screen_size();
329 SLsmg_reinit_smg(); 356 SLsmg_reinit_smg();
@@ -335,9 +362,9 @@ int ui_browser__run(struct ui_browser *self, int delay_secs)
335 } 362 }
336 363
337 if (self->use_navkeypressed && !self->navkeypressed) { 364 if (self->use_navkeypressed && !self->navkeypressed) {
338 if (key == NEWT_KEY_DOWN || key == NEWT_KEY_UP || 365 if (key == K_DOWN || key == K_UP ||
339 key == NEWT_KEY_PGDN || key == NEWT_KEY_PGUP || 366 key == K_PGDN || key == K_PGUP ||
340 key == NEWT_KEY_HOME || key == NEWT_KEY_END || 367 key == K_HOME || key == K_END ||
341 key == ' ') { 368 key == ' ') {
342 self->navkeypressed = true; 369 self->navkeypressed = true;
343 continue; 370 continue;
@@ -346,7 +373,7 @@ int ui_browser__run(struct ui_browser *self, int delay_secs)
346 } 373 }
347 374
348 switch (key) { 375 switch (key) {
349 case NEWT_KEY_DOWN: 376 case K_DOWN:
350 if (self->index == self->nr_entries - 1) 377 if (self->index == self->nr_entries - 1)
351 break; 378 break;
352 ++self->index; 379 ++self->index;
@@ -355,7 +382,7 @@ int ui_browser__run(struct ui_browser *self, int delay_secs)
355 self->seek(self, +1, SEEK_CUR); 382 self->seek(self, +1, SEEK_CUR);
356 } 383 }
357 break; 384 break;
358 case NEWT_KEY_UP: 385 case K_UP:
359 if (self->index == 0) 386 if (self->index == 0)
360 break; 387 break;
361 --self->index; 388 --self->index;
@@ -364,7 +391,7 @@ int ui_browser__run(struct ui_browser *self, int delay_secs)
364 self->seek(self, -1, SEEK_CUR); 391 self->seek(self, -1, SEEK_CUR);
365 } 392 }
366 break; 393 break;
367 case NEWT_KEY_PGDN: 394 case K_PGDN:
368 case ' ': 395 case ' ':
369 if (self->top_idx + self->height > self->nr_entries - 1) 396 if (self->top_idx + self->height > self->nr_entries - 1)
370 break; 397 break;
@@ -376,7 +403,7 @@ int ui_browser__run(struct ui_browser *self, int delay_secs)
376 self->top_idx += offset; 403 self->top_idx += offset;
377 self->seek(self, +offset, SEEK_CUR); 404 self->seek(self, +offset, SEEK_CUR);
378 break; 405 break;
379 case NEWT_KEY_PGUP: 406 case K_PGUP:
380 if (self->top_idx == 0) 407 if (self->top_idx == 0)
381 break; 408 break;
382 409
@@ -389,10 +416,10 @@ int ui_browser__run(struct ui_browser *self, int delay_secs)
389 self->top_idx -= offset; 416 self->top_idx -= offset;
390 self->seek(self, -offset, SEEK_CUR); 417 self->seek(self, -offset, SEEK_CUR);
391 break; 418 break;
392 case NEWT_KEY_HOME: 419 case K_HOME:
393 ui_browser__reset_index(self); 420 ui_browser__reset_index(self);
394 break; 421 break;
395 case NEWT_KEY_END: 422 case K_END:
396 offset = self->height - 1; 423 offset = self->height - 1;
397 if (offset >= self->nr_entries) 424 if (offset >= self->nr_entries)
398 offset = self->nr_entries - 1; 425 offset = self->nr_entries - 1;
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 1a12d8fa8e99..4e0cb7fea7d9 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -6,6 +6,7 @@
6#include "../../sort.h" 6#include "../../sort.h"
7#include "../../symbol.h" 7#include "../../symbol.h"
8#include <pthread.h> 8#include <pthread.h>
9#include <newt.h>
9 10
10static void ui__error_window(const char *fmt, ...) 11static void ui__error_window(const char *fmt, ...)
11{ 12{
@@ -265,18 +266,14 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
265 } 266 }
266 267
267 switch (key) { 268 switch (key) {
268 case -1: 269 case K_TIMER:
269 /*
270 * FIXME we need to check if it was
271 * es.reason == NEWT_EXIT_TIMER
272 */
273 if (timer != NULL) 270 if (timer != NULL)
274 timer(arg); 271 timer(arg);
275 272
276 if (delay_secs != 0) 273 if (delay_secs != 0)
277 symbol__annotate_decay_histogram(sym, evidx); 274 symbol__annotate_decay_histogram(sym, evidx);
278 continue; 275 continue;
279 case NEWT_KEY_TAB: 276 case K_TAB:
280 if (nd != NULL) { 277 if (nd != NULL) {
281 nd = rb_prev(nd); 278 nd = rb_prev(nd);
282 if (nd == NULL) 279 if (nd == NULL)
@@ -284,7 +281,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
284 } else 281 } else
285 nd = self->curr_hot; 282 nd = self->curr_hot;
286 break; 283 break;
287 case NEWT_KEY_UNTAB: 284 case K_UNTAB:
288 if (nd != NULL) 285 if (nd != NULL)
289 nd = rb_next(nd); 286 nd = rb_next(nd);
290 if (nd == NULL) 287 if (nd == NULL)
@@ -299,8 +296,8 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
299 if (annotate_browser__toggle_source(self)) 296 if (annotate_browser__toggle_source(self))
300 ui_helpline__puts(help); 297 ui_helpline__puts(help);
301 continue; 298 continue;
302 case NEWT_KEY_ENTER: 299 case K_ENTER:
303 case NEWT_KEY_RIGHT: 300 case K_RIGHT:
304 if (self->selection == NULL) { 301 if (self->selection == NULL) {
305 ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org"); 302 ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org");
306 continue; 303 continue;
@@ -350,8 +347,8 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
350 timer, arg, delay_secs); 347 timer, arg, delay_secs);
351 } 348 }
352 continue; 349 continue;
353 case NEWT_KEY_LEFT: 350 case K_LEFT:
354 case NEWT_KEY_ESCAPE: 351 case K_ESC:
355 case 'q': 352 case 'q':
356 case CTRL('c'): 353 case CTRL('c'):
357 goto out; 354 goto out;
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c
index a06e7d936ec1..af12e6f10792 100644
--- a/tools/perf/util/ui/browsers/hists.c
+++ b/tools/perf/util/ui/browsers/hists.c
@@ -344,7 +344,7 @@ static int hist_browser__run(struct hist_browser *self, const char *ev_name,
344 /* Expand the whole world. */ 344 /* Expand the whole world. */
345 hist_browser__set_folding(self, true); 345 hist_browser__set_folding(self, true);
346 break; 346 break;
347 case NEWT_KEY_ENTER: 347 case K_ENTER:
348 if (hist_browser__toggle_fold(self)) 348 if (hist_browser__toggle_fold(self))
349 break; 349 break;
350 /* fall thru */ 350 /* fall thru */
@@ -872,8 +872,8 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
872 } 872 }
873 873
874 switch (key) { 874 switch (key) {
875 case NEWT_KEY_TAB: 875 case K_TAB:
876 case NEWT_KEY_UNTAB: 876 case K_UNTAB:
877 if (nr_events == 1) 877 if (nr_events == 1)
878 continue; 878 continue;
879 /* 879 /*
@@ -891,7 +891,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
891 goto zoom_dso; 891 goto zoom_dso;
892 case 't': 892 case 't':
893 goto zoom_thread; 893 goto zoom_thread;
894 case NEWT_KEY_F1: 894 case K_F1:
895 case 'h': 895 case 'h':
896 case '?': 896 case '?':
897 ui__help_window("h/?/F1 Show this window\n" 897 ui__help_window("h/?/F1 Show this window\n"
@@ -909,11 +909,11 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
909 "d Zoom into current DSO\n" 909 "d Zoom into current DSO\n"
910 "t Zoom into current Thread\n"); 910 "t Zoom into current Thread\n");
911 continue; 911 continue;
912 case NEWT_KEY_ENTER: 912 case K_ENTER:
913 case NEWT_KEY_RIGHT: 913 case K_RIGHT:
914 /* menu */ 914 /* menu */
915 break; 915 break;
916 case NEWT_KEY_LEFT: { 916 case K_LEFT: {
917 const void *top; 917 const void *top;
918 918
919 if (pstack__empty(fstack)) { 919 if (pstack__empty(fstack)) {
@@ -931,7 +931,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
931 goto zoom_out_thread; 931 goto zoom_out_thread;
932 continue; 932 continue;
933 } 933 }
934 case NEWT_KEY_ESCAPE: 934 case K_ESC:
935 if (!left_exits && 935 if (!left_exits &&
936 !ui__dialog_yesno("Do you really want to exit?")) 936 !ui__dialog_yesno("Do you really want to exit?"))
937 continue; 937 continue;
@@ -1091,12 +1091,11 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
1091 key = ui_browser__run(&menu->b, delay_secs); 1091 key = ui_browser__run(&menu->b, delay_secs);
1092 1092
1093 switch (key) { 1093 switch (key) {
1094 case -1: 1094 case K_TIMER:
1095 /* FIXME we need to check if it was es.reason == NEWT_EXIT_TIMER */
1096 timer(arg); 1095 timer(arg);
1097 continue; 1096 continue;
1098 case NEWT_KEY_RIGHT: 1097 case K_RIGHT:
1099 case NEWT_KEY_ENTER: 1098 case K_ENTER:
1100 if (!menu->selection) 1099 if (!menu->selection)
1101 continue; 1100 continue;
1102 pos = menu->selection; 1101 pos = menu->selection;
@@ -1114,19 +1113,19 @@ browse_hists:
1114 arg, delay_secs); 1113 arg, delay_secs);
1115 ui_browser__show_title(&menu->b, title); 1114 ui_browser__show_title(&menu->b, title);
1116 switch (key) { 1115 switch (key) {
1117 case NEWT_KEY_TAB: 1116 case K_TAB:
1118 if (pos->node.next == &evlist->entries) 1117 if (pos->node.next == &evlist->entries)
1119 pos = list_entry(evlist->entries.next, struct perf_evsel, node); 1118 pos = list_entry(evlist->entries.next, struct perf_evsel, node);
1120 else 1119 else
1121 pos = list_entry(pos->node.next, struct perf_evsel, node); 1120 pos = list_entry(pos->node.next, struct perf_evsel, node);
1122 goto browse_hists; 1121 goto browse_hists;
1123 case NEWT_KEY_UNTAB: 1122 case K_UNTAB:
1124 if (pos->node.prev == &evlist->entries) 1123 if (pos->node.prev == &evlist->entries)
1125 pos = list_entry(evlist->entries.prev, struct perf_evsel, node); 1124 pos = list_entry(evlist->entries.prev, struct perf_evsel, node);
1126 else 1125 else
1127 pos = list_entry(pos->node.prev, struct perf_evsel, node); 1126 pos = list_entry(pos->node.prev, struct perf_evsel, node);
1128 goto browse_hists; 1127 goto browse_hists;
1129 case NEWT_KEY_ESCAPE: 1128 case K_ESC:
1130 if (!ui__dialog_yesno("Do you really want to exit?")) 1129 if (!ui__dialog_yesno("Do you really want to exit?"))
1131 continue; 1130 continue;
1132 /* Fall thru */ 1131 /* Fall thru */
@@ -1136,9 +1135,9 @@ browse_hists:
1136 default: 1135 default:
1137 continue; 1136 continue;
1138 } 1137 }
1139 case NEWT_KEY_LEFT: 1138 case K_LEFT:
1140 continue; 1139 continue;
1141 case NEWT_KEY_ESCAPE: 1140 case K_ESC:
1142 if (!ui__dialog_yesno("Do you really want to exit?")) 1141 if (!ui__dialog_yesno("Do you really want to exit?"))
1143 continue; 1142 continue;
1144 /* Fall thru */ 1143 /* Fall thru */
diff --git a/tools/perf/util/ui/keysyms.h b/tools/perf/util/ui/keysyms.h
new file mode 100644
index 000000000000..3458b1985761
--- /dev/null
+++ b/tools/perf/util/ui/keysyms.h
@@ -0,0 +1,25 @@
1#ifndef _PERF_KEYSYMS_H_
2#define _PERF_KEYSYMS_H_ 1
3
4#include "libslang.h"
5
6#define K_DOWN SL_KEY_DOWN
7#define K_END SL_KEY_END
8#define K_ENTER '\r'
9#define K_ESC 033
10#define K_F1 SL_KEY_F(1)
11#define K_HOME SL_KEY_HOME
12#define K_LEFT SL_KEY_LEFT
13#define K_PGDN SL_KEY_NPAGE
14#define K_PGUP SL_KEY_PPAGE
15#define K_RIGHT SL_KEY_RIGHT
16#define K_TAB '\t'
17#define K_UNTAB SL_KEY_UNTAB
18#define K_UP SL_KEY_UP
19
20/* Not really keys */
21#define K_TIMER -1
22#define K_ERROR -2
23#define K_RESIZE -3
24
25#endif /* _PERF_KEYSYMS_H_ */
diff --git a/tools/perf/util/ui/libslang.h b/tools/perf/util/ui/libslang.h
index 2b63e1c9b181..4d54b6450f5b 100644
--- a/tools/perf/util/ui/libslang.h
+++ b/tools/perf/util/ui/libslang.h
@@ -24,4 +24,6 @@
24#define sltt_set_color SLtt_set_color 24#define sltt_set_color SLtt_set_color
25#endif 25#endif
26 26
27#define SL_KEY_UNTAB 0x1000
28
27#endif /* _PERF_UI_SLANG_H_ */ 29#endif /* _PERF_UI_SLANG_H_ */
diff --git a/tools/perf/util/ui/setup.c b/tools/perf/util/ui/setup.c
index 5111f1ae0447..1e6ba06980c4 100644
--- a/tools/perf/util/ui/setup.c
+++ b/tools/perf/util/ui/setup.c
@@ -18,6 +18,18 @@ static void newt_suspend(void *d __used)
18 newtResume(); 18 newtResume();
19} 19}
20 20
21static int ui__init(void)
22{
23 int err = SLkp_init();
24
25 if (err < 0)
26 goto out;
27
28 SLkp_define_keysym((char *)"^(kB)", SL_KEY_UNTAB);
29out:
30 return err;
31}
32
21static void ui__exit(void) 33static void ui__exit(void)
22{ 34{
23 SLtt_set_cursor_visibility(1); 35 SLtt_set_cursor_visibility(1);
@@ -44,6 +56,7 @@ void setup_browser(bool fallback_to_pager)
44 56
45 use_browser = 1; 57 use_browser = 1;
46 newtInit(); 58 newtInit();
59 ui__init();
47 newtSetSuspendCallback(newt_suspend, NULL); 60 newtSetSuspendCallback(newt_suspend, NULL);
48 ui_helpline__init(); 61 ui_helpline__init();
49 ui_browser__init(); 62 ui_browser__init();