Files
fastfetch/src/modules/resolution.c
T
Linus Dierheimer a145700500 wayland support
2021-04-16 16:49:33 +02:00

32 lines
1.1 KiB
C

#include "resolution.h"
void ffPrintResolutionValue(FFinstance* instance, uint8_t moduleIndex, FFcache* cache, int width, int height, int refreshRate)
{
FFstrbuf value;
ffStrbufInitA(&value, 32);
ffStrbufAppendF(&value, "%ix%i", width, height);
if(refreshRate > 0)
ffStrbufAppendF(&value, " @ %iHz", refreshRate);
ffPrintAndAppendToCache(instance, FF_RESOLUTION_MODULE_NAME, moduleIndex, &instance->config.resolutionKey, cache, &value, &instance->config.resolutionFormat, FF_RESOLUTION_NUM_FORMAT_ARGS, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_INT, &width},
{FF_FORMAT_ARG_TYPE_INT, &height},
{FF_FORMAT_ARG_TYPE_INT, &refreshRate}
});
}
void ffPrintResolution(FFinstance* instance)
{
if(ffPrintFromCache(instance, FF_RESOLUTION_MODULE_NAME, &instance->config.resolutionKey, &instance->config.resolutionFormat, FF_RESOLUTION_NUM_FORMAT_ARGS))
return;
if(ffPrintResolutionWaylandBackend(instance))
return;
if(ffPrintResolutionXrandrBackend(instance))
return;
ffPrintResolutionX11Backend(instance);
}