mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 14:35:57 +01:00
config: add screencopy:max_fps
This commit is contained in:
parent
12af841341
commit
ccabd97be3
2 changed files with 9 additions and 2 deletions
|
@ -212,6 +212,7 @@ CPortalManager::CPortalManager() {
|
||||||
m_sConfig.config = std::make_unique<Hyprlang::CConfig>(path.c_str(), Hyprlang::SConfigOptions{.allowMissingConfig = true});
|
m_sConfig.config = std::make_unique<Hyprlang::CConfig>(path.c_str(), Hyprlang::SConfigOptions{.allowMissingConfig = true});
|
||||||
|
|
||||||
m_sConfig.config->addConfigValue("general:toplevel_dynamic_bind", Hyprlang::INT{0L});
|
m_sConfig.config->addConfigValue("general:toplevel_dynamic_bind", Hyprlang::INT{0L});
|
||||||
|
m_sConfig.config->addConfigValue("screencopy:max_fps", Hyprlang::INT{120L});
|
||||||
|
|
||||||
m_sConfig.config->commence();
|
m_sConfig.config->commence();
|
||||||
m_sConfig.config->parse();
|
m_sConfig.config->parse();
|
||||||
|
|
|
@ -491,8 +491,14 @@ void CScreencopyPortal::onSelectSources(sdbus::MethodCall& call) {
|
||||||
} else if (SHAREDATA.type == TYPE_OUTPUT || SHAREDATA.type == TYPE_GEOMETRY) {
|
} else if (SHAREDATA.type == TYPE_OUTPUT || SHAREDATA.type == TYPE_GEOMETRY) {
|
||||||
const auto POUTPUT = g_pPortalManager->getOutputFromName(SHAREDATA.output);
|
const auto POUTPUT = g_pPortalManager->getOutputFromName(SHAREDATA.output);
|
||||||
|
|
||||||
if (POUTPUT)
|
if (POUTPUT) {
|
||||||
|
static auto* const* PFPS = (Hyprlang::INT* const*)g_pPortalManager->m_sConfig.config->getConfigValuePtr("screencopy:max_fps")->getDataStaticPtr();
|
||||||
|
|
||||||
|
if (**PFPS <= 0)
|
||||||
PSESSION->sharingData.framerate = POUTPUT->refreshRate;
|
PSESSION->sharingData.framerate = POUTPUT->refreshRate;
|
||||||
|
else
|
||||||
|
PSESSION->sharingData.framerate = std::clamp(POUTPUT->refreshRate, 1.F, (float)**PFPS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PSESSION->selection = SHAREDATA;
|
PSESSION->selection = SHAREDATA;
|
||||||
|
|
Loading…
Reference in a new issue