summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2007-09-02 13:09:39 +0200
committerDanny Baumann <dannybaumann@web.de>2007-09-02 13:09:39 +0200
commite7834affc980d4ec6e78548fc4cbec4a002e342e (patch)
treea02aa24a148c819b560660e19776dea6d9a718e6
parent0cd0edb4bfe34ce1b1d4694133add19b65479ded (diff)
downloadgroup-e7834affc980d4ec6e78548fc4cbec4a002e342e.tar.gz
group-e7834affc980d4ec6e78548fc4cbec4a002e342e.tar.bz2
Check for text plugin availability.
-rw-r--r--cairo.c17
-rw-r--r--group-internal.h2
-rw-r--r--group.xml.in1
-rw-r--r--init.c5
4 files changed, 19 insertions, 6 deletions
diff --git a/cairo.c b/cairo.c
index 3d68532..8d2b82d 100644
--- a/cairo.c
+++ b/cairo.c
@@ -619,8 +619,11 @@ groupRenderWindowTitle (GroupSelection *group)
void *data = NULL;
int width, height;
int stride;
+ Bool hasText = FALSE;
CompTextAttrib textAttrib;
- CompDisplay *d;
+ CompDisplay *d = group->screen->display;
+
+ GROUP_DISPLAY (d);
if (!group->tabBar || !HAS_TOP_WIN(group) || !group->tabBar->textLayer)
return;
@@ -655,9 +658,11 @@ groupRenderWindowTitle (GroupSelection *group)
else
textAttrib.data = 0;
- d = group->screen->display;
- if (!((*d->fileToImage) (d, TEXT_ID, (const char*) &textAttrib,
- &width, &height, &stride, &data)))
+ if (gd->textAvailable)
+ hasText = (*d->fileToImage) (d, TEXT_ID, (const char*) &textAttrib,
+ &width, &height, &stride, &data);
+
+ if (!hasText)
{
/* getting the pixmap failed, so create an empty one */
Pixmap emptyPixmap;
@@ -672,8 +677,8 @@ groupRenderWindowTitle (GroupSelection *group)
gcv.foreground = 0x00000000;
gcv.plane_mask = 0xffffffff;
- gc = XCreateGC(d->display, emptyPixmap,
- GCForeground, &gcv);
+ gc = XCreateGC (d->display, emptyPixmap,
+ GCForeground, &gcv);
XFillRectangle (d->display, emptyPixmap, gc,
0, 0, width, height);
diff --git a/group-internal.h b/group-internal.h
index 231c4b6..ea0f3ac 100644
--- a/group-internal.h
+++ b/group-internal.h
@@ -385,6 +385,8 @@ typedef struct _GroupDisplay {
Atom groupWinPropertyAtom;
Atom resizeNotifyAtom;
+
+ Bool textAvailable;
} GroupDisplay;
/*
diff --git a/group.xml.in b/group.xml.in
index 31dd486..d5959c5 100644
--- a/group.xml.in
+++ b/group.xml.in
@@ -8,6 +8,7 @@
<relation type="after">
<plugin>fade</plugin>
<plugin>place</plugin>
+ <plugin>text</plugin>
</relation>
</deps>
<display>
diff --git a/init.c b/init.c
index a6e9f72..cc408b4 100644
--- a/init.c
+++ b/init.c
@@ -208,6 +208,11 @@ groupInitDisplay (CompPlugin *p,
return FALSE;
}
+ gd->textAvailable = checkPluginABI ("text", TEXT_ABIVERSION);
+ if (!gd->textAvailable)
+ compLogMessage (d, "group", CompLogLevelWarn,
+ "No compatible text plugin loaded.");
+
gd->glowTextureProperties =
(GlowTextureProperties*) glowTextureProperties;
gd->ignoreMode = FALSE;