コード例 #1
0
int
compReadXmlChunkFromMetadataOptionInfo (const CompMetadataOptionInfo *info,
					int			     *offset,
					char			     *buffer,
					int			     length)
{
    int i;

    i = compReadXmlChunk ("<option name=\"", offset, buffer, length);
    i += compReadXmlChunk (info->name, offset, buffer + i, length - i);

    if (info->type)
    {
	i += compReadXmlChunk ("\" type=\"", offset, buffer + i, length - i);
	i += compReadXmlChunk (info->type, offset, buffer + i, length - i);
    }

    if (info->data)
    {
	i += compReadXmlChunk ("\">", offset, buffer + i, length - i);
	i += compReadXmlChunk (info->data, offset, buffer + i, length - i);
	i += compReadXmlChunk ("</option>", offset, buffer + i, length - i);
    }
    else
    {
	i += compReadXmlChunk ("\"/>", offset, buffer + i, length - i);
    }

    return i;
}
コード例 #2
0
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;
}
コード例 #3
0
ファイル: main.c プロジェクト: zmike/compiz
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;
}