Misc #204: Add glx_take_screenshot() & others

- Add glx_take_screenshot() for taking a screenshot. With ImageMagick
  the output data could be viewed in this way:

    display -size [SCREEN-WIDTH]x[SCREEN-HEIGHT] -depth 8 -flip
    rgb:[PATH]

  (#204)

- Add D-Bus command `opts_get string:paint_on_overlay_id` to get X
  Composite overlay window ID. (#204)

- Code cleanup.
This commit is contained in:
Richard Grenville
2014-09-07 18:58:09 +08:00
parent c5f45c8e3c
commit 8c88b4d6f1
4 changed files with 105 additions and 25 deletions

View File

@ -1411,6 +1411,20 @@ xr_blur_dst(session_t *ps, Picture tgt_buffer,
return true;
}
/*
* WORK-IN-PROGRESS!
static void
xr_take_screenshot(session_t *ps) {
XImage *img = XGetImage(ps->dpy, get_tgt_window(ps), 0, 0,
ps->root_width, ps->root_height, AllPlanes, XYPixmap);
if (!img) {
printf_errf("(): Failed to get XImage.");
return NULL;
}
assert(0 == img->xoffset);
}
*/
/**
* Blur the background of a window.
*/
@ -7530,6 +7544,16 @@ session_destroy(session_t *ps) {
ps_g = NULL;
}
/*
static inline void
dump_img(session_t *ps) {
int len = 0;
unsigned char *d = glx_take_screenshot(ps, &len);
write_binary_data("/tmp/dump.raw", d, len);
free(d);
}
*/
/**
* Do the actual work.
*