mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +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:
committed by
Carlos R. Mafra
parent
61a96e79c4
commit
1a0c8afa80
1
TODO
1
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
|
||||
|
||||
|
||||
13
configure.ac
13
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)
|
||||
|
||||
@@ -117,8 +117,7 @@ wmaker_LDADD = \
|
||||
@XLFLAGS@ \
|
||||
@XFTLIBS@ \
|
||||
@XLIBS@ \
|
||||
@INTLIBS@ \
|
||||
@DLLIBS@
|
||||
@INTLIBS@
|
||||
|
||||
LIBTOOL = $(SHELL) $(top_srcdir)/libtool $(LIBTOOL_ARG)
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -24,12 +24,6 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#ifdef TEXTURE_PLUGIN
|
||||
# ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -47,10 +47,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#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;
|
||||
|
||||
Reference in New Issue
Block a user