mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Display: detect scaled resolution (Windows)
This commit is contained in:
@@ -4,6 +4,26 @@
|
||||
#include <dwmapi.h>
|
||||
#include <WinUser.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WCHAR* deviceName;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} DataBundle;
|
||||
|
||||
static WINBOOL enumMonitorProc(HMONITOR hMonitor, FF_MAYBE_UNUSED HDC hDC, FF_MAYBE_UNUSED LPRECT rc, LPARAM lparam)
|
||||
{
|
||||
MONITORINFOEXW mi = { .cbSize = sizeof(mi) };
|
||||
DataBundle* data = (DataBundle*) lparam;
|
||||
if(GetMonitorInfoW(hMonitor, (MONITORINFO *)&mi) && wcscmp(mi.szDevice, data->deviceName) == 0)
|
||||
{
|
||||
data->width = (uint32_t) mi.rcMonitor.right;
|
||||
data->height = (uint32_t) mi.rcMonitor.bottom;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* instance)
|
||||
{
|
||||
FF_UNUSED(instance);
|
||||
@@ -34,7 +54,13 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins
|
||||
if(EnumDisplaySettingsW(displayDevice.DeviceName, ENUM_CURRENT_SETTINGS, &devMode) == 0)
|
||||
continue;
|
||||
|
||||
ffdsAppendDisplay(ds, devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmDisplayFrequency, 0, 0);
|
||||
DataBundle data = {
|
||||
.deviceName = displayDevice.DeviceName,
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
};
|
||||
EnumDisplayMonitors(NULL, NULL, enumMonitorProc, (LPARAM)&data);
|
||||
ffdsAppendDisplay(ds, devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmDisplayFrequency, data.width, data.height);
|
||||
}
|
||||
|
||||
//https://github.com/hykilpikonna/hyfetch/blob/master/neofetch#L2067
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings>
|
||||
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware>
|
||||
<heapType xmlns="http://schemas.microsoft.com/SMI/2020/WindowsSettings">SegmentHeap</heapType>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
|
||||
Reference in New Issue
Block a user