helpline.c (4bb1646a80db65bb45c0a1bffb2435c6690c392e) helpline.c (0985a94891c73740dea1e2697f9d598a4a7810ab)
1#include <stdio.h>
2#include <string.h>
3
1#include "gtk.h"
4#include "gtk.h"
5#include "../ui.h"
2#include "../helpline.h"
6#include "../helpline.h"
7#include "../../util/debug.h"
3
4static 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);

--- 12 unchanged lines hidden (view full) ---

23 .pop = gtk_helpline_pop,
24 .push = gtk_helpline_push,
25};
26
27void perf_gtk__init_helpline(void)
28{
29 helpline_fns = &gtk_helpline_fns;
30}
8
9static void gtk_helpline_pop(void)
10{
11 if (!perf_gtk__is_active_context(pgctx))
12 return;
13
14 gtk_statusbar_pop(GTK_STATUSBAR(pgctx->statbar),
15 pgctx->statbar_ctx_id);

--- 12 unchanged lines hidden (view full) ---

28 .pop = gtk_helpline_pop,
29 .push = gtk_helpline_push,
30};
31
32void perf_gtk__init_helpline(void)
33{
34 helpline_fns = &gtk_helpline_fns;
35}
36
37int perf_gtk__show_helpline(const char *fmt, va_list ap)
38{
39 int ret;
40 char *ptr;
41 static int backlog;
42
43 ret = vscnprintf(ui_helpline__current + backlog,
44 sizeof(ui_helpline__current) - backlog, fmt, ap);
45 backlog += ret;
46
47 /* only first line can be displayed */
48 ptr = strchr(ui_helpline__current, '\n');
49 if (ptr && (ptr - ui_helpline__current) <= backlog) {
50 *ptr = '\0';
51 ui_helpline__puts(ui_helpline__current);
52 backlog = 0;
53 }
54
55 return ret;
56}