summaryrefslogtreecommitdiff
path: root/overlay/overlay.c
diff options
context:
space:
mode:
Diffstat (limited to 'overlay/overlay.c')
-rw-r--r--overlay/overlay.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/overlay/overlay.c b/overlay/overlay.c
index 0968fd71..92123601 100644
--- a/overlay/overlay.c
+++ b/overlay/overlay.c
@@ -8,6 +8,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <signal.h>
#include "overlay.h"
#include "chart.h"
@@ -556,6 +557,13 @@ static void show_gem_objects(struct overlay_context *ctx, struct overlay_gem_obj
}
}
+static int take_snapshot;
+
+static void signal_snapshot(int sig)
+{
+ take_snapshot = sig;
+}
+
int main(int argc, char **argv)
{
struct overlay_context ctx;
@@ -566,6 +574,8 @@ int main(int argc, char **argv)
return 0;
}
+ signal(SIGUSR1, signal_snapshot);
+
ctx.width = 640;
ctx.height = 236;
ctx.surface = x11_overlay_create(POS_TOP_RIGHT, &ctx.width, &ctx.height);
@@ -609,6 +619,13 @@ int main(int argc, char **argv)
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;