mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Texture plugin update
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
DisableMiniwindows = NO;
|
||||||
OpenTransientOnOwnerWorkspace = NO;
|
OpenTransientOnOwnerWorkspace = NO;
|
||||||
EdgeResistance = 30;
|
EdgeResistance = 30;
|
||||||
IconificationStyle = Zoom;
|
IconificationStyle = Zoom;
|
||||||
@@ -54,9 +55,9 @@
|
|||||||
IconPosition = "blh";
|
IconPosition = "blh";
|
||||||
WrapMenus = NO;
|
WrapMenus = NO;
|
||||||
ScrollableMenus = YES;
|
ScrollableMenus = YES;
|
||||||
MenuScrollSpeed = medium;
|
MenuScrollSpeed = fast;
|
||||||
IconSlideSpeed = medium;
|
IconSlideSpeed = fast;
|
||||||
ShadeSpeed = medium;
|
ShadeSpeed = fast;
|
||||||
DoubleClickTime = 250;
|
DoubleClickTime = 250;
|
||||||
AlignSubmenus = NO;
|
AlignSubmenus = NO;
|
||||||
NoWindowOverIcons = NO;
|
NoWindowOverIcons = NO;
|
||||||
|
|||||||
@@ -34,6 +34,12 @@
|
|||||||
#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
|
||||||
@@ -1860,7 +1866,8 @@ parse_texture(WScreen *scr, proplist_t pl)
|
|||||||
}
|
}
|
||||||
#ifdef TEXTURE_PLUGIN
|
#ifdef TEXTURE_PLUGIN
|
||||||
else if (strcasecmp(val, "function")==0) {
|
else if (strcasecmp(val, "function")==0) {
|
||||||
|
WTexFunction *function;
|
||||||
|
void (*initFunc) (Display *, Colormap);
|
||||||
char *lib, *func, **argv;
|
char *lib, *func, **argv;
|
||||||
int i, argc;
|
int i, argc;
|
||||||
|
|
||||||
@@ -1881,20 +1888,36 @@ parse_texture(WScreen *scr, proplist_t pl)
|
|||||||
}
|
}
|
||||||
func = PLGetString(elem);
|
func = PLGetString(elem);
|
||||||
|
|
||||||
argc = nelem - 3;
|
argc = nelem - 2;
|
||||||
argv = (char **) wmalloc (argc * sizeof (char *));
|
argv = (char **)wmalloc(argc * sizeof(char *));
|
||||||
|
|
||||||
/* get the parameters */
|
/* get the parameters */
|
||||||
for (i=0; i<argc; i++) {
|
argv[0] = wstrdup(func);
|
||||||
elem = PLGetArrayElement(pl, 3+i);
|
for (i = 0; i < argc - 1; i++) {
|
||||||
|
elem = PLGetArrayElement(pl, 3 + i);
|
||||||
if (!elem || !PLIsString(elem)) {
|
if (!elem || !PLIsString(elem)) {
|
||||||
free (argv);
|
free(argv);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
argv[i] = PLGetString(elem);
|
argv[i+1] = wstrdup(PLGetString(elem));
|
||||||
}
|
}
|
||||||
|
|
||||||
texture = (WTexture*)wTextureMakeFunction(scr, lib, func, argc, argv);
|
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 */
|
#endif /* TEXTURE_PLUGIN */
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -188,10 +188,13 @@ wTextureDestroy(WScreen *scr, WTexture *texture)
|
|||||||
case WTEX_FUNCTION:
|
case WTEX_FUNCTION:
|
||||||
#ifdef HAVE_DLFCN_H
|
#ifdef HAVE_DLFCN_H
|
||||||
if (texture->function.handle) {
|
if (texture->function.handle) {
|
||||||
dlclose (texture->function.handle);
|
dlclose(texture->function.handle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
free (texture->function.argv);
|
for (i = 0; i < texture->function.argc; i++) {
|
||||||
|
free(texture->function.argv[i]);
|
||||||
|
}
|
||||||
|
free(texture->function.argv);
|
||||||
break;
|
break;
|
||||||
#endif /* TEXTURE_PLUGIN */
|
#endif /* TEXTURE_PLUGIN */
|
||||||
}
|
}
|
||||||
@@ -374,7 +377,10 @@ wTextureMakeTGradient(WScreen *scr, int style, RColor *from, RColor *to,
|
|||||||
WTexFunction*
|
WTexFunction*
|
||||||
wTextureMakeFunction(WScreen *scr, char *lib, char *func, int argc, char **argv)
|
wTextureMakeFunction(WScreen *scr, char *lib, char *func, int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
XColor fallbackColor;
|
||||||
|
XGCValues gcv;
|
||||||
WTexFunction *texture;
|
WTexFunction *texture;
|
||||||
|
|
||||||
texture = wmalloc(sizeof(WTexture));
|
texture = wmalloc(sizeof(WTexture));
|
||||||
texture->type = WTEX_FUNCTION;
|
texture->type = WTEX_FUNCTION;
|
||||||
texture->handle = NULL;
|
texture->handle = NULL;
|
||||||
@@ -382,7 +388,16 @@ wTextureMakeFunction(WScreen *scr, char *lib, char *func, int argc, char **argv)
|
|||||||
texture->argc = argc;
|
texture->argc = argc;
|
||||||
texture->argv = argv;
|
texture->argv = argv;
|
||||||
|
|
||||||
#ifdef HAVE_DLFCN_H
|
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 */
|
/* open the library */
|
||||||
texture->handle = dlopen(lib, RTLD_LAZY);
|
texture->handle = dlopen(lib, RTLD_LAZY);
|
||||||
if (!texture->handle) {
|
if (!texture->handle) {
|
||||||
@@ -393,17 +408,17 @@ wTextureMakeFunction(WScreen *scr, char *lib, char *func, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* find the function */
|
/* find the function */
|
||||||
texture->render = dlsym (texture->handle, func);
|
texture->render = dlsym(texture->handle, func);
|
||||||
if (!texture->render) {
|
if (!texture->render) {
|
||||||
wwarning(_("function \"%s\" not founf in library \"%s\""), func, lib);
|
wwarning(_("function \"%s\" not found in library \"%s\""), func, lib);
|
||||||
free(argv);
|
free(argv);
|
||||||
dlclose(texture->handle);
|
dlclose(texture->handle);
|
||||||
free(texture);
|
free(texture);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
wwarning(_("function textures not supported on this system, sorry."));
|
wwarning(_("function textures not supported on this system, sorry."));
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/* success! */
|
/* success! */
|
||||||
return texture;
|
return texture;
|
||||||
@@ -519,6 +534,9 @@ wTextureRenderImage(WTexture *texture, int width, int height, int relief)
|
|||||||
width, height, relief);
|
width, height, relief);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (!image) {
|
||||||
|
RErrorCode = RERR_INTERNAL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* TEXTURE_PLUGIN */
|
#endif /* TEXTURE_PLUGIN */
|
||||||
|
|
||||||
@@ -529,8 +547,17 @@ wTextureRenderImage(WTexture *texture, int width, int height, int relief)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!image) {
|
if (!image) {
|
||||||
|
RColor gray;
|
||||||
|
|
||||||
wwarning(_("could not render texture: %s"), RMessageForError(RErrorCode));
|
wwarning(_("could not render texture: %s"), RMessageForError(RErrorCode));
|
||||||
return None;
|
|
||||||
|
image = RCreateImage(width, height, False);
|
||||||
|
|
||||||
|
gray.red = 190;
|
||||||
|
gray.green = 190;
|
||||||
|
gray.blue = 190;
|
||||||
|
gray.alpha = 255;
|
||||||
|
RClearImage(image, &gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user