mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
pass texture to plugin so it doesn't have to grab from title bar.
add experiment plugin support to menu entry, performance need to be improved. I'm thinking of making a compressed expose event geometry.
This commit is contained in:
@@ -272,6 +272,7 @@ logicalCombineArea(RImage *bg, RImage *image,
|
||||
int _dx, int _dy,
|
||||
int opaquueness) {
|
||||
|
||||
/*
|
||||
if (_dx < 0) {
|
||||
_sx = -_dx;
|
||||
_sw = _sw + _dx;
|
||||
@@ -291,6 +292,7 @@ logicalCombineArea(RImage *bg, RImage *image,
|
||||
if (_dy + _sh > bg->height) {
|
||||
_sh = bg->height - _dy;
|
||||
}
|
||||
*/
|
||||
|
||||
if (_sh > 0 && _sw > 0) {
|
||||
if (opaquueness) {
|
||||
@@ -332,7 +334,7 @@ drawFreeTypeString (proplist_t pl, Drawable d,
|
||||
}
|
||||
|
||||
if (rimg) {
|
||||
for (i = 0, j = 3; i < strlen(text); i++) {
|
||||
for (i = 0, j = x; i < strlen(text); i++) {
|
||||
if (!data->glyphs_array[text[i]]) {
|
||||
data->glyphs_array[text[i]] = renderChar(data->face, (FT_ULong)text[i], &data->color);
|
||||
data->glyphs_shadow_array[text[i]] = renderChar(data->face, (FT_ULong)text[i], &black_color);
|
||||
@@ -342,22 +344,30 @@ drawFreeTypeString (proplist_t pl, Drawable d,
|
||||
int _dx, _dy, _sw, _sh;
|
||||
|
||||
_dx = j + data->glyphs_array[text[i]]->left;
|
||||
_dy = rimg->height - data->glyphs_array[text[i]]->top ;
|
||||
_dy = (height + data->face->size->metrics.y_ppem)/2 - data->glyphs_array[text[i]]->top;
|
||||
_sw = data->glyphs_array[text[i]]->image->width;
|
||||
_sh = data->glyphs_array[text[i]]->image->height;
|
||||
|
||||
logicalCombineArea(rimg, data->glyphs_shadow_array[text[i]]->image,
|
||||
0, 0, _sw, _sh, _dx-2, _dy-2, 100);
|
||||
0, 0, _sw, _sh, _dx-2, _dy+2, 100);
|
||||
logicalCombineArea(rimg, data->glyphs_array[text[i]]->image,
|
||||
0, 0, _sw, _sh, _dx-3, _dy-3, 0);
|
||||
0, 0, _sw, _sh, _dx-3, _dy+1, 0);
|
||||
|
||||
j += data->glyphs_array[text[i]]->advance_x >> 6;
|
||||
}
|
||||
}
|
||||
|
||||
RConvertImage(rc, rimg, &pixmap);
|
||||
XCopyArea(ds_dpy, pixmap, d, gc, 0, 0, rimg->width, rimg->height, 0, 0);
|
||||
XCopyArea(ds_dpy, pixmap, d, gc, 0, 0, rimg->width, height, 0, y);
|
||||
XFreePixmap(ds_dpy, pixmap);
|
||||
/*
|
||||
_debug("%d\n", height);
|
||||
*/
|
||||
/*
|
||||
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, 100, y + i, 5, y + data->face->size->metrics.y_ppem);
|
||||
*/
|
||||
|
||||
RDestroyImage(rimg);
|
||||
}
|
||||
|
||||
@@ -652,14 +652,17 @@ WDefaultEntry optionList[] = {
|
||||
{"MenuTitleColor", "white", NULL,
|
||||
NULL, getTextRenderer, setMenuTitleColor
|
||||
},
|
||||
{"MenuTextColor", "black", NULL,
|
||||
NULL, getTextRenderer, setMenuTextColor
|
||||
},
|
||||
#else
|
||||
{"MenuTitleColor", "white", NULL,
|
||||
NULL, getColor, setMenuTitleColor
|
||||
},
|
||||
#endif
|
||||
{"MenuTextColor", "black", NULL,
|
||||
NULL, getColor, setMenuTextColor
|
||||
},
|
||||
#endif
|
||||
{"MenuDisabledColor", "\"#616161\"", NULL,
|
||||
NULL, getColor, setMenuDisabledColor
|
||||
},
|
||||
|
||||
@@ -1093,16 +1093,17 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
||||
scr->drawstring_func[DRAWSTRING_CURRENT_STATE]->proc.drawString(
|
||||
scr->drawstring_func[DRAWSTRING_CURRENT_STATE]->arg,
|
||||
fwin->titlebar->window,
|
||||
x, *fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
|
||||
x, 0,
|
||||
fwin->titlebar->width, fwin->top_width,
|
||||
fwin->title, p);
|
||||
free(p);
|
||||
} else {
|
||||
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
||||
*fwin->title_gc, *fwin->font,
|
||||
x, *fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
|
||||
x, ((signed)fwin->top_width - (signed)WMFontHeight(*fwin->font))/2,
|
||||
title, titlelen);
|
||||
}
|
||||
#undef DRAWSTRING_CURRENT_STATE
|
||||
#else
|
||||
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
||||
*fwin->title_gc, *fwin->font, x, *fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
|
||||
|
||||
29
src/menu.c
29
src/menu.c
@@ -784,8 +784,37 @@ paintEntry(WMenu *menu, int index, int selected)
|
||||
if (entry->flags.indicator)
|
||||
x += MENU_INDICATOR_SPACE + 2;
|
||||
|
||||
#ifdef DRAWSTRING_PLUGIN
|
||||
if (scr->drawstring_func[W_STRING_MTEXT]) {
|
||||
Pixmap tmp_bg;
|
||||
void **p;
|
||||
tmp_bg = XCreatePixmap(dpy, win, w, menu->entry_height, DefaultDepth(dpy, DefaultScreen(dpy)));
|
||||
XCopyArea(dpy, win, tmp_bg, textGC, 0, y, w, menu->entry_height, 0, 0);
|
||||
p = wPluginPackData(4,
|
||||
textGC,
|
||||
scr->menu_entry_font,
|
||||
scr->drawstring_func[W_STRING_MTEXT]->data,
|
||||
/*menu->menu_texture_data,*/
|
||||
tmp_bg,
|
||||
"extendable");
|
||||
scr->drawstring_func[W_STRING_MTEXT]->proc.drawString(
|
||||
scr->drawstring_func[W_STRING_MTEXT]->arg,
|
||||
win,
|
||||
x, y,
|
||||
menu->frame->titlebar->width, menu->entry_height,
|
||||
entry->text, p);
|
||||
XFreePixmap(dpy, tmp_bg);
|
||||
free(p);
|
||||
#undef DRAWSTRING_CURRENT_STATE
|
||||
} else {
|
||||
WMDrawString(scr->wmscreen, win, textGC, scr->menu_entry_font,
|
||||
x, 3 + y + wPreferences.menu_text_clearance, entry->text, strlen(entry->text));
|
||||
}
|
||||
|
||||
#else
|
||||
WMDrawString(scr->wmscreen, win, textGC, scr->menu_entry_font,
|
||||
x, 3 + y + wPreferences.menu_text_clearance, entry->text, strlen(entry->text));
|
||||
#endif
|
||||
|
||||
if (entry->cascade>=0) {
|
||||
/* draw the cascade indicator */
|
||||
|
||||
Reference in New Issue
Block a user