1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00
This commit is contained in:
id
2000-12-09 01:21:52 +00:00
parent 2574e2e56a
commit 6ff939eb6e

View File

@@ -54,9 +54,9 @@ int getColor (const char *string, Colormap cmap, XColor *xcolor) {
} }
void void
initDrawPlainString(Display *dpy, Colormap cmap) { initDrawPlainString(Display *dpy, Colormap *cmap) {
ds_dpy = dpy; ds_dpy = dpy;
ds_cmap = cmap; ds_cmap = *cmap;
} }
void void
@@ -193,10 +193,10 @@ void initDrawFreeTypeString(proplist_t pl, void **init_data) {
WMFreeTypeData *data; WMFreeTypeData *data;
XColor xcolor; XColor xcolor;
_debug("invoke initDrawFreeTypeString with init_data[2] %s\n", init_data[2]); _debug("invoke initDrawFreeTypeString with init_data[3] %s\n", init_data[3]);
_debug("%x is ds_dpy\n", ds_dpy); _debug("%x is ds_dpy\n", ds_dpy);
initDrawPlainString((Display *)init_data[0], (Colormap)init_data[1]); initDrawPlainString((Display *)init_data[1], (Colormap *)init_data[2]);
_debug("then %x is ds_dpy\n", ds_dpy); _debug("then %x is ds_dpy\n", ds_dpy);
/* set init_data[2] to array of RImage */ /* set init_data[2] to array of RImage */
@@ -205,8 +205,8 @@ void initDrawFreeTypeString(proplist_t pl, void **init_data) {
* this would better to have sharable font system but * this would better to have sharable font system but
* I want to see this more in WINGs though -- ]d * I want to see this more in WINGs though -- ]d
*/ */
init_data[2] = malloc(sizeof(WMFreeTypeData)); init_data[3] = malloc(sizeof(WMFreeTypeData));
data = init_data[2]; data = init_data[3];
getColor(PLGetString(PLGetArrayElement(pl, 3)), ds_cmap, &xcolor); getColor(PLGetString(PLGetArrayElement(pl, 3)), ds_cmap, &xcolor);
data->color.red = xcolor.red >> 8; data->color.red = xcolor.red >> 8;
data->color.green = xcolor.green >> 8; data->color.green = xcolor.green >> 8;
@@ -243,7 +243,7 @@ destroyDrawFreeTypeString(proplist_t pl, void **func_data) {
int i; /* error? no no no */ int i; /* error? no no no */
WMFreeTypeData *data; WMFreeTypeData *data;
data = (WMFreeTypeData *) ((void **)*func_data)[2]; data = (WMFreeTypeData *) func_data[3];
for (i = 0; i < MAX_GLYPHS; i++) { for (i = 0; i < MAX_GLYPHS; i++) {
if (data->glyphs_array[i]) { if (data->glyphs_array[i]) {
if (data->glyphs_array[i]->image) if (data->glyphs_array[i]->image)
@@ -307,23 +307,27 @@ logicalCombineArea(RImage *bg, RImage *image,
void void
drawFreeTypeString (proplist_t pl, Drawable d, drawFreeTypeString (proplist_t pl, Drawable d,
int x, int y, unsigned width, unsigned height, int x, int y,
unsigned char *text, void **func_data) { unsigned char *text, int length, void **func_data) {
WMFreeTypeData *data; WMFreeTypeData *data;
RImage *rimg; RImage *rimg;
int i, j; int i, j, width, height;
int length = strlen(text);
Pixmap pixmap; Pixmap pixmap;
GC gc; GC gc;
int xwidth, xheight, dummy; int xwidth, xheight, dummy;
Window wdummy; Window wdummy;
/*pixmap = XCreatePixmap(ds_dpy, d, width, height, DefaultDepth(ds_dpy, DefaultScreen(ds_dpy)));*/ /* see framewin.c for the order of arguments (look in wPluginPackData) */
gc = func_data[0]; data = ((void **)func_data[1])[3]; /* initialized data */
data = ((void **)func_data[2])[2]; if (func_data[2])
pixmap = (Pixmap)func_data[3]; pixmap = *(Pixmap *)func_data[2];
gc = *(GC *)func_data[3];
width = *(int *)func_data[5];
height = *(int *)func_data[6];
/* create temp for drawing */ /* create temp for drawing */
if (!pixmap) { if (!func_data[2]) {
XGetGeometry(ds_dpy, d, &wdummy, &dummy, &dummy, &xwidth, &xheight, &dummy, &dummy); XGetGeometry(ds_dpy, d, &wdummy, &dummy, &dummy, &xwidth, &xheight, &dummy, &dummy);
pixmap = XCreatePixmap(ds_dpy, d, xwidth, xheight, DefaultDepth(ds_dpy, DefaultScreen(ds_dpy))); pixmap = XCreatePixmap(ds_dpy, d, xwidth, xheight, DefaultDepth(ds_dpy, DefaultScreen(ds_dpy)));
XCopyArea(ds_dpy, d, pixmap, gc, 0, 0, xwidth, xheight, 0, 0); XCopyArea(ds_dpy, d, pixmap, gc, 0, 0, xwidth, xheight, 0, 0);
@@ -360,16 +364,15 @@ drawFreeTypeString (proplist_t pl, Drawable d,
RConvertImage(rc, rimg, &pixmap); RConvertImage(rc, rimg, &pixmap);
XCopyArea(ds_dpy, pixmap, d, gc, 0, 0, rimg->width, height, 0, y); XCopyArea(ds_dpy, pixmap, d, gc, 0, 0, rimg->width, height, 0, y);
XFreePixmap(ds_dpy, pixmap); XFreePixmap(ds_dpy, pixmap);
RDestroyImage(rimg);
/* /*
_debug("%d\n", height); _debug("%d\n", height);
*/
/*
i = (height + data->face->size->metrics.y_ppem)/2 - data->face->size->metrics.y_ppem; i = (height + data->face->size->metrics.y_ppem)/2 - data->face->size->metrics.y_ppem;
XDrawLine(ds_dpy, d, gc, 5, y + i, 100, y + data->face->size->metrics.y_ppem); XDrawLine(ds_dpy, d, gc, 5, y + i, 100, y + data->face->size->metrics.y_ppem);
XDrawLine(ds_dpy, d, gc, 100, y + i, 5, y + data->face->size->metrics.y_ppem); XDrawLine(ds_dpy, d, gc, 100, y + i, 5, y + data->face->size->metrics.y_ppem);
*/ */
RDestroyImage(rimg);
} }
} }
@@ -389,7 +392,7 @@ void
initDrawString (proplist_t pl, void **init_data) { initDrawString (proplist_t pl, void **init_data) {
_debug("invoke initDrawString: %s\n", PLGetString(PLGetArrayElement(pl, 2))); _debug("invoke initDrawString: %s\n", PLGetString(PLGetArrayElement(pl, 2)));
if (strcmp(PLGetString(PLGetArrayElement(pl, 2)), "drawPlainString") == 0) if (strcmp(PLGetString(PLGetArrayElement(pl, 2)), "drawPlainString") == 0)
initDrawPlainString((Display *)init_data[0], (Colormap)init_data[1]); initDrawPlainString((Display *)init_data[1], (Colormap *)init_data[2]);
#ifdef USE_FREETYPE #ifdef USE_FREETYPE
else if (strcmp(PLGetString(PLGetArrayElement(pl, 2)), "drawFreeTypeString") == 0) else if (strcmp(PLGetString(PLGetArrayElement(pl, 2)), "drawFreeTypeString") == 0)
initDrawFreeTypeString(pl, init_data); initDrawFreeTypeString(pl, init_data);