summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/getzpixmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop/src/getzpixmap.c')
-rw-r--r--recordmydesktop/src/getzpixmap.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/recordmydesktop/src/getzpixmap.c b/recordmydesktop/src/getzpixmap.c
index 6deaf15..38ef42d 100644
--- a/recordmydesktop/src/getzpixmap.c
+++ b/recordmydesktop/src/getzpixmap.c
@@ -59,3 +59,45 @@ int GetZPixmap(Display *dpy,
return 0;
}
+int GetZPixmapSHM(Display *dpy,
+ Window root,
+ XShmSegmentInfo *shminfo,
+ int shm_opcode,
+ char *data,
+ int x,
+ int y,
+ int width,
+ int height){
+ xShmGetImageReply reply;
+ xShmGetImageReq *request=NULL;
+ long nbytes;
+
+ LockDisplay(dpy);
+ GetReq(ShmGetImage,request);
+
+ request->reqType=shm_opcode;
+ request->shmReqType=X_ShmGetImage;
+ request->shmseg=shminfo->shmseg;
+
+ request->drawable=root;
+ request->x=x;
+ request->y=y;
+ request->width=width;
+ request->height=height;
+ request->planeMask=AllPlanes;
+ request->format=ZPixmap;
+ request->offset=data-shminfo->shmaddr;
+
+ if((!_XReply(dpy,(xReply *)&reply,0,xFalse))||(!reply.length)){
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return 1;
+ }
+
+ nbytes=(long)reply.length << 2;
+ _XReadPad(dpy,data,nbytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return 0;
+}
© All Rights Reserved