summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2009-01-11 14:14:09 +0100
committerDanny Baumann <dannybaumann@web.de>2009-01-11 14:14:09 +0100
commit8327cf45c647cc9a1a53cc806fe57ceb911d3eb9 (patch)
treeac6e8f75ed8999c0ee0f0738ba9971db00d0e8ff
parent00bbcede66961790f27d00e9fb537e0bb1bc8565 (diff)
downloadgroup-8327cf45c647cc9a1a53cc806fe57ceb911d3eb9.tar.gz
group-8327cf45c647cc9a1a53cc806fe57ceb911d3eb9.tar.bz2
Adapt for text plugin interface changes.
-rw-r--r--cairo.c73
-rw-r--r--group-internal.h4
-rw-r--r--init.c13
3 files changed, 46 insertions, 44 deletions
diff --git a/cairo.c b/cairo.c
index a3aef9c..fdfc558 100644
--- a/cairo.c
+++ b/cairo.c
@@ -640,11 +640,8 @@ void
groupRenderWindowTitle (GroupSelection *group)
{
GroupCairoLayer *layer;
- void *data = NULL;
int width, height;
- int stride;
- Bool hasText = FALSE;
- CompTextAttrib textAttrib;
+ Pixmap pixmap = None;
CompScreen *s = group->screen;
CompDisplay *d = s->display;
GroupTabBar *bar = group->tabBar;
@@ -662,36 +659,40 @@ groupRenderWindowTitle (GroupSelection *group)
if (!layer)
return;
- textAttrib.family = "Sans";
- textAttrib.size = groupGetTabbarFontSize (s);
- textAttrib.style = TEXT_STYLE_BOLD;
- textAttrib.color[0] = groupGetTabbarFontColorRed (s);
- textAttrib.color[1] = groupGetTabbarFontColorGreen (s);
- textAttrib.color[2] = groupGetTabbarFontColorBlue (s);
- textAttrib.color[3] = groupGetTabbarFontColorAlpha (s);
- textAttrib.ellipsize = TRUE;
-
- textAttrib.maxWidth = width;
- textAttrib.maxHeight = height;
- textAttrib.screen = s;
- textAttrib.renderMode = TextRenderWindowTitle;
-
- if (bar->textSlot && bar->textSlot->window)
- textAttrib.data = (void*) bar->textSlot->window->id;
- else
- textAttrib.data = 0;
+ if (bar->textSlot && bar->textSlot->window && gd->textFunc)
+ {
+ CompTextData *data;
+ CompTextAttrib textAttrib;
+
+ textAttrib.family = "Sans";
+ textAttrib.size = groupGetTabbarFontSize (s);
+
+ textAttrib.flags = CompTextFlagStyleBold | CompTextFlagEllipsized |
+ CompTextFlagNoAutoBinding;
+
+ textAttrib.color[0] = groupGetTabbarFontColorRed (s);
+ textAttrib.color[1] = groupGetTabbarFontColorGreen (s);
+ textAttrib.color[2] = groupGetTabbarFontColorBlue (s);
+ textAttrib.color[3] = groupGetTabbarFontColorAlpha (s);
+
+ textAttrib.maxWidth = width;
+ textAttrib.maxHeight = height;
- if (gd->textAvailable)
- hasText = (*d->fileToImage) (d, TEXT_ID, (const char*) &textAttrib,
- &width, &height, &stride, &data);
+ data = (gd->textFunc->renderWindowTitle) (s, bar->textSlot->window->id,
+ FALSE, &textAttrib);
+ if (data)
+ {
+ pixmap = data->pixmap;
+ free (data);
+ }
+ }
- if (!hasText)
+ if (!pixmap)
{
/* getting the pixmap failed, so create an empty one */
- Pixmap emptyPixmap;
- emptyPixmap = XCreatePixmap (d->display, s->root, width, height, 32);
+ pixmap = XCreatePixmap (d->display, s->root, width, height, 32);
- if (emptyPixmap)
+ if (pixmap)
{
XGCValues gcv;
GC gc;
@@ -699,24 +700,18 @@ groupRenderWindowTitle (GroupSelection *group)
gcv.foreground = 0x00000000;
gcv.plane_mask = 0xffffffff;
- gc = XCreateGC (d->display, emptyPixmap,
- GCForeground, &gcv);
-
- XFillRectangle (d->display, emptyPixmap, gc,
- 0, 0, width, height);
-
+ gc = XCreateGC (d->display, pixmap, GCForeground, &gcv);
+ XFillRectangle (d->display, pixmap, gc, 0, 0, width, height);
XFreeGC (d->display, gc);
-
- data = (void*) emptyPixmap;
}
}
layer->texWidth = width;
layer->texHeight = height;
- if (data)
+ if (pixmap)
{
- layer->pixmap = (Pixmap) data;
+ layer->pixmap = pixmap;
bindPixmapToTexture (s, &layer->texture, layer->pixmap,
layer->texWidth, layer->texHeight, 32);
}
diff --git a/group-internal.h b/group-internal.h
index 269bdba..5fcf24d 100644
--- a/group-internal.h
+++ b/group-internal.h
@@ -398,12 +398,13 @@ typedef struct _GroupDisplay {
Atom groupWinPropertyAtom;
Atom resizeNotifyAtom;
- Bool textAvailable;
+ TextFunc *textFunc;
} GroupDisplay;
/*
* GroupScreen structure
*/
+
typedef struct _GroupScreen {
int windowPrivateIndex;
@@ -814,7 +815,6 @@ groupResizeTabBarRegion (GroupSelection *group,
void
groupDamageTabBarRegion (GroupSelection *group);
-
/*
* paint.c
*/
diff --git a/init.c b/init.c
index 8d995c4..c9aa1c0 100644
--- a/init.c
+++ b/init.c
@@ -194,6 +194,7 @@ groupInitDisplay (CompPlugin *p,
CompDisplay *d)
{
GroupDisplay *gd;
+ int index;
if (!checkPluginABI ("core", CORE_ABIVERSION))
return FALSE;
@@ -209,11 +210,17 @@ groupInitDisplay (CompPlugin *p,
return FALSE;
}
- gd->textAvailable = checkPluginABI ("text", TEXT_ABIVERSION);
- if (!gd->textAvailable)
+ if (checkPluginABI ("text", TEXT_ABIVERSION) &&
+ getPluginDisplayIndex (d, "text", &index))
+ {
+ gd->textFunc = d->base.privates[index].ptr;
+ }
+ else
+ {
compLogMessage ("group", CompLogLevelWarn,
"No compatible text plugin loaded.");
-
+ gd->textFunc = NULL;
+ }
gd->glowTextureProperties =
(GlowTextureProperties*) glowTextureProperties;
gd->ignoreMode = FALSE;