mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:14:37 +02:00
Display (Windows): check for hdr enabled & bit depth
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "displayserver.h"
|
||||
|
||||
bool ffdsAppendDisplay(
|
||||
FFDisplayResult* ffdsAppendDisplay(
|
||||
FFDisplayServerResult* result,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
@@ -16,7 +16,7 @@ bool ffdsAppendDisplay(
|
||||
uint32_t physicalHeight)
|
||||
{
|
||||
if(width == 0 || height == 0)
|
||||
return false;
|
||||
return NULL;
|
||||
|
||||
FFDisplayResult* display = ffListAdd(&result->displays);
|
||||
display->width = width;
|
||||
@@ -27,12 +27,15 @@ bool ffdsAppendDisplay(
|
||||
display->rotation = rotation;
|
||||
ffStrbufInitMove(&display->name, name);
|
||||
display->type = type;
|
||||
display->primary = primary;
|
||||
display->id = id;
|
||||
display->physicalWidth = physicalWidth;
|
||||
display->physicalHeight = physicalHeight;
|
||||
display->primary = primary;
|
||||
|
||||
return true;
|
||||
display->bitDepth = 0;
|
||||
display->hdrEnabled = false;
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds);
|
||||
|
||||
@@ -58,10 +58,12 @@ typedef struct FFDisplayResult
|
||||
FFstrbuf name;
|
||||
FFDisplayType type;
|
||||
uint32_t rotation;
|
||||
bool primary;
|
||||
uint64_t id; // platform dependent
|
||||
uint32_t physicalWidth;
|
||||
uint32_t physicalHeight;
|
||||
bool primary;
|
||||
uint8_t bitDepth;
|
||||
bool hdrEnabled;
|
||||
} FFDisplayResult;
|
||||
|
||||
typedef struct FFDisplayServerResult
|
||||
@@ -76,7 +78,7 @@ typedef struct FFDisplayServerResult
|
||||
|
||||
const FFDisplayServerResult* ffConnectDisplayServer();
|
||||
|
||||
bool ffdsAppendDisplay(
|
||||
FFDisplayResult* ffdsAppendDisplay(
|
||||
FFDisplayServerResult* result,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
|
||||
@@ -146,7 +146,7 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
default: rotation = 0; break;
|
||||
}
|
||||
|
||||
ffdsAppendDisplay(ds,
|
||||
FFDisplayResult* display = ffdsAppendDisplay(ds,
|
||||
width,
|
||||
height,
|
||||
path->targetInfo.refreshRate.Numerator / (double) path->targetInfo.refreshRate.Denominator,
|
||||
@@ -164,6 +164,23 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
physicalWidth,
|
||||
physicalHeight
|
||||
);
|
||||
|
||||
if (display)
|
||||
{
|
||||
DISPLAYCONFIG_GET_ADVANCED_COLOR_INFO advColorInfo = {
|
||||
.header = {
|
||||
.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO,
|
||||
.size = sizeof(advColorInfo),
|
||||
.adapterId = path->targetInfo.adapterId,
|
||||
.id = path->targetInfo.id,
|
||||
}
|
||||
};
|
||||
if (DisplayConfigGetDeviceInfo(&advColorInfo.header) == ERROR_SUCCESS)
|
||||
{
|
||||
display->hdrEnabled = !!advColorInfo.advancedColorEnabled;
|
||||
display->bitDepth = (uint8_t) advColorInfo.bitsPerColorChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user