Signed-off-by: Tomohiro Komagata <[email protected]>
---
 compositor/weston-screenshooter.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/compositor/weston-screenshooter.c 
b/compositor/weston-screenshooter.c
index 9999909..f8db546 100644
--- a/compositor/weston-screenshooter.c
+++ b/compositor/weston-screenshooter.c
@@ -32,6 +32,7 @@
 #include "weston.h"
 #include "weston-screenshooter-server-protocol.h"
 #include "shared/helpers.h"
+#include "file-util.h"

 struct screenshooter {
        struct weston_compositor *ec;
@@ -142,7 +143,8 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t 
time,
        struct weston_output *output;
        struct screenshooter *shooter = data;
        struct weston_recorder *recorder = shooter->recorder;;
-       static const char filename[] = "capture.wcap";
+       char filename[256], timestr[128];
+       int ret;

        if (recorder) {
                weston_recorder_stop(recorder);
@@ -154,6 +156,15 @@ recorder_binding(struct weston_keyboard *keyboard, 
uint32_t time,
                        output = container_of(ec->output_list.next,
                                              struct weston_output, link);

+               if (current_time_str(timestr, sizeof(timestr),
+                                    "%F_%H-%M-%S") < 0)
+                       return;
+
+               ret = snprintf(filename, sizeof(filename),
+                              "capture-%s.wcap", timestr);
+               if (ret < 0 || (size_t)ret >= sizeof(filename))
+                       return;
+
                shooter->recorder = weston_recorder_start(output, filename);
        }
 }
--
2.7.4

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to