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