From 1a0c8afa80e332fd23d23bf1c657a5bf3b6f0b73 Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Sun, 21 Mar 2010 14:14:07 +0100 Subject: [PATCH] Remove texture plugins - leave a note for the unlikely case of such configuration being found, the user is notified properly --- TODO | 1 - configure.ac | 13 --------- src/Makefile.am | 3 +- src/defaults.c | 68 ++++--------------------------------------- src/texture.c | 88 +------------------------------------------------------- src/texture.h | 3 -- src/wconfig.h.in | 6 ---- util/Makefile.am | 4 +-- util/wmsetbg.c | 84 ++--------------------------------------------------- 9 files changed, 13 insertions(+), 257 deletions(-) diff --git a/TODO b/TODO index 81ef77c8..0a55c9e6 100644 --- a/TODO +++ b/TODO @@ -67,5 +67,4 @@ After 1.0.0 is released - rework/redesign the appicon/dock/clip concept - maybe rewrite the main code in obj-c or c++ - major clean up in theming/texturing stuff -- dynamically loadable everything diff --git a/configure.ac b/configure.ac index a4be3a6e..db019b7e 100644 --- a/configure.ac +++ b/configure.ac @@ -116,18 +116,6 @@ if test x"$_cv_HAVE_C99_VSNPRINTF" = x"yes"; then AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [define if you have vsnprintf with C99 semantics (set by configure)]) fi -dnl Loading of dynamic libraries at runtime -dnl ======================================= -DLLIBS="" - -AC_CHECK_FUNC(dlopen, [HAVEDL="yes"], - AC_CHECK_LIB(dl, dlopen, [DLLIBS="-ldl" HAVEDL="yes"], - DLLIBS="" )) - -if test "x$HAVEDL" = xyes; then - AC_CHECK_HEADERS(dlfcn.h) -fi - dnl Check for inotify dnl ================= AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify)) @@ -374,7 +362,6 @@ fi -AC_SUBST(DLLIBS) AC_SUBST(INTLIBS) AC_SUBST(NLSDIR) AC_SUBST(MOFILES) diff --git a/src/Makefile.am b/src/Makefile.am index 64c6fde4..90a6c134 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -117,8 +117,7 @@ wmaker_LDADD = \ @XLFLAGS@ \ @XFTLIBS@ \ @XLIBS@ \ - @INTLIBS@ \ - @DLLIBS@ + @INTLIBS@ LIBTOOL = $(SHELL) $(top_srcdir)/libtool $(LIBTOOL_ARG) diff --git a/src/defaults.c b/src/defaults.c index 4acf51a5..a02a03b1 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -36,10 +36,6 @@ #include #include -#ifdef HAVE_DLFCN_H -# include -#endif - #ifndef PATH_MAX #define PATH_MAX DEFAULT_PATH_MAX #endif @@ -1792,64 +1788,12 @@ static WTexture *parse_texture(WScreen * scr, WMPropList * pl) val = WMGetFromPLString(elem); texture = (WTexture *) wTextureMakeTGradient(scr, style, &color1, &color2, val, opacity); - } -#ifdef TEXTURE_PLUGIN - else if (strcasecmp(val, "function") == 0) { - WTexFunction *function; - void (*initFunc) (Display *, Colormap); - char *lib, *func, **argv; - int i, argc; - - if (nelem < 3) - return NULL; - - /* get the library name */ - elem = WMGetFromPLArray(pl, 1); - if (!elem || !WMIsPLString(elem)) { - return NULL; - } - lib = WMGetFromPLString(elem); - - /* get the function name */ - elem = WMGetFromPLArray(pl, 2); - if (!elem || !WMIsPLString(elem)) { - return NULL; - } - func = WMGetFromPLString(elem); - - argc = nelem - 2; - argv = (char **)wmalloc(argc * sizeof(char *)); - - /* get the parameters */ - argv[0] = wstrdup(func); - for (i = 0; i < argc - 1; i++) { - elem = WMGetFromPLArray(pl, 3 + i); - if (!elem || !WMIsPLString(elem)) { - wfree(argv); - - return NULL; - } - argv[i + 1] = wstrdup(WMGetFromPLString(elem)); - } - - function = wTextureMakeFunction(scr, lib, func, argc, argv); - -#ifdef HAVE_DLFCN_H - if (function) { - initFunc = dlsym(function->handle, "initWindowMaker"); - if (initFunc) { - initFunc(dpy, scr->w_colormap); - } else { - wwarning(_("could not initialize library %s"), lib); - } - } else { - wwarning(_("could not find function %s::%s"), lib, func); - } -#endif /* HAVE_DLFCN_H */ - texture = (WTexture *) function; - } -#endif /* TEXTURE_PLUGIN */ - else { + } else if (strcasecmp(val, "function") == 0) { + /* Leave this in to handle the unlikely case of + * someone actually having function textures configured */ + wwarning("function texture support has been removed"); + return NULL; + } else { wwarning(_("invalid texture type %s"), val); return NULL; } diff --git a/src/texture.c b/src/texture.c index 6414fd37..02157413 100644 --- a/src/texture.c +++ b/src/texture.c @@ -24,12 +24,6 @@ #include #include -#ifdef TEXTURE_PLUGIN -# ifdef HAVE_DLFCN_H -# include -# endif -#endif - #include #include #include @@ -160,21 +154,8 @@ void wTextureDestroy(WScreen * scr, WTexture * texture) case WTEX_TDGRADIENT: RReleaseImage(texture->tgradient.pixmap); break; - -#ifdef TEXTURE_PLUGIN - case WTEX_FUNCTION: -#ifdef HAVE_DLFCN_H - if (texture->function.handle) { - dlclose(texture->function.handle); - } -#endif - for (i = 0; i < texture->function.argc; i++) { - wfree(texture->function.argv[i]); - } - wfree(texture->function.argv); - break; -#endif /* TEXTURE_PLUGIN */ } + if (CANFREE(texture->any.color.pixel)) colors[count++] = texture->any.color.pixel; if (count > 0) { @@ -361,58 +342,6 @@ WTexTGradient *wTextureMakeTGradient(WScreen * scr, int style, RColor * from, RC return texture; } -#ifdef TEXTURE_PLUGIN -WTexFunction *wTextureMakeFunction(WScreen * scr, char *lib, char *func, int argc, char **argv) -{ - XColor fallbackColor; - XGCValues gcv; - WTexFunction *texture; - - texture = wmalloc(sizeof(WTexture)); - memset(&fallbackColor, 0, sizeof(fallbackColor)); - - texture->type = WTEX_FUNCTION; - texture->handle = NULL; - texture->render = 0; - texture->argc = argc; - texture->argv = argv; - - fallbackColor.red = 0x8000; - fallbackColor.green = 0x8000; - fallbackColor.blue = 0x8000; - - gcv.background = gcv.foreground = fallbackColor.pixel; - gcv.graphics_exposures = False; - texture->normal_gc = XCreateGC(dpy, scr->w_win, GCForeground | GCBackground | GCGraphicsExposures, &gcv); - -# ifdef HAVE_DLFCN_H - /* open the library */ - texture->handle = dlopen(lib, RTLD_LAZY); - if (!texture->handle) { - wwarning(_("library \"%s\" cound not be opened."), lib); - wfree(argv); - wfree(texture); - return NULL; - } - - /* find the function */ - texture->render = dlsym(texture->handle, func); - if (!texture->render) { - wwarning(_("function \"%s\" not found in library \"%s\""), func, lib); - wfree(argv); - dlclose(texture->handle); - wfree(texture); - return NULL; - } -# else - wwarning(_("function textures not supported on this system, sorry.")); -# endif - - /* success! */ - return texture; -} -#endif /* TEXTURE_PLUGIN */ - RImage *wTextureRenderImage(WTexture * texture, int width, int height, int relief) { RImage *image = NULL; @@ -513,21 +442,6 @@ RImage *wTextureRenderImage(WTexture * texture, int width, int height, int relie RReleaseImage(grad); } break; - -#ifdef TEXTURE_PLUGIN - case WTEX_FUNCTION: -#ifdef HAVE_DLFCN_H - if (texture->function.render) { - image = texture->function.render(texture->function.argc, texture->function.argv, - width, height, relief); - } -#endif - if (!image) { - RErrorCode = RERR_INTERNAL; - } - break; -#endif /* TEXTURE_PLUGIN */ - default: puts("ERROR in wTextureRenderImage()"); image = NULL; diff --git a/src/texture.h b/src/texture.h index 8a8063c7..73811450 100644 --- a/src/texture.h +++ b/src/texture.h @@ -166,9 +166,6 @@ WTexTGradient *wTextureMakeTGradient(WScreen*, int, RColor*, RColor*, char *, in WTexIGradient *wTextureMakeIGradient(WScreen*, int, RColor[], int, RColor[]); WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file, XColor *color); -#ifdef TEXTURE_PLUGIN -WTexFunction *wTextureMakeFunction(WScreen*, char *, char *, int, char **); -#endif void wTextureDestroy(WScreen*, WTexture*); void wTexturePaint(WTexture *, Pixmap *, WCoreWindow*, int, int); void wTextureRender(WScreen*, WTexture*, Pixmap*, int, int, int); diff --git a/src/wconfig.h.in b/src/wconfig.h.in index d3b38a53..1a3bd116 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -32,12 +32,6 @@ * Also check the features you can enable through configure. */ -/* - * #undefine if you dont want texture plugin support or your system have - * some sort of problem with them. - */ -#define TEXTURE_PLUGIN - /* If you want animations for iconification, shading, icon arrangement etc. */ #define ANIMATIONS diff --git a/util/Makefile.am b/util/Makefile.am index b21ba179..6305a411 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -49,13 +49,13 @@ wmagnify_LDADD = \ $(top_builddir)/WINGs/libWINGs.la \ $(top_builddir)/WINGs/libWUtil.la \ $(top_builddir)/wrlib/libwraster.la \ - @XFTLIBS@ @INTLIBS@ @DLLIBS@ + @XFTLIBS@ @INTLIBS@ wmsetbg_LDADD = \ $(top_builddir)/WINGs/libWINGs.la \ $(top_builddir)/WINGs/libWUtil.la \ $(top_builddir)/wrlib/libwraster.la \ - @XLFLAGS@ @XLIBS@ @XFTLIBS@ @INTLIBS@ @DLLIBS@ + @XLFLAGS@ @XLIBS@ @XFTLIBS@ @INTLIBS@ wmgenmenu_LDADD = \ $(top_builddir)/WINGs/libWUtil.la \ diff --git a/util/wmsetbg.c b/util/wmsetbg.c index 1037bf23..312e6195 100644 --- a/util/wmsetbg.c +++ b/util/wmsetbg.c @@ -47,10 +47,6 @@ # endif #endif -#ifdef HAVE_DLFCN_H -#include -#endif - #include "../src/wconfig.h" #ifndef GLOBAL_DEFAULTS_SUBDIR @@ -663,84 +659,10 @@ BackgroundTexture *parseTexture(RContext * rc, char *text) texture->pixmap = pixmap; } else if (strcasecmp(type, "function") == 0) { -#ifdef HAVE_DLFCN_H - void (*initFunc) (Display *, Colormap); - RImage *(*mainFunc) (int, char **, int, int, int); - Pixmap pixmap; - RImage *image = 0; - int success = 0; - char *lib, *func, **argv = 0; - void *handle = 0; - int i, argc; - - if (count < 3) - goto function_cleanup; - - /* get the library name */ - GETSTRORGOTO(val, lib, 1, function_cleanup); - - /* get the function name */ - GETSTRORGOTO(val, func, 2, function_cleanup); - - argc = count - 2; - argv = (char **)wmalloc(argc * sizeof(char *)); - - /* get the parameters */ - argv[0] = func; - for (i = 0; i < argc - 1; i++) { - GETSTRORGOTO(val, tmp, 3 + i, function_cleanup); - argv[i + 1] = wstrdup(tmp); - } - - handle = dlopen(lib, RTLD_LAZY); - if (!handle) { - wwarning("could not find library %s", lib); - goto function_cleanup; - } - - initFunc = dlsym(handle, "initWindowMaker"); - if (!initFunc) { - wwarning("could not initialize library %s", lib); - goto function_cleanup; - } - initFunc(dpy, DefaultColormap(dpy, scr)); - - mainFunc = dlsym(handle, func); - if (!mainFunc) { - wwarning("could not find function %s::%s", lib, func); - goto function_cleanup; - } - image = mainFunc(argc, argv, scrWidth, scrHeight, 0); - - if (!RConvertImage(rc, image, &pixmap)) { - wwarning("could not convert texture:%s", RMessageForError(RErrorCode)); - goto function_cleanup; - } - texture->width = scrWidth; - texture->height = scrHeight; - texture->pixmap = pixmap; - success = 1; - - function_cleanup: - if (argv) { - int i; - for (i = 0; i < argc; i++) { - wfree(argv[i]); - } - } - if (handle) { - dlclose(handle); - } - if (image) { - RReleaseImage(image); - } - if (!success) { - goto error; - } -#else - wwarning("function textures not supported"); + /* Leave this in to handle the unlikely case of + * someone actually having function textures configured */ + wwarning("function texture support has been removed"); goto error; -#endif } else { wwarning("invalid texture type %s", text); goto error; -- 2.11.4.GIT