[Spice-commits] 4 commits - tools/spicy-screenshot.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Dec 20 08:29:41 UTC 2018
tools/spicy-screenshot.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
New commits:
commit ae2422d796f926e42294c016707c17e07dbc47c0
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed Dec 19 11:50:59 2018 +0000
spicy-screenshot: Make some variables static
Not used outside this module.
Also update indentation.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Snir Sheriber <ssheribe at redhat.com>
diff --git a/tools/spicy-screenshot.c b/tools/spicy-screenshot.c
index 13b319d..97bd4da 100644
--- a/tools/spicy-screenshot.c
+++ b/tools/spicy-screenshot.c
@@ -29,9 +29,9 @@ static gboolean version = FALSE;
static SpiceSession *session;
static GMainLoop *mainloop;
-enum SpiceSurfaceFmt d_format;
-gint d_width, d_height, d_stride;
-gpointer d_data;
+static enum SpiceSurfaceFmt d_format;
+static gint d_width, d_height, d_stride;
+static gpointer d_data;
static bool image_grabbed = false;
commit e64b221a3eded892f6ca59c6487cf11ab4b1bee2
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed Dec 19 11:50:23 2018 +0000
spicy-screenshot: Returns success only if image is grabbed
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Snir Sheriber <ssheribe at redhat.com>
diff --git a/tools/spicy-screenshot.c b/tools/spicy-screenshot.c
index 0bfd3ca..13b319d 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;
}
commit dfd4c4853165ed22773684269e80907f6d5f35ef
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed Dec 19 11:49:47 2018 +0000
spicy-screenshot: Open output file as binary
On Windows this prevents LFs to be written as CR+LF.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Snir Sheriber <ssheribe at redhat.com>
diff --git a/tools/spicy-screenshot.c b/tools/spicy-screenshot.c
index 9d7aa34..0bfd3ca 100644
--- a/tools/spicy-screenshot.c
+++ b/tools/spicy-screenshot.c
@@ -53,7 +53,7 @@ static int write_ppm_32(void)
uint8_t *p;
int n;
- fp = fopen(outf,"w");
+ fp = fopen(outf,"wb");
if (NULL == fp) {
fprintf(stderr, "%s: can't open %s: %s\n", g_get_prgname(), outf, strerror(errno));
return -1;
commit 075439576d68dbb0bf73b744db618df99fbc6fd5
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed Dec 19 11:48:27 2018 +0000
spicy-screenshot: Fix indentation
Replace tabs with spaces
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Snir Sheriber <ssheribe at redhat.com>
diff --git a/tools/spicy-screenshot.c b/tools/spicy-screenshot.c
index 68f9335..9d7aa34 100644
--- a/tools/spicy-screenshot.c
+++ b/tools/spicy-screenshot.c
@@ -55,8 +55,8 @@ static int write_ppm_32(void)
fp = fopen(outf,"w");
if (NULL == fp) {
- fprintf(stderr, "%s: can't open %s: %s\n", g_get_prgname(), outf, strerror(errno));
- return -1;
+ fprintf(stderr, "%s: can't open %s: %s\n", g_get_prgname(), outf, strerror(errno));
+ return -1;
}
fprintf(fp, "P6\n%d %d\n255\n",
d_width, d_height);
More information about the Spice-commits
mailing list