diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Makefile | 3 | ||||
-rw-r--r-- | tools/perf/config/feature-tests.mak | 13 | ||||
-rw-r--r-- | tools/perf/ui/gtk/browser.c | 33 | ||||
-rw-r--r-- | tools/perf/ui/gtk/gtk.h | 12 |
4 files changed, 61 insertions, 0 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index c0ee917ae8ab..d698c118a602 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -523,6 +523,9 @@ else | |||
523 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); | 523 | msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); |
524 | BASIC_CFLAGS += -DNO_GTK2_SUPPORT | 524 | BASIC_CFLAGS += -DNO_GTK2_SUPPORT |
525 | else | 525 | else |
526 | ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2)),y) | ||
527 | BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR | ||
528 | endif | ||
526 | BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0) | 529 | BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0) |
527 | EXTLIBS += $(shell pkg-config --libs gtk+-2.0) | 530 | EXTLIBS += $(shell pkg-config --libs gtk+-2.0) |
528 | LIB_OBJS += $(OUTPUT)ui/gtk/browser.o | 531 | LIB_OBJS += $(OUTPUT)ui/gtk/browser.o |
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak index d9084e03ce56..6c18785a6417 100644 --- a/tools/perf/config/feature-tests.mak +++ b/tools/perf/config/feature-tests.mak | |||
@@ -78,6 +78,19 @@ int main(int argc, char *argv[]) | |||
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | endef | 80 | endef |
81 | |||
82 | define SOURCE_GTK2_INFOBAR | ||
83 | #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" | ||
84 | #include <gtk/gtk.h> | ||
85 | #pragma GCC diagnostic error \"-Wstrict-prototypes\" | ||
86 | |||
87 | int main(void) | ||
88 | { | ||
89 | gtk_info_bar_new(); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | endef | ||
81 | endif | 94 | endif |
82 | 95 | ||
83 | ifndef NO_LIBPERL | 96 | ifndef NO_LIBPERL |
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c index ece360db8658..fd41e8d10337 100644 --- a/tools/perf/ui/gtk/browser.c +++ b/tools/perf/ui/gtk/browser.c | |||
@@ -122,6 +122,34 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) | |||
122 | gtk_container_add(GTK_CONTAINER(window), view); | 122 | gtk_container_add(GTK_CONTAINER(window), view); |
123 | } | 123 | } |
124 | 124 | ||
125 | #ifdef HAVE_GTK_INFO_BAR | ||
126 | static GtkWidget *perf_gtk__setup_info_bar(void) | ||
127 | { | ||
128 | GtkWidget *info_bar; | ||
129 | GtkWidget *label; | ||
130 | GtkWidget *content_area; | ||
131 | |||
132 | info_bar = gtk_info_bar_new(); | ||
133 | gtk_widget_set_no_show_all(info_bar, TRUE); | ||
134 | |||
135 | label = gtk_label_new(""); | ||
136 | gtk_widget_show(label); | ||
137 | |||
138 | content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar)); | ||
139 | gtk_container_add(GTK_CONTAINER(content_area), label); | ||
140 | |||
141 | gtk_info_bar_add_button(GTK_INFO_BAR(info_bar), GTK_STOCK_OK, | ||
142 | GTK_RESPONSE_OK); | ||
143 | g_signal_connect(info_bar, "response", | ||
144 | G_CALLBACK(gtk_widget_hide), NULL); | ||
145 | |||
146 | pgctx->info_bar = info_bar; | ||
147 | pgctx->message_label = label; | ||
148 | |||
149 | return info_bar; | ||
150 | } | ||
151 | #endif | ||
152 | |||
125 | static GtkWidget *perf_gtk__setup_statusbar(void) | 153 | static GtkWidget *perf_gtk__setup_statusbar(void) |
126 | { | 154 | { |
127 | GtkWidget *stbar; | 155 | GtkWidget *stbar; |
@@ -145,6 +173,7 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | |||
145 | struct perf_evsel *pos; | 173 | struct perf_evsel *pos; |
146 | GtkWidget *vbox; | 174 | GtkWidget *vbox; |
147 | GtkWidget *notebook; | 175 | GtkWidget *notebook; |
176 | GtkWidget *info_bar; | ||
148 | GtkWidget *statbar; | 177 | GtkWidget *statbar; |
149 | GtkWidget *window; | 178 | GtkWidget *window; |
150 | 179 | ||
@@ -189,6 +218,10 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, | |||
189 | 218 | ||
190 | gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | 219 | gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); |
191 | 220 | ||
221 | info_bar = perf_gtk__setup_info_bar(); | ||
222 | if (info_bar) | ||
223 | gtk_box_pack_start(GTK_BOX(vbox), info_bar, FALSE, FALSE, 0); | ||
224 | |||
192 | statbar = perf_gtk__setup_statusbar(); | 225 | statbar = perf_gtk__setup_statusbar(); |
193 | gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0); | 226 | gtk_box_pack_start(GTK_BOX(vbox), statbar, FALSE, FALSE, 0); |
194 | 227 | ||
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h index 206167868c5f..a4d0f2b4a2dc 100644 --- a/tools/perf/ui/gtk/gtk.h +++ b/tools/perf/ui/gtk/gtk.h | |||
@@ -10,6 +10,11 @@ | |||
10 | 10 | ||
11 | struct perf_gtk_context { | 11 | struct perf_gtk_context { |
12 | GtkWidget *main_window; | 12 | GtkWidget *main_window; |
13 | |||
14 | #ifdef HAVE_GTK_INFO_BAR | ||
15 | GtkWidget *info_bar; | ||
16 | GtkWidget *message_label; | ||
17 | #endif | ||
13 | GtkWidget *statbar; | 18 | GtkWidget *statbar; |
14 | guint statbar_ctx_id; | 19 | guint statbar_ctx_id; |
15 | }; | 20 | }; |
@@ -24,4 +29,11 @@ static inline bool perf_gtk__is_active_context(struct perf_gtk_context *ctx) | |||
24 | struct perf_gtk_context *perf_gtk__activate_context(GtkWidget *window); | 29 | struct perf_gtk_context *perf_gtk__activate_context(GtkWidget *window); |
25 | int perf_gtk__deactivate_context(struct perf_gtk_context **ctx); | 30 | int perf_gtk__deactivate_context(struct perf_gtk_context **ctx); |
26 | 31 | ||
32 | #ifndef HAVE_GTK_INFO_BAR | ||
33 | static inline GtkWidget *perf_gtk__setup_info_bar(void) | ||
34 | { | ||
35 | return NULL; | ||
36 | } | ||
37 | #endif | ||
38 | |||
27 | #endif /* _PERF_GTK_H_ */ | 39 | #endif /* _PERF_GTK_H_ */ |