#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <signal.h>
#include "overlay.h"
#include "chart.h"
}
}
+static int take_snapshot;
+
+static void signal_snapshot(int sig)
+{
+ take_snapshot = sig;
+}
+
int main(int argc, char **argv)
{
struct overlay_context ctx;
return 0;
}
+ signal(SIGUSR1, signal_snapshot);
+
ctx.width = 640;
ctx.height = 236;
ctx.surface = x11_overlay_create(POS_TOP_RIGHT, &ctx.width, &ctx.height);
cairo_destroy(ctx.cr);
overlay_show(ctx.surface);
+
+ if (take_snapshot) {
+ char buf[80];
+ sprintf(buf, "overlay-snapshot-%d.png", i-1);
+ cairo_surface_write_to_png(ctx.surface, buf);
+ take_snapshot = 0;
+ }
}
return 0;