summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/screenshot.c
diff options
context:
space:
mode:
authorquinn <quinn@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-12 04:01:29 +0000
committerquinn <quinn@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-12 04:01:29 +0000
commitac4d8efa81d2b46f47c06e01513ac706bb9e9f30 (patch)
treee5933598c4397a47fa6c561250bf9dfd89f308ca /beryl-plugins/src/screenshot.c
parent31fd35e3b5ea2de448bd7e27a2839051f4fee6c7 (diff)
downloadmarex-dev-ac4d8efa81d2b46f47c06e01513ac706bb9e9f30.tar.gz
marex-dev-ac4d8efa81d2b46f47c06e01513ac706bb9e9f30.tar.bz2
beryl-core:
-add extensible image loading from upstream -add svg, png plugins to default list - YOU MUST TURN THESE ON FOR NORMAL IMAGE LOADING, especially PNG! beryl-plugins: -add extensible image loading -add hiding of other windows in scale-current-app (only on active head) git-svn-id: file:///beryl/trunk@1681 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/screenshot.c')
-rw-r--r--beryl-plugins/src/screenshot.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/beryl-plugins/src/screenshot.c b/beryl-plugins/src/screenshot.c
index 3829ad8..2a31833 100644
--- a/beryl-plugins/src/screenshot.c
+++ b/beryl-plugins/src/screenshot.c
@@ -220,60 +220,46 @@ shotPaintScreen(CompScreen * s,
if (w && h) {
GLubyte *buffer;
char *dir =
- sd->opt[SHOT_DISPLAY_OPTION_DIR].value.
- s;
+ sd->opt[SHOT_DISPLAY_OPTION_DIR].value.
+ s;
buffer =
- malloc(sizeof(GLubyte) * w * h * 4);
+ malloc(sizeof(GLubyte) * w * h * 4);
if (buffer) {
struct dirent **namelist;
int n;
glReadPixels(x1, s->height - y2, w,
- h, GL_RGBA,
- GL_UNSIGNED_BYTE,
- (GLvoid *) buffer);
+ h, GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ (GLvoid *) buffer);
n = scandir(dir, &namelist,
- shotFilter, shotSort);
+ shotFilter, shotSort);
if (n >= 0) {
- char *name;
+ char name[256];
int number = 0;
if (n > 0)
sscanf(namelist
- [n -
- 1]->d_name,
- "screenshot%d.png",
- &number);
+ [n -
+ 1]->d_name,
+ "screenshot%d.png",
+ &number);
number++;
if (n)
free(namelist);
+ sprintf (name, "screenshot%d.png", number);
- name =
- malloc(strlen(dir) +
- 256);
- if (name) {
- sprintf(name,
- "%s/screenshot%d.png",
- dir,
- number);
-
- if (!writePngToFile
- (buffer, name,
- w, h, w * 4))
- fprintf
- (stderr,
- "%s: failed to write "
- "screenshot image",
- getProgramName
- ());
-
- free(name);
+ if (!writeImageToFile (s->display, dir, name, "png",
+ w, h, buffer))
+ {
+ fprintf (stderr, "%s: failed to write "
+ "screenshot image", getProgramName());
}
- } else {
+ } else {
perror(dir);
}