diff options
-rw-r--r-- | tools/perf/Makefile | 1 | ||||
-rw-r--r-- | tools/perf/ui/gtk/gtk.h | 2 | ||||
-rw-r--r-- | tools/perf/ui/gtk/helpline.c | 30 | ||||
-rw-r--r-- | tools/perf/ui/gtk/setup.c | 1 |
4 files changed, 34 insertions, 0 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 483fb69fa4ae..75af93dc52ad 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -600,6 +600,7 @@ else | |||
600 | LIB_OBJS += $(OUTPUT)ui/gtk/browser.o | 600 | LIB_OBJS += $(OUTPUT)ui/gtk/browser.o |
601 | LIB_OBJS += $(OUTPUT)ui/gtk/setup.o | 601 | LIB_OBJS += $(OUTPUT)ui/gtk/setup.o |
602 | LIB_OBJS += $(OUTPUT)ui/gtk/util.o | 602 | LIB_OBJS += $(OUTPUT)ui/gtk/util.o |
603 | LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o | ||
603 | # Make sure that it'd be included only once. | 604 | # Make sure that it'd be included only once. |
604 | ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) | 605 | ifneq ($(findstring -DNO_NEWT_SUPPORT,$(BASIC_CFLAGS)),) |
605 | LIB_OBJS += $(OUTPUT)ui/setup.o | 606 | LIB_OBJS += $(OUTPUT)ui/setup.o |
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h index a4d0f2b4a2dc..793cb6116ddf 100644 --- a/tools/perf/ui/gtk/gtk.h +++ b/tools/perf/ui/gtk/gtk.h | |||
@@ -29,6 +29,8 @@ static inline bool perf_gtk__is_active_context(struct perf_gtk_context *ctx) | |||
29 | struct perf_gtk_context *perf_gtk__activate_context(GtkWidget *window); | 29 | struct perf_gtk_context *perf_gtk__activate_context(GtkWidget *window); |
30 | int perf_gtk__deactivate_context(struct perf_gtk_context **ctx); | 30 | int perf_gtk__deactivate_context(struct perf_gtk_context **ctx); |
31 | 31 | ||
32 | void perf_gtk__init_helpline(void); | ||
33 | |||
32 | #ifndef HAVE_GTK_INFO_BAR | 34 | #ifndef HAVE_GTK_INFO_BAR |
33 | static inline GtkWidget *perf_gtk__setup_info_bar(void) | 35 | static inline GtkWidget *perf_gtk__setup_info_bar(void) |
34 | { | 36 | { |
diff --git a/tools/perf/ui/gtk/helpline.c b/tools/perf/ui/gtk/helpline.c new file mode 100644 index 000000000000..2511b3746797 --- /dev/null +++ b/tools/perf/ui/gtk/helpline.c | |||
@@ -0,0 +1,30 @@ | |||
1 | #include "gtk.h" | ||
2 | #include "../helpline.h" | ||
3 | |||
4 | static void gtk_helpline_pop(void) | ||
5 | { | ||
6 | if (!perf_gtk__is_active_context(pgctx)) | ||
7 | return; | ||
8 | |||
9 | gtk_statusbar_pop(GTK_STATUSBAR(pgctx->statbar), | ||
10 | pgctx->statbar_ctx_id); | ||
11 | } | ||
12 | |||
13 | static void gtk_helpline_push(const char *msg) | ||
14 | { | ||
15 | if (!perf_gtk__is_active_context(pgctx)) | ||
16 | return; | ||
17 | |||
18 | gtk_statusbar_push(GTK_STATUSBAR(pgctx->statbar), | ||
19 | pgctx->statbar_ctx_id, msg); | ||
20 | } | ||
21 | |||
22 | static struct ui_helpline gtk_helpline_fns = { | ||
23 | .pop = gtk_helpline_pop, | ||
24 | .push = gtk_helpline_push, | ||
25 | }; | ||
26 | |||
27 | void perf_gtk__init_helpline(void) | ||
28 | { | ||
29 | helpline_fns = >k_helpline_fns; | ||
30 | } | ||
diff --git a/tools/perf/ui/gtk/setup.c b/tools/perf/ui/gtk/setup.c index 92879ce61e2f..ad40b3626fdb 100644 --- a/tools/perf/ui/gtk/setup.c +++ b/tools/perf/ui/gtk/setup.c | |||
@@ -7,6 +7,7 @@ extern struct perf_error_ops perf_gtk_eops; | |||
7 | int perf_gtk__init(void) | 7 | int perf_gtk__init(void) |
8 | { | 8 | { |
9 | perf_error__register(&perf_gtk_eops); | 9 | perf_error__register(&perf_gtk_eops); |
10 | perf_gtk__init_helpline(); | ||
10 | return gtk_init_check(NULL, NULL) ? 0 : -1; | 11 | return gtk_init_check(NULL, NULL) ? 0 : -1; |
11 | } | 12 | } |
12 | 13 | ||