mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
fix solid color when using plugin.
This commit is contained in:
@@ -2214,7 +2214,7 @@ getTextRenderer(WScreen *scr, WDefaultEntry *entry, proplist_t value,
|
||||
func = PLGetString(elem);
|
||||
scr->drawstring_func[changed] = wPluginCreateFunction (W_FUNCTION_DRAWSTRING,
|
||||
lib, "initDrawString", func, "destroyDrawString", value,
|
||||
wPluginPackData(3, dpy, scr->w_colormap,"-DATA-"));
|
||||
wPluginPackData(3, dpy, &scr->w_colormap, "dummy"));
|
||||
}
|
||||
|
||||
return getColor(scr, entry, PLGetArrayElement(value,3), addr, ret);
|
||||
|
||||
@@ -1084,18 +1084,24 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
#ifdef DRAWSTRING_PLUGIN
|
||||
#define DRAWSTRING_CURRENT_STATE fwin->flags.state + fwin->drawstring_proc_offset
|
||||
if (scr->drawstring_func[DRAWSTRING_CURRENT_STATE]) {
|
||||
void **p = wPluginPackData(4,
|
||||
*fwin->title_gc,
|
||||
*fwin->font,
|
||||
int tb = fwin->top_width;
|
||||
void **p = wPluginPackData(6,
|
||||
/* 0 number of argument, will be passed */
|
||||
scr->drawstring_func[DRAWSTRING_CURRENT_STATE]->data,
|
||||
fwin->title_back[fwin->flags.state],
|
||||
"extendable");
|
||||
/* 1 plugin data, as it was initialized */
|
||||
&fwin->title_back[fwin->flags.state],
|
||||
/* 2 current background Pixmap */
|
||||
fwin->title_gc, /* 3 gc */
|
||||
*fwin->font, /* 4 WMFont** */
|
||||
&fwin->titlebar->width,
|
||||
/* 5 suggested width */
|
||||
&tb /* 6 suggested height */
|
||||
);
|
||||
scr->drawstring_func[DRAWSTRING_CURRENT_STATE]->proc.drawString(
|
||||
scr->drawstring_func[DRAWSTRING_CURRENT_STATE]->arg,
|
||||
fwin->titlebar->window,
|
||||
x, 0,
|
||||
fwin->titlebar->width, fwin->top_width,
|
||||
fwin->title, p);
|
||||
fwin->title, strlen(fwin->title), p);
|
||||
free(p);
|
||||
} else {
|
||||
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
||||
|
||||
63
src/menu.c
63
src/menu.c
@@ -683,7 +683,7 @@ wMenuDestroy(WMenu *menu, int recurse)
|
||||
#define F_NONE 3
|
||||
|
||||
static void
|
||||
drawFrame(WScreen *scr, Window win, int y, int w, int h, int type)
|
||||
drawFrame(WScreen *scr, Drawable win, int y, int w, int h, int type)
|
||||
{
|
||||
XSegment segs[2];
|
||||
int i;
|
||||
@@ -762,10 +762,12 @@ paintEntry(WMenu *menu, int index, int selected)
|
||||
#ifdef DRAWSTRING_PLUGIN
|
||||
if (scr->menu_item_texture->any.type == WTEX_SOLID) {
|
||||
XClearArea(dpy, win, 0, y + 1, w - 1, h - 3, False);
|
||||
/* draw the frame */
|
||||
drawFrame(scr, win, y, w, h, type);
|
||||
} else {
|
||||
/* if the function is there, it responses for clearing area */
|
||||
/*
|
||||
* if the function is there, it responses for clearing area
|
||||
* to reduce flickering
|
||||
*/
|
||||
if (!scr->drawstring_func[W_STRING_MTEXT])
|
||||
XClearArea(dpy, win, 0, y, w, h, False);
|
||||
}
|
||||
@@ -799,45 +801,50 @@ paintEntry(WMenu *menu, int index, int selected)
|
||||
#ifdef DRAWSTRING_PLUGIN
|
||||
if (scr->drawstring_func[W_STRING_MTEXT]) {
|
||||
Pixmap tmp_bg;
|
||||
Pixmap *texture_data;
|
||||
void **p;
|
||||
int _y;
|
||||
int tb = menu->entry_height; /* convert short into int */
|
||||
|
||||
_y = (wPreferences.menu_style == MS_NORMAL) ? 0 : y;
|
||||
tmp_bg = XCreatePixmap(dpy, win, w, menu->entry_height, DefaultDepth(dpy, DefaultScreen(dpy)));
|
||||
if (selected) {
|
||||
if (menu->flags.brother) {
|
||||
XCopyArea(dpy, menu->brother->menu_texture_data, tmp_bg, textGC,
|
||||
0, _y, w, menu->entry_height, 0, 0);
|
||||
} else
|
||||
XCopyArea(dpy, menu->menu_texture_data, tmp_bg, textGC,
|
||||
0, _y, w, menu->entry_height, 0, 0);
|
||||
texture_data = menu->flags.brother ?
|
||||
&menu->brother->menu_texture_data : &menu->menu_texture_data;
|
||||
|
||||
XSetForeground(dpy, scr->select_menu_gc, scr->select_pixel);
|
||||
XFillRectangle(dpy, tmp_bg, scr->select_menu_gc, 1, 1, w-2, h-3);
|
||||
} else {
|
||||
if (menu->flags.brother) {
|
||||
XCopyArea(dpy, menu->brother->menu_texture_data, tmp_bg, textGC,
|
||||
0, _y, w, menu->entry_height, 0, 0);
|
||||
}
|
||||
else
|
||||
XCopyArea(dpy, menu->menu_texture_data, tmp_bg, textGC,
|
||||
0, _y, w, menu->entry_height, 0, 0);
|
||||
tmp_bg = XCreatePixmap(dpy, win, w, menu->entry_height,
|
||||
DefaultDepth(dpy, DefaultScreen(dpy)));
|
||||
|
||||
if (scr->menu_item_texture->any.type == WTEX_SOLID) {
|
||||
XFillRectangle(dpy, tmp_bg, scr->menu_item_texture->solid.normal_gc, 0, 0, w, h);
|
||||
drawFrame(scr, tmp_bg, 0, w, h, type);
|
||||
|
||||
} else {
|
||||
XCopyArea(dpy, *texture_data, tmp_bg, textGC,
|
||||
0, _y, w, menu->entry_height, 0, 0);
|
||||
}
|
||||
|
||||
p = wPluginPackData(4,
|
||||
textGC,
|
||||
scr->menu_entry_font,
|
||||
if (selected) {
|
||||
XSetForeground(dpy, scr->select_menu_gc, scr->select_pixel);
|
||||
XFillRectangle(dpy, tmp_bg, scr->select_menu_gc, 1, 1, w-2, h-3);
|
||||
}
|
||||
|
||||
|
||||
p = wPluginPackData(6,
|
||||
scr->drawstring_func[W_STRING_MTEXT]->data,
|
||||
/*menu->menu_texture_data,*/
|
||||
tmp_bg,
|
||||
&tmp_bg,
|
||||
&textGC,
|
||||
scr->menu_entry_font,
|
||||
&menu->frame->core->width,
|
||||
&tb,
|
||||
"extendable");
|
||||
|
||||
scr->drawstring_func[W_STRING_MTEXT]->proc.drawString(
|
||||
scr->drawstring_func[W_STRING_MTEXT]->arg,
|
||||
win,
|
||||
x, y,
|
||||
menu->frame->core->width, menu->entry_height,
|
||||
entry->text, p);
|
||||
entry->text, strlen(entry->text), p);
|
||||
|
||||
XFreePixmap(dpy, tmp_bg);
|
||||
|
||||
free(p);
|
||||
} else {
|
||||
WMDrawString(scr->wmscreen, win, textGC, scr->menu_entry_font,
|
||||
|
||||
@@ -53,8 +53,9 @@ wPluginPackData(int members, ...)
|
||||
int i;
|
||||
p = wmalloc(sizeof(void *) * (members + 1));
|
||||
memset(p, 0, sizeof(void *) * (members + 1));
|
||||
p[0] = (void *)members;
|
||||
va_start(vp, members);
|
||||
for(i=0;i<members;i++) {
|
||||
for(i=1;i<members+1;i++) {
|
||||
p[i] = va_arg(vp, void *);
|
||||
}
|
||||
va_end(vp);
|
||||
@@ -124,7 +125,7 @@ wPluginDestroyFunction(WFunction *function)
|
||||
|
||||
if (function->data) {
|
||||
if (function->freeData)
|
||||
function->freeData(function->arg, &function->data);
|
||||
function->freeData(function->arg, function->data);
|
||||
wfree(function->data);
|
||||
}
|
||||
if (function->arg) PLRelease(function->arg);
|
||||
|
||||
@@ -50,7 +50,7 @@ typedef void _DL_AnyProc(proplist_t);
|
||||
#define W_STRING_MTEXT 4
|
||||
#define W_STRING_MEMBERS 5
|
||||
|
||||
typedef void _DL_DrawStringProc(proplist_t, Drawable, int, int, unsigned, unsigned, char*, void**);
|
||||
typedef void _DL_DrawStringProc(proplist_t, Drawable, int, int, char*, int, void**);
|
||||
#endif
|
||||
|
||||
typedef void _DL_FreeDataProc(proplist_t pl, void *free_data);
|
||||
|
||||
Reference in New Issue
Block a user