diff --git a/src/iclass.c b/src/iclass.c index 4774ac70..03011c94 100644 --- a/src/iclass.c +++ b/src/iclass.c @@ -1193,13 +1193,9 @@ ITApply(Win win, ImageClass * ic, ImageState * is, int w, int h, EXCopyArea(pmm.pmap, pmap, 0, 0, w, h, 0, 0); } - TextstateDrawText(ts, win, pmap, text, ic->padding.left, - ic->padding.top, - w - (ic->padding.left + - ic->padding.right), - h - (ic->padding.top + - ic->padding.bottom), - 0, TextclassGetJustification(tc)); + TextstateDrawText(ts, win, pmap, text, 0, 0, w, h, + &(ic->padding), 0, + TextclassGetJustification(tc)); } /* Set window pixmap */ diff --git a/src/tclass.h b/src/tclass.h index 8e9fbc4f..30b97d0d 100644 --- a/src/tclass.h +++ b/src/tclass.h @@ -84,7 +84,8 @@ TextState *TextclassGetTextState(TextClass * tclass, int state, int active, int sticky); void TextstateDrawText(TextState * ts, Win win, Drawable draw, const char *text, int x, int y, int w, - int h, int fsize, int justification); + int h, const EImageBorder * pad, + int fsize, int justification); void TextSize(TextClass * tclass, int active, int sticky, int state, const char *text, int *width, int *height, int fsize); diff --git a/src/text.c b/src/text.c index 9970c391..039cd469 100644 --- a/src/text.c +++ b/src/text.c @@ -420,8 +420,8 @@ _set_gc_color(Win win, GC gc, XColor * pxc) void TextstateDrawText(TextState * ts, Win win, Drawable draw, const char *text, - int x, int y, int w, int h, int fsize __UNUSED__, - int justification) + int x, int y, int w, int h, const EImageBorder * pad, + int fsize __UNUSED__, int justification) { const char *str; char **lines; @@ -448,9 +448,27 @@ TextstateDrawText(TextState * ts, Win win, Drawable draw, const char *text, if (ts->style.orientation == FONT_TO_RIGHT || ts->style.orientation == FONT_TO_LEFT) - textwidth_limit = w; + { + if (pad) + { + x += pad->left; + w -= pad->left + pad->right; + y += pad->top; + h -= pad->top + pad->bottom; + } + textwidth_limit = w; + } else - textwidth_limit = h; + { + if (pad) + { + x += pad->left; + h -= pad->left + pad->right; + y += pad->top; + w -= pad->top + pad->bottom; + } + textwidth_limit = h; + } xx = x; yy = y; @@ -886,5 +904,6 @@ TextDraw(TextClass * tclass, Win win, Drawable draw, int active, int sticky, if (!ts) return; - TextstateDrawText(ts, win, draw, text, x, y, w, h, fsize, justification); + TextstateDrawText(ts, win, draw, text, x, y, w, h, NULL, fsize, + justification); }