diff options
author | Sam Spilsbury <Sam@ACER-SUSE.SUSE> | 2007-12-13 14:54:27 +1030 |
---|---|---|
committer | David Mikos <metastability@opencompositing.org> | 2007-12-13 14:54:27 +1030 |
commit | 0faadf23b9ad9af8b122eaa0b55f96b993012873 (patch) | |
tree | baeadeb1aee46d8167b154d7acc5155032b57465 | |
parent | 68ca9b80d88acbaf88f7ab306c09960bd2b6c859 (diff) | |
download | snowglobe-0faadf23b9ad9af8b122eaa0b55f96b993012873.tar.gz snowglobe-0faadf23b9ad9af8b122eaa0b55f96b993012873.tar.bz2 |
Patch for 0.6.0 version.
-rw-r--r-- | snowglobe-internal.h | 4 | ||||
-rw-r--r-- | snowglobe.c | 80 |
2 files changed, 39 insertions, 45 deletions
diff --git a/snowglobe-internal.h b/snowglobe-internal.h index 13bcf92..290a578 100644 --- a/snowglobe-internal.h +++ b/snowglobe-internal.h @@ -27,12 +27,12 @@ extern int snowglobeDisplayPrivateIndex; extern int cubeDisplayPrivateIndex; #define GET_SNOWGLOBE_DISPLAY(d) \ - ((SnowglobeDisplay *) (d)->base.privates[snowglobeDisplayPrivateIndex].ptr) + ((SnowglobeDisplay *) (d)->privates[snowglobeDisplayPrivateIndex].ptr) #define SNOWGLOBE_DISPLAY(d) \ SnowglobeDisplay *ad = GET_SNOWGLOBE_DISPLAY(d); #define GET_SNOWGLOBE_SCREEN(s, ad) \ - ((SnowglobeScreen *) (s)->base.privates[(ad)->screenPrivateIndex].ptr) + ((SnowglobeScreen *) (s)->privates[(ad)->screenPrivateIndex].ptr) #define SNOWGLOBE_SCREEN(s) \ SnowglobeScreen *as = GET_SNOWGLOBE_SCREEN(s, GET_SNOWGLOBE_DISPLAY(s->display)) diff --git a/snowglobe.c b/snowglobe.c index e9931c1..86a75d9 100644 --- a/snowglobe.c +++ b/snowglobe.c @@ -70,7 +70,6 @@ #include <math.h> - #include "snowglobe-internal.h" #include "snowglobe_options.h" @@ -386,13 +385,28 @@ snowglobeInitDisplay (CompPlugin *p, CompDisplay *d) { SnowglobeDisplay *ad; + + CompPlugin *cube = findActivePlugin ("cube"); + CompOption *option; + int nOption; - if (!checkPluginABI ("core", CORE_ABIVERSION) || - !checkPluginABI ("cube", CUBE_ABIVERSION)) - return FALSE; + if (!cube || !cube->vTable->getDisplayOptions) + return FALSE; + + option = (*cube->vTable->getDisplayOptions) (cube, d, &nOption); + + if (getIntOptionNamed (option, nOption, "abi", 0) != CUBE_ABIVERSION) + { + compLogMessage (d, "snowglobe", CompLogLevelError, + "cube ABI version mismatch"); + return FALSE; + } + + cubeDisplayPrivateIndex = getIntOptionNamed (option, nOption, "index", -1); + + if (cubeDisplayPrivateIndex < 0) + return FALSE; - if (!getPluginDisplayIndex (d, "cube", &cubeDisplayPrivateIndex)) - return FALSE; ad = malloc (sizeof (SnowglobeDisplay)); @@ -407,7 +421,7 @@ snowglobeInitDisplay (CompPlugin *p, return FALSE; } - d->base.privates[snowglobeDisplayPrivateIndex].ptr = ad; + d->privates[snowglobeDisplayPrivateIndex].ptr = ad; return TRUE; } @@ -440,7 +454,7 @@ snowglobeInitScreen (CompPlugin *p, if (!as) return FALSE; - s->base.privates[ad->screenPrivateIndex].ptr = as; + s->privates[ad->screenPrivateIndex].ptr = as; as->damage = FALSE; @@ -500,45 +514,25 @@ snowglobeFini (CompPlugin * p) freeDisplayPrivateIndex (snowglobeDisplayPrivateIndex); } -static CompBool -snowglobeInitObject (CompPlugin *p, - CompObject *o) -{ - static InitPluginObjectProc dispTab[] = { - (InitPluginObjectProc) 0, /* InitCore */ - (InitPluginObjectProc) snowglobeInitDisplay, - (InitPluginObjectProc) snowglobeInitScreen - }; - - RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o)); -} - -static void -snowglobeFiniObject (CompPlugin *p, - CompObject *o) -{ - static FiniPluginObjectProc dispTab[] = { - (FiniPluginObjectProc) 0, /* FiniCore */ - (FiniPluginObjectProc) snowglobeFiniDisplay, - (FiniPluginObjectProc) snowglobeFiniScreen - }; - - DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o)); -} - CompPluginVTable snowglobeVTable = { - "snowglobe", - 0, - snowglobeInit, - snowglobeFini, - snowglobeInitObject, - snowglobeFiniObject, - 0, - 0 + "snowglobe", + snowglobeGetVersion, + 0, + snowglobeInit, + snowglobeFini, + snowglobeInitDisplay, + snowglobeFiniDisplay, + snowglobeInitScreen, + snowglobeFiniScreen, + 0, + 0, + 0, + 0, + 0, + 0 }; - CompPluginVTable * getCompPluginInfo (void) { |