From 4d2e730bfabb01af2b3abc3c7202fc99fcc9ddb1 Mon Sep 17 00:00:00 2001 From: fryshorts Date: Sun, 21 Dec 2014 22:54:54 +0100 Subject: [PATCH] linux-capture: Remove XLib based shm helpers Remove the old XLib based shm helper functions from xhelpers. --- plugins/linux-capture/xhelpers.c | 58 ------------------------------ plugins/linux-capture/xhelpers.h | 26 -------------- plugins/linux-capture/xshm-input.c | 4 +-- 3 files changed, 2 insertions(+), 86 deletions(-) diff --git a/plugins/linux-capture/xhelpers.c b/plugins/linux-capture/xhelpers.c index 1604a107e..2bd769067 100644 --- a/plugins/linux-capture/xhelpers.c +++ b/plugins/linux-capture/xhelpers.c @@ -91,64 +91,6 @@ fail: return -1; } -xshm_t *xshm_attach(Display *dpy, Screen *screen, - int_fast32_t w, int_fast32_t h) -{ - if (!dpy || !screen) - return NULL; - - xshm_t *xshm = bzalloc(sizeof(xshm_t)); - - xshm->dpy = dpy; - xshm->image = XShmCreateImage(xshm->dpy, DefaultVisualOfScreen(screen), - DefaultDepthOfScreen(screen), ZPixmap, NULL, &xshm->info, - w, h); - if (!xshm->image) - goto fail; - - xshm->info.shmid = shmget(IPC_PRIVATE, - xshm->image->bytes_per_line * xshm->image->height, - IPC_CREAT | 0700); - if (xshm->info.shmid < 0) - goto fail; - - xshm->info.shmaddr - = xshm->image->data - = (char *) shmat(xshm->info.shmid, 0, 0); - if (xshm->info.shmaddr == (char *) -1) - goto fail; - xshm->info.readOnly = false; - - if (!XShmAttach(xshm->dpy, &xshm->info)) - goto fail; - - xshm->attached = true; - return xshm; -fail: - xshm_detach(xshm); - return NULL; -} - -void xshm_detach(xshm_t *xshm) -{ - if (!xshm) - return; - - if (xshm->attached) - XShmDetach(xshm->dpy, &xshm->info); - - if (xshm->info.shmaddr != (char *) -1) - shmdt(xshm->info.shmaddr); - - if (xshm->info.shmid != -1) - shmctl(xshm->info.shmid, IPC_RMID, NULL); - - if (xshm->image) - XDestroyImage(xshm->image); - - bfree(xshm); -} - xcb_shm_t* xshm_xcb_attach(xcb_connection_t *xcb, const int w, const int h) { if (!xcb) diff --git a/plugins/linux-capture/xhelpers.h b/plugins/linux-capture/xhelpers.h index 8b7f9b91a..50b1e4986 100644 --- a/plugins/linux-capture/xhelpers.h +++ b/plugins/linux-capture/xhelpers.h @@ -22,18 +22,10 @@ extern "C" { #endif #include -#include #include #include #include -typedef struct { - XShmSegmentInfo info; - XImage *image; - Display *dpy; - bool attached; -} xshm_t; - typedef struct { xcb_connection_t *xcb; xcb_shm_seg_t seg; @@ -87,24 +79,6 @@ int_fast32_t xinerama_screen_geo(Display *dpy, const int_fast32_t screen, int_fast32_t x11_screen_geo(Display *dpy, const int_fast32_t screen, int_fast32_t *w, int_fast32_t *h); -/** - * Attach a shared memory segment to the X-Server - * - * @param dpy X11 Display - * @param screen X11 Screen - * @param w width for the shared memory segment - * @param h height for the shared memory segment - * - * @return NULL on error - */ -xshm_t *xshm_attach(Display *dpy, Screen *screen, - int_fast32_t w, int_fast32_t h); - -/** - * Detach a shared memory segment - */ -void xshm_detach(xshm_t *xshm); - /** * Attach a shared memory segment to the X-Server * diff --git a/plugins/linux-capture/xshm-input.c b/plugins/linux-capture/xshm-input.c index 6fb4e9bcd..dd290e5b7 100644 --- a/plugins/linux-capture/xshm-input.c +++ b/plugins/linux-capture/xshm-input.c @@ -18,8 +18,8 @@ along with this program. If not, see . #include #include #include -#include -#include +//#include +//#include #include #include #include