break;
case RR_TEXTURE_RGBA:
g_assert(!transferred);
- RrImageDraw(a->surface.pixel_data,
- &a->texture[i].data.rgba,
- a->w, a->h,
- &tarea);
+ {
+ RrRect narea = tarea;
+ RrTextureRGBA *rgb = &a->texture[i].data.rgba;
+ if (rgb->twidth)
+ narea.width = MIN(tarea.width, rgb->twidth);
+ if (rgb->theight)
+ narea.height = MIN(tarea.height, rgb->theight);
+ narea.x += rgb->tx;
+ narea.y += rgb->ty;
+ RrImageDraw(a->surface.pixel_data,
+ &a->texture[i].data.rgba,
+ a->w, a->h,
+ &narea);
+ }
force_transfer = 1;
break;
}
return out;
}
+void RrAppearanceRemoveTextures(RrAppearance *a)
+{
+ g_free(a->texture);
+ a->textures = 0;
+}
+
void RrAppearanceAddTextures(RrAppearance *a, gint numtex)
{
g_assert(a->textures == 0);
m = RrFontMeasureString(a->texture[i].data.text.font,
a->texture[i].data.text.string,
a->texture[i].data.text.shadow_offset_x,
- a->texture[i].data.text.shadow_offset_y);
+ a->texture[i].data.text.shadow_offset_y,
+ a->texture[i].data.text.flow,
+ a->texture[i].data.text.maxwidth);
w = MAX(w, m->width);
g_free(m);
break;
{
gint i;
gint l, t, r, b;
+ RrSize *m;
gint h = 0;
for (i = 0; i < a->textures; ++i) {
h = MAX(h, a->texture[i].data.mask.mask->height);
break;
case RR_TEXTURE_TEXT:
- h += MAX(h, RrFontHeight(a->texture[i].data.text.font,
- a->texture[i].data.text.shadow_offset_y));
+ if (a->texture[i].data.text.flow) {
+ g_assert(a->texture[i].data.text.string != NULL);
+
+ m = RrFontMeasureString
+ (a->texture[i].data.text.font,
+ a->texture[i].data.text.string,
+ a->texture[i].data.text.shadow_offset_x,
+ a->texture[i].data.text.shadow_offset_y,
+ a->texture[i].data.text.flow,
+ a->texture[i].data.text.maxwidth);
+ h += MAX(h, m->height);
+ g_free(m);
+ }
+ else
+ h += MAX(h,
+ RrFontHeight
+ (a->texture[i].data.text.font,
+ a->texture[i].data.text.shadow_offset_y));
break;
case RR_TEXTURE_RGBA:
h += MAX(h, a->texture[i].data.rgba.height);
#define __render_h
#include "geom.h"
-#include "version.h"
+#include "render/version.h"
#include <X11/Xlib.h> /* some platforms dont include this as needed for Xft */
#include <pango/pangoxft.h>
gboolean shortcut; /*!< Underline a character */
guint shortcut_pos; /*!< Position in bytes of the character to underline */
RrEllipsizeMode ellipsize;
+ gboolean flow; /* allow multiple lines. must set maxwidth below */
+ gint maxwidth;
};
struct _RrPixmapMask {
gint cwidth;
gint cheight;
RrPixel32 *cache;
+ /* size and position to draw at */
+ gint tx;
+ gint ty;
+ gint twidth;
+ gint theight;
};
struct _RrTextureLineArt {
RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
RrAppearance *RrAppearanceCopy (RrAppearance *a);
void RrAppearanceFree (RrAppearance *a);
+void RrAppearanceRemoveTextures(RrAppearance *a);
void RrAppearanceAddTextures(RrAppearance *a, gint numtex);
RrFont *RrFontOpen (const RrInstance *inst, const gchar *name,
RrFont *RrFontOpenDefault (const RrInstance *inst);
void RrFontClose (RrFont *f);
RrSize *RrFontMeasureString (const RrFont *f, const gchar *str,
- gint shadow_offset_x, gint shadow_offset_y);
+ gint shadow_offset_x, gint shadow_offset_y,
+ gboolean flow, gint maxwidth);
gint RrFontHeight (const RrFont *f, gint shadow_offset_y);
gint RrFontMaxCharWidth (const RrFont *f);
void RrPaint (RrAppearance *a, Window win, gint w, gint h);
void RrMinSize (RrAppearance *a, gint *w, gint *h);
gint RrMinWidth (RrAppearance *a);
+/* For text textures, if flow is TRUE, then the string must be set before
+ calling this, otherwise it doesn't need to be */
gint RrMinHeight (RrAppearance *a);
void RrMargins (RrAppearance *a, gint *l, gint *t, gint *r, gint *b);
theme->menu_bullet_mask = RrPixmapMaskNew(inst, 4, 7, (gchar*)data);
}
+ /* up and down arrows */
+ {
+ guchar data[] = { 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00 };
+ theme->down_arrow_mask = RrPixmapMaskNew(inst, 9, 4, (gchar*)data);
+ }
+ {
+ guchar data[] = { 0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00 };
+ theme->up_arrow_mask = RrPixmapMaskNew(inst, 9, 4, (gchar*)data);
+ }
+
/* setup the default window icon */
theme->def_win_icon = read_c_image(OB_DEFAULT_ICON_WIDTH,
OB_DEFAULT_ICON_HEIGHT,
j = (i > 0 ? 0 : 255);
i = ABS(i*255/100);
- theme->title_focused_shadow_color = RrColorNew(inst, j, j, j);
- theme->title_focused_shadow_alpha = i;
theme->osd_shadow_color = RrColorNew(inst, j, j, j);
theme->osd_shadow_alpha = i;
} else {
- theme->title_focused_shadow_color = RrColorNew(inst, 0, 0, 0);
- theme->title_focused_shadow_alpha = 50;
theme->osd_shadow_color = RrColorNew(inst, 0, 0, 0);
theme->osd_shadow_alpha = 50;
}
RrPixmapMaskFree(theme->close_hover_mask);
RrPixmapMaskFree(theme->close_pressed_mask);
RrPixmapMaskFree(theme->menu_bullet_mask);
+ RrPixmapMaskFree(theme->down_arrow_mask);
+ RrPixmapMaskFree(theme->up_arrow_mask);
RrFontClose(theme->win_font_focused);
RrFontClose(theme->win_font_unfocused);