WindowInfo: Get refresh rate from monitor config

DwmGetCompositionTimingInfo() returns a noisy refresh rate, at least on
Win11 22H2.
This commit is contained in:
Stenzek
2024-05-22 22:16:29 +10:00
parent f9b58c4077
commit d9cc80c7f9
9 changed files with 131 additions and 59 deletions

View File

@@ -1,10 +1,13 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "gpu_texture.h"
#include "common/types.h"
#include <optional>
// Contains the information required to create a graphics context in a window.
struct WindowInfo
{
@@ -38,5 +41,5 @@ struct WindowInfo
// Changes the window to be surfaceless (i.e. no handle/size/etc).
void SetSurfaceless();
static bool QueryRefreshRateForWindow(const WindowInfo& wi, float* refresh_rate);
static std::optional<float> QueryRefreshRateForWindow(const WindowInfo& wi);
};