Skip to content

Commit 59d038d

Browse files
committed
ui browser: Add method to write graphical characters
To save typing on the switch char set slang stuff. It also helps in removing more slang direct calls, wrapping them at the ui_browser level, where at some point I'll try to implement those in terms of GTK+. Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent c4cceae commit 59d038d

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

tools/perf/ui/browser.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,13 @@ unsigned int ui_browser__argv_refresh(struct ui_browser *browser)
593593
return row;
594594
}
595595

596+
void ui_browser__write_graph(struct ui_browser *browser __used, int graph)
597+
{
598+
SLsmg_set_char_set(1);
599+
SLsmg_write_char(graph);
600+
SLsmg_set_char_set(0);
601+
}
602+
596603
void ui_browser__init(void)
597604
{
598605
int i = 0;

tools/perf/ui/browser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void ui_browser__refresh_dimensions(struct ui_browser *self);
3737
void ui_browser__reset_index(struct ui_browser *self);
3838

3939
void ui_browser__gotorc(struct ui_browser *self, int y, int x);
40+
void ui_browser__write_graph(struct ui_browser *browser, int graph);
4041
void __ui_browser__show_title(struct ui_browser *browser, const char *title);
4142
void ui_browser__show_title(struct ui_browser *browser, const char *title);
4243
int ui_browser__show(struct ui_browser *self, const char *title,

tools/perf/ui/browsers/annotate.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
7171
slsmg_write_nstring(" ", 9);
7272
}
7373

74-
SLsmg_set_char_set(1);
75-
SLsmg_write_char(SLSMG_VLINE_CHAR);
76-
SLsmg_set_char_set(0);
74+
ui_browser__write_graph(self, SLSMG_VLINE_CHAR);
7775
SLsmg_write_char(' ');
7876

7977
/* The scroll bar isn't being used */
@@ -116,10 +114,8 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
116114
if (ins__is_jump(dl->ins)) {
117115
bool fwd = dl->ops.target > (u64)dl->offset;
118116

119-
SLsmg_set_char_set(1);
120-
SLsmg_write_char(fwd ? SLSMG_DARROW_CHAR :
121-
SLSMG_UARROW_CHAR);
122-
SLsmg_set_char_set(0);
117+
ui_browser__write_graph(self, fwd ? SLSMG_DARROW_CHAR :
118+
SLSMG_UARROW_CHAR);
123119
SLsmg_write_char(' ');
124120
} else {
125121
slsmg_write_nstring(" ", 2);
@@ -131,9 +127,7 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
131127
if (strcmp(dl->name, "retq")) {
132128
slsmg_write_nstring(" ", 2);
133129
} else {
134-
SLsmg_set_char_set(1);
135-
SLsmg_write_char(SLSMG_LARROW_CHAR);
136-
SLsmg_set_char_set(0);
130+
ui_browser__write_graph(self, SLSMG_LARROW_CHAR);
137131
SLsmg_write_char(' ');
138132
}
139133

0 commit comments

Comments
 (0)