summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2018-02-05 17:09:47 +0100
committerKim Woelders <kim@woelders.dk>2018-02-10 10:30:16 +0100
commit096316b47634077f1f97d7191622753d22616764 (patch)
treec50baa01adbe76d17ac1b56f790d47f27462623b
parentc975dab9cd06b46a11c86dbed278b52ccaf4d8d7 (diff)
downloadimlib2-096316b47634077f1f97d7191622753d22616764.tar.gz
Introduce IMLIB2_SHM_OPT to enable overriding/testing SHM modes
-rw-r--r--src/lib/ximage.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/ximage.c b/src/lib/ximage.c
index 46b7eee..e54c7c2 100644
--- a/src/lib/ximage.c
+++ b/src/lib/ximage.c
@@ -44,6 +44,9 @@ TmpXError(Display * d, XErrorEvent * ev)
static void
ShmCheck(Display * d)
{
+ const char *s;
+ int val;
+
/* if its there set x_does_shm flag */
if (XShmQueryExtension(d))
{
@@ -63,6 +66,21 @@ ShmCheck(Display * d)
else
{
x_does_shm = 0;
+ return;
+ }
+
+ /* Modify SHM handling if requested */
+ s = getenv("IMLIB2_SHM_OPT");
+ if (s)
+ {
+ val = atoi(s);
+ if (val == 0)
+ x_does_shm = x_does_shm_fd = 0; /* Disable SHM entirely */
+ else if (val == 1)
+ x_does_shm_fd = 0; /* Disable SHM-FD */
+
+ printf("%s: x_does_shm=%d x_does_shm_fd=%d\n", __func__,
+ x_does_shm, x_does_shm_fd);
}
}