static int
readPluginXmlCallback (void *context,
		       char *buffer,
		       int  length)
{
    CompIOCtx *ctx = (CompIOCtx *) context;
    int	      offset = ctx->offset;
    int	      i, j;

    i = compReadXmlChunk ("<compiz><plugin name=\"", &offset, buffer, length);
    i += compReadXmlChunk (ctx->name, &offset, buffer + i, length - i);
    i += compReadXmlChunk ("\">", &offset, buffer + i, length - i);

    if (ctx->nDisplayOInfo)
    {
	i += compReadXmlChunk ("<display>", &offset, buffer + i, length - i);

	for (j = 0; j < ctx->nDisplayOInfo; j++)
	    i += compReadXmlChunkFromMetadataOptionInfo (&ctx->displayOInfo[j],
							 &offset,
							 buffer + i,
							 length - i);

	i += compReadXmlChunk ("</display>", &offset, buffer + i, length - i);
    }

    if (ctx->nScreenOInfo)
    {
	i += compReadXmlChunk ("<screen>", &offset, buffer + i, length - i);

	for (j = 0; j < ctx->nScreenOInfo; j++)
	    i += compReadXmlChunkFromMetadataOptionInfo (&ctx->screenOInfo[j],
							 &offset,
							 buffer + i,
							 length - i);

	i += compReadXmlChunk ("</screen>", &offset, buffer + i, length - i);
    }

    i += compReadXmlChunk ("</plugin></compiz>", &offset, buffer + i,
			   length - i);

    if (!offset && length > i)
	buffer[i++] = '\0';

    ctx->offset += i;

    return i;
}
Exemple #2
0
static int
readCoreXmlCallback(void *context,
                    char *buffer,
                    int length)
{
   CompIOCtx *ctx = (CompIOCtx *)context;
   int offset = ctx->offset;
   int i, j;

   i = compReadXmlChunk("<compiz><core><display>", &offset, buffer, length);

   for (j = 0; j < COMP_DISPLAY_OPTION_NUM; j++)
     {
        CompMetadataOptionInfo info = coreDisplayOptionInfo[j];

        switch (j)
          {
           case COMP_DISPLAY_OPTION_ACTIVE_PLUGINS:
             if (ctx->pluginData)
               info.data = ctx->pluginData;
             break;

           case COMP_DISPLAY_OPTION_TEXTURE_FILTER:
             if (ctx->textureFilterData)
               info.data = ctx->textureFilterData;

           default:
             break;
          }

        i += compReadXmlChunkFromMetadataOptionInfo(&info,
                                                    &offset,
                                                    buffer + i,
                                                    length - i);
     }

   i += compReadXmlChunk("</display><screen>", &offset,
                         buffer + i, length - 1);

   for (j = 0; j < COMP_SCREEN_OPTION_NUM; j++)
     {
        CompMetadataOptionInfo info = coreScreenOptionInfo[j];

        switch (j)
          {
           case COMP_SCREEN_OPTION_REFRESH_RATE:
             if (ctx->refreshRateData)
               info.data = ctx->refreshRateData;

           default:
             break;
          }

        i += compReadXmlChunkFromMetadataOptionInfo(&info,
                                                    &offset,
                                                    buffer + i,
                                                    length - i);
     }

   i += compReadXmlChunk("</screen></core></compiz>", &offset, buffer + i,
                         length - i);

   if (!offset && length > i)
     buffer[i++] = '\0';

   ctx->offset += i;

   return i;
}