1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

Remove texture plugins

- leave a note for the unlikely case of such configuration being found,
  the user is notified properly
This commit is contained in:
Tamas TEVESZ
2010-03-21 14:14:07 +01:00
committed by Carlos R. Mafra
parent 61a96e79c4
commit 1a0c8afa80
9 changed files with 13 additions and 257 deletions

1
TODO
View File

@@ -67,5 +67,4 @@ After 1.0.0 is released
- rework/redesign the appicon/dock/clip concept - rework/redesign the appicon/dock/clip concept
- maybe rewrite the main code in obj-c or c++ - maybe rewrite the main code in obj-c or c++
- major clean up in theming/texturing stuff - major clean up in theming/texturing stuff
- dynamically loadable everything

View File

@@ -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)]) AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [define if you have vsnprintf with C99 semantics (set by configure)])
fi 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 Check for inotify
dnl ================= dnl =================
AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify)) 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(INTLIBS)
AC_SUBST(NLSDIR) AC_SUBST(NLSDIR)
AC_SUBST(MOFILES) AC_SUBST(MOFILES)

View File

@@ -117,8 +117,7 @@ wmaker_LDADD = \
@XLFLAGS@ \ @XLFLAGS@ \
@XFTLIBS@ \ @XFTLIBS@ \
@XLIBS@ \ @XLIBS@ \
@INTLIBS@ \ @INTLIBS@
@DLLIBS@
LIBTOOL = $(SHELL) $(top_srcdir)/libtool $(LIBTOOL_ARG) LIBTOOL = $(SHELL) $(top_srcdir)/libtool $(LIBTOOL_ARG)

View File

@@ -36,10 +36,6 @@
#include <limits.h> #include <limits.h>
#include <signal.h> #include <signal.h>
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#ifndef PATH_MAX #ifndef PATH_MAX
#define PATH_MAX DEFAULT_PATH_MAX #define PATH_MAX DEFAULT_PATH_MAX
#endif #endif
@@ -1792,64 +1788,12 @@ static WTexture *parse_texture(WScreen * scr, WMPropList * pl)
val = WMGetFromPLString(elem); val = WMGetFromPLString(elem);
texture = (WTexture *) wTextureMakeTGradient(scr, style, &color1, &color2, val, opacity); texture = (WTexture *) wTextureMakeTGradient(scr, style, &color1, &color2, val, opacity);
} } else if (strcasecmp(val, "function") == 0) {
#ifdef TEXTURE_PLUGIN /* Leave this in to handle the unlikely case of
else if (strcasecmp(val, "function") == 0) { * someone actually having function textures configured */
WTexFunction *function; wwarning("function texture support has been removed");
void (*initFunc) (Display *, Colormap);
char *lib, *func, **argv;
int i, argc;
if (nelem < 3)
return NULL; 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 { } 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 {
wwarning(_("invalid texture type %s"), val); wwarning(_("invalid texture type %s"), val);
return NULL; return NULL;
} }

View File

@@ -24,12 +24,6 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#ifdef TEXTURE_PLUGIN
# ifdef HAVE_DLFCN_H
# include <dlfcn.h>
# endif
#endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -160,21 +154,8 @@ void wTextureDestroy(WScreen * scr, WTexture * texture)
case WTEX_TDGRADIENT: case WTEX_TDGRADIENT:
RReleaseImage(texture->tgradient.pixmap); RReleaseImage(texture->tgradient.pixmap);
break; 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)) if (CANFREE(texture->any.color.pixel))
colors[count++] = texture->any.color.pixel; colors[count++] = texture->any.color.pixel;
if (count > 0) { if (count > 0) {
@@ -361,58 +342,6 @@ WTexTGradient *wTextureMakeTGradient(WScreen * scr, int style, RColor * from, RC
return texture; 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 *wTextureRenderImage(WTexture * texture, int width, int height, int relief)
{ {
RImage *image = NULL; RImage *image = NULL;
@@ -513,21 +442,6 @@ RImage *wTextureRenderImage(WTexture * texture, int width, int height, int relie
RReleaseImage(grad); RReleaseImage(grad);
} }
break; 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: default:
puts("ERROR in wTextureRenderImage()"); puts("ERROR in wTextureRenderImage()");
image = NULL; image = NULL;

View File

@@ -166,9 +166,6 @@ WTexTGradient *wTextureMakeTGradient(WScreen*, int, RColor*, RColor*, char *, in
WTexIGradient *wTextureMakeIGradient(WScreen*, int, RColor[], int, RColor[]); WTexIGradient *wTextureMakeIGradient(WScreen*, int, RColor[], int, RColor[]);
WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file, WTexPixmap *wTextureMakePixmap(WScreen *scr, int style, char *pixmap_file,
XColor *color); XColor *color);
#ifdef TEXTURE_PLUGIN
WTexFunction *wTextureMakeFunction(WScreen*, char *, char *, int, char **);
#endif
void wTextureDestroy(WScreen*, WTexture*); void wTextureDestroy(WScreen*, WTexture*);
void wTexturePaint(WTexture *, Pixmap *, WCoreWindow*, int, int); void wTexturePaint(WTexture *, Pixmap *, WCoreWindow*, int, int);
void wTextureRender(WScreen*, WTexture*, Pixmap*, int, int, int); void wTextureRender(WScreen*, WTexture*, Pixmap*, int, int, int);

View File

@@ -32,12 +32,6 @@
* Also check the features you can enable through configure. * 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. */ /* If you want animations for iconification, shading, icon arrangement etc. */
#define ANIMATIONS #define ANIMATIONS

View File

@@ -49,13 +49,13 @@ wmagnify_LDADD = \
$(top_builddir)/WINGs/libWINGs.la \ $(top_builddir)/WINGs/libWINGs.la \
$(top_builddir)/WINGs/libWUtil.la \ $(top_builddir)/WINGs/libWUtil.la \
$(top_builddir)/wrlib/libwraster.la \ $(top_builddir)/wrlib/libwraster.la \
@XFTLIBS@ @INTLIBS@ @DLLIBS@ @XFTLIBS@ @INTLIBS@
wmsetbg_LDADD = \ wmsetbg_LDADD = \
$(top_builddir)/WINGs/libWINGs.la \ $(top_builddir)/WINGs/libWINGs.la \
$(top_builddir)/WINGs/libWUtil.la \ $(top_builddir)/WINGs/libWUtil.la \
$(top_builddir)/wrlib/libwraster.la \ $(top_builddir)/wrlib/libwraster.la \
@XLFLAGS@ @XLIBS@ @XFTLIBS@ @INTLIBS@ @DLLIBS@ @XLFLAGS@ @XLIBS@ @XFTLIBS@ @INTLIBS@
wmgenmenu_LDADD = \ wmgenmenu_LDADD = \
$(top_builddir)/WINGs/libWUtil.la \ $(top_builddir)/WINGs/libWUtil.la \

View File

@@ -47,10 +47,6 @@
# endif # endif
#endif #endif
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include "../src/wconfig.h" #include "../src/wconfig.h"
#ifndef GLOBAL_DEFAULTS_SUBDIR #ifndef GLOBAL_DEFAULTS_SUBDIR
@@ -663,84 +659,10 @@ BackgroundTexture *parseTexture(RContext * rc, char *text)
texture->pixmap = pixmap; texture->pixmap = pixmap;
} else if (strcasecmp(type, "function") == 0) { } else if (strcasecmp(type, "function") == 0) {
#ifdef HAVE_DLFCN_H /* Leave this in to handle the unlikely case of
void (*initFunc) (Display *, Colormap); * someone actually having function textures configured */
RImage *(*mainFunc) (int, char **, int, int, int); wwarning("function texture support has been removed");
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; goto error;
}
#else
wwarning("function textures not supported");
goto error;
#endif
} else { } else {
wwarning("invalid texture type %s", text); wwarning("invalid texture type %s", text);
goto error; goto error;