From 4843a839bc94633584919c4dc744f4fdc652b1b6 Mon Sep 17 00:00:00 2001 From: David Reveman Date: Tue, 24 May 2011 18:22:46 +0200 Subject: [PATCH libX11] Allow disabling of individual extensions. Allow the user to specify thru environment variables XLIB_SKIP_EXT_ which extensions will not be seen by XQueryExtension(). There have been occasions where this has helped to get users over issues with some poorly written closed source applications which could not be fixed otherwise. Signed-off-by: Egbert Eich --- src/QuExt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/QuExt.c b/src/QuExt.c index 4e230e7..1bc6265 100644 --- a/src/QuExt.c +++ b/src/QuExt.c @@ -40,6 +40,24 @@ XQueryExtension( xQueryExtensionReply rep; register xQueryExtensionReq *req; +#define PREFIX "XLIB_SKIP_EXT_" +#define PREFLEN (sizeof(PREFIX)) + + if (name) { + char var[256 + PREFLEN]; + int i; + + strcpy(var, PREFIX); + for (i = 0; name[i] && (i < 255); i++) + var[i + PREFLEN - 1] = (name[i] == '-') ? '_' : name[i]; + var[i + PREFLEN - 1] = '\0'; + + if (getenv(var)) + return False; + } +#undef PREFIX +#undef PREFLEN + LockDisplay(dpy); GetReq(QueryExtension, req); req->nbytes = name ? strlen(name) : 0; -- 1.8.1.4