/* XCreateSimpleWindow intercept hack */ Window XCreateSimpleWindow(Display *dpy, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, unsigned long border, unsigned long background) { static CSWF *func = NULL; char *env; Window id; /* find the real Xlib and the real X function */ if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); if (!func) func = (CSWF *) dlsym(lib_xlib, "XCreateSimpleWindow"); if (parent == DefaultRootWindow(dpy)) parent = MyRoot(dpy); id = (*func) (dpy, parent, x, y, width, height, border_width, border, background); if (id) { if ((env = getenv("_SWM_WS")) != NULL) set_property(dpy, id, "_SWM_WS", env); if ((env = getenv("_SWM_PID")) != NULL) set_property(dpy, id, "_SWM_PID", env); if ((env = getenv("_SWM_XTERM_FONTADJ")) != NULL) { unsetenv("_SWM_XTERM_FONTADJ"); xterm = 1; } } return (id); }
/* XReparentWindow intercept hack */ int XReparentWindow(Display *dpy, Window window, Window parent, int x, int y) { static RWF *func = NULL; /* find the real Xlib and the real X function */ if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); if (!func) func = (RWF *) dlsym(lib_xlib, "XReparentWindow"); if (parent == DefaultRootWindow(dpy)) parent = MyRoot(dpy); return (*func) (dpy, window, parent, x, y); }
/* XReparentWindow intercept hack */ int XReparentWindow(Display *dpy, Window window, Window parent, int x, int y) { static RWF *func = NULL; if (lib_xlib == NULL) lib_xlib = DLOPEN("libX11.so"); if (lib_xlib && func == NULL) func = (RWF *) dlsym(lib_xlib, "XReparentWindow"); if (func == NULL) { fprintf(stderr, "libswmhack.so: ERROR: %s\n", dlerror()); /* Xlib function always returns 1, so return 0 here. */ return 0; } if (parent == DefaultRootWindow(dpy)) parent = MyRoot(dpy); return (*func) (dpy, window, parent, x, y); }
/* XCreateWindow intercept hack */ Window XCreateWindow(Display *dpy, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int clss, Visual * visual, unsigned long valuemask, XSetWindowAttributes * attributes) { static CWF *func = NULL; char *env; Window id; if (lib_xlib == NULL) lib_xlib = DLOPEN("libX11.so"); if (lib_xlib && func == NULL) { func = (CWF *) dlsym(lib_xlib, "XCreateWindow"); display = dpy; } if (func == NULL) { fprintf(stderr, "libswmhack.so: ERROR: %s\n", dlerror()); return None; } if (parent == DefaultRootWindow(dpy)) parent = MyRoot(dpy); id = (*func) (dpy, parent, x, y, width, height, border_width, depth, clss, visual, valuemask, attributes); if (id) { if ((env = getenv("_SWM_WS")) != NULL) set_property(dpy, id, "_SWM_WS", env); if ((env = getenv("_SWM_PID")) != NULL) set_property(dpy, id, "_SWM_PID", env); if ((env = getenv("_SWM_XTERM_FONTADJ")) != NULL) { unsetenv("_SWM_XTERM_FONTADJ"); xterm = true; } } return (id); }
/* XCreateSimpleWindow intercept hack */ Window XCreateSimpleWindow(Display *dpy, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, unsigned long border, unsigned long background) { static CSWF *func = NULL; char *env; Window id; if (lib_xlib == NULL) lib_xlib = DLOPEN("libX11.so"); if (lib_xlib && func == NULL) func = (CSWF *) dlsym(lib_xlib, "XCreateSimpleWindow"); if (func == NULL) { fprintf(stderr, "libswmhack.so: ERROR: %s\n", dlerror()); return None; } if (parent == DefaultRootWindow(dpy)) parent = MyRoot(dpy); id = (*func) (dpy, parent, x, y, width, height, border_width, border, background); if (id) { if ((env = getenv("_SWM_WS")) != NULL) set_property(dpy, id, "_SWM_WS", env); if ((env = getenv("_SWM_PID")) != NULL) set_property(dpy, id, "_SWM_PID", env); if ((env = getenv("_SWM_XTERM_FONTADJ")) != NULL) { unsetenv("_SWM_XTERM_FONTADJ"); xterm = true; } } return (id); }
/* XCreateWindow intercept hack */ Window XCreateWindow(Display *dpy, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int clss, Visual * visual, unsigned long valuemask, XSetWindowAttributes * attributes) { static CWF *func = NULL; char *env; Window id; /* find the real Xlib and the real X function */ if (!lib_xlib) lib_xlib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); if (!func) { func = (CWF *) dlsym(lib_xlib, "XCreateWindow"); display = dpy; } if (parent == DefaultRootWindow(dpy)) parent = MyRoot(dpy); id = (*func) (dpy, parent, x, y, width, height, border_width, depth, clss, visual, valuemask, attributes); if (id) { if ((env = getenv("_SWM_WS")) != NULL) set_property(dpy, id, "_SWM_WS", env); if ((env = getenv("_SWM_PID")) != NULL) set_property(dpy, id, "_SWM_PID", env); if ((env = getenv("_SWM_XTERM_FONTADJ")) != NULL) { unsetenv("_SWM_XTERM_FONTADJ"); xterm = 1; } } return (id); }