[PATCH spice-gtk 3/4] spicy-screenshot: Returns success only if image is grabbed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 tools/spicy-screenshot.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/spicy-screenshot.c b/tools/spicy-screenshot.c
index 0bfd3ca2..13b319d2 100644
--- a/tools/spicy-screenshot.c
+++ b/tools/spicy-screenshot.c
@@ -33,6 +33,8 @@ enum SpiceSurfaceFmt d_format;
 gint                 d_width, d_height, d_stride;
 gpointer             d_data;
 
+static bool image_grabbed = false;
+
 /* ------------------------------------------------------------------ */
 
 static void primary_create(SpiceChannel *channel, gint format,
@@ -93,8 +95,10 @@ static void invalidate(SpiceChannel *channel,
         rc = -1;
         break;
     }
-    if (rc == 0)
+    if (rc == 0) {
         fprintf(stderr, "wrote screen shot to %s\n", outf);
+        image_grabbed = true;
+    }
     g_main_loop_quit(mainloop);
 }
 
@@ -190,5 +194,5 @@ int main(int argc, char *argv[])
     }
 
     g_main_loop_run(mainloop);
-    return 0;
+    return image_grabbed ? 0 : 1;
 }
-- 
2.17.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]