mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
PhysicalDisplay: rename module to Monitor
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#include "fastfetch.h"
|
||||
|
||||
typedef struct FFPhysicalDisplayResult
|
||||
typedef struct FFMonitorResult
|
||||
{
|
||||
FFstrbuf name;
|
||||
uint32_t width; // native / maximum resolution, in pixels
|
||||
uint32_t height; // native / maximum resolution, in pixels
|
||||
uint32_t physicalWidth; // in mm
|
||||
uint32_t physicalHeight; // in mm
|
||||
} FFPhysicalDisplayResult;
|
||||
} FFMonitorResult;
|
||||
|
||||
const char* ffDetectPhysicalDisplay(FFlist* results);
|
||||
const char* ffDetectMonitor(FFlist* results);
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
#include "physicaldisplay.h"
|
||||
#include "monitor.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "util/apple/cf_helpers.h"
|
||||
#include "util/apple/ddcci.h"
|
||||
@@ -23,18 +23,18 @@ static const char* detectWithDisplayServices(const FFDisplayServerResult* displa
|
||||
width <= 0 || height <= 0)
|
||||
continue;
|
||||
|
||||
FFPhysicalDisplayResult* physicalDisplay = (FFPhysicalDisplayResult*) ffListAdd(results);
|
||||
physicalDisplay->width = (uint32_t) width;
|
||||
physicalDisplay->height = (uint32_t) height;
|
||||
ffStrbufInit(&physicalDisplay->name);
|
||||
FFMonitorResult* monitor = (FFMonitorResult*) ffListAdd(results);
|
||||
monitor->width = (uint32_t) width;
|
||||
monitor->height = (uint32_t) height;
|
||||
ffStrbufInit(&monitor->name);
|
||||
|
||||
CFDictionaryRef productNames;
|
||||
if(!ffCfDictGetDict(displayInfo, CFSTR(kDisplayProductName), &productNames))
|
||||
ffCfDictGetString(productNames, CFSTR("en_US"), &physicalDisplay->name);
|
||||
ffCfDictGetString(productNames, CFSTR("en_US"), &monitor->name);
|
||||
|
||||
CGSize size = CGDisplayScreenSize((CGDirectDisplayID) display->id);
|
||||
physicalDisplay->physicalWidth = (uint32_t) (size.width + 0.5);
|
||||
physicalDisplay->physicalHeight = (uint32_t) (size.height + 0.5);
|
||||
monitor->physicalWidth = (uint32_t) (size.width + 0.5);
|
||||
monitor->physicalHeight = (uint32_t) (size.height + 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ static const char* detectWithDdcci(FFlist* results)
|
||||
ffEdidGetPhysicalResolution(edidData, &width, &height);
|
||||
if (width == 0 || height == 0) continue;
|
||||
|
||||
FFPhysicalDisplayResult* display = (FFPhysicalDisplayResult*) ffListAdd(results);
|
||||
FFMonitorResult* display = (FFMonitorResult*) ffListAdd(results);
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
ffStrbufInit(&display->name);
|
||||
@@ -101,7 +101,7 @@ static const char* detectWithDdcci(FFlist* results)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffDetectPhysicalDisplay(FFlist* results)
|
||||
const char* ffDetectMonitor(FFlist* results)
|
||||
{
|
||||
const FFDisplayServerResult* displayServer = ffConnectDisplayServer();
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
#include "physicaldisplay.h"
|
||||
#include "monitor.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "util/edidHelper.h"
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <dirent.h>
|
||||
|
||||
const char* ffDetectPhysicalDisplay(FFlist* results)
|
||||
const char* ffDetectMonitor(FFlist* results)
|
||||
{
|
||||
const char* drmDirPath = "/sys/class/drm/";
|
||||
|
||||
@@ -46,7 +46,7 @@ const char* ffDetectPhysicalDisplay(FFlist* results)
|
||||
if (tmp) plainName = tmp + 1;
|
||||
}
|
||||
|
||||
FFPhysicalDisplayResult* display = (FFPhysicalDisplayResult*) ffListAdd(results);
|
||||
FFMonitorResult* display = (FFMonitorResult*) ffListAdd(results);
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
ffStrbufInitS(&display->name, plainName);
|
||||
@@ -0,0 +1,6 @@
|
||||
#include "monitor.h"
|
||||
|
||||
const char* ffDetectMonitor(FF_MAYBE_UNUSED FFlist* results)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
#include "physicaldisplay.h"
|
||||
#include "monitor.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "util/edidHelper.h"
|
||||
@@ -16,7 +16,7 @@ static inline void wrapSetupDiDestroyDeviceInfoList(HDEVINFO* hdev)
|
||||
SetupDiDestroyDeviceInfoList(*hdev);
|
||||
}
|
||||
|
||||
const char* ffDetectPhysicalDisplay(FFlist* results)
|
||||
const char* ffDetectMonitor(FFlist* results)
|
||||
{
|
||||
//https://learn.microsoft.com/en-us/windows/win32/power/enumerating-battery-devices
|
||||
HDEVINFO hdev __attribute__((__cleanup__(wrapSetupDiDestroyDeviceInfoList))) =
|
||||
@@ -36,7 +36,7 @@ const char* ffDetectPhysicalDisplay(FFlist* results)
|
||||
ffEdidGetPhysicalResolution(edidData, &width, &height);
|
||||
if (width == 0 || height == 0) continue;
|
||||
|
||||
FFPhysicalDisplayResult* display = (FFPhysicalDisplayResult*) ffListAdd(results);
|
||||
FFMonitorResult* display = (FFMonitorResult*) ffListAdd(results);
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
ffStrbufInit(&display->name);
|
||||
@@ -1,6 +0,0 @@
|
||||
#include "physicaldisplay.h"
|
||||
|
||||
const char* ffDetectPhysicalDisplay(FF_MAYBE_UNUSED FFlist* results)
|
||||
{
|
||||
return "Not supported on this platform";
|
||||
}
|
||||
Reference in New Issue
Block a user