WMTheme: support JSON format

This commit is contained in:
李通洲
2023-09-13 14:25:00 +08:00
parent 804463a470
commit 3dfa99c232
2 changed files with 14 additions and 1 deletions
+13 -1
View File
@@ -32,7 +32,7 @@ void ffPrintWMTheme(FFWMThemeOptions* options)
void ffInitWMThemeOptions(FFWMThemeOptions* options)
{
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_WMTHEME_MODULE_NAME, ffParseWMThemeCommandOptions, ffParseWMThemeJsonObject, ffPrintWMTheme, NULL);
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_WMTHEME_MODULE_NAME, ffParseWMThemeCommandOptions, ffParseWMThemeJsonObject, ffPrintWMTheme, ffGenerateWMThemeJson);
ffOptionInitModuleArg(&options->moduleArgs);
}
@@ -67,3 +67,15 @@ void ffParseWMThemeJsonObject(FFWMThemeOptions* options, yyjson_val* module)
ffPrintError(FF_WMTHEME_DISPLAY_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
}
}
void ffGenerateWMThemeJson(FF_MAYBE_UNUSED FFWMThemeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
FF_STRBUF_AUTO_DESTROY themeOrError = ffStrbufCreate();
if(!ffDetectWmTheme(&themeOrError))
{
yyjson_mut_obj_add_strbuf(doc, module, "error", &themeOrError);
return;
}
yyjson_mut_obj_add_strbuf(doc, module, "result", &themeOrError);
}
+1
View File
@@ -9,3 +9,4 @@ void ffInitWMThemeOptions(FFWMThemeOptions* options);
bool ffParseWMThemeCommandOptions(FFWMThemeOptions* options, const char* key, const char* value);
void ffDestroyWMThemeOptions(FFWMThemeOptions* options);
void ffParseWMThemeJsonObject(FFWMThemeOptions* options, yyjson_val* module);
void ffGenerateWMThemeJson(FFWMThemeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);