Skip to content

Commit

Permalink
config: fix explicit sync option warning (#7293)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikalco authored Aug 12, 2024
1 parent df9d830 commit d361fcb
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,9 +822,6 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
if (!isFirstLaunch)
g_pHyprOpenGL->m_bReloadScreenShader = true;

if (!isFirstLaunch && *PENABLEEXPLICIT != prevEnabledExplicit)
g_pHyprError->queueCreate("Warning: You changed the render:explicit_sync option, this requires you to restart Hyprland.", CColor(0.9, 0.76, 0.221, 1.0));

// parseError will be displayed next frame

if (result.error)
Expand All @@ -837,6 +834,8 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
else if (std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("autogenerated")) == 1)
g_pHyprError->queueCreate("Warning: You're using an autogenerated config! (config file: " + getMainConfigPath() + " )\nSUPER+Q -> kitty\nSUPER+M -> exit Hyprland",
CColor(1.0, 1.0, 70.0 / 255.0, 1.0));
else if (*PENABLEEXPLICIT != prevEnabledExplicit)
g_pHyprError->queueCreate("Warning: You changed the render:explicit_sync option, this requires you to restart Hyprland.", CColor(0.9, 0.76, 0.221, 1.0));
else
g_pHyprError->destroy();

Expand Down Expand Up @@ -925,14 +924,24 @@ void CConfigManager::init() {
}

std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::string& VALUE) {
const auto RET = m_pConfig->parseDynamic(COMMAND.c_str(), VALUE.c_str());
static const auto PENABLEEXPLICIT = CConfigValue<Hyprlang::INT>("render:explicit_sync");
static int prevEnabledExplicit = *PENABLEEXPLICIT;

const auto RET = m_pConfig->parseDynamic(COMMAND.c_str(), VALUE.c_str());

// invalidate layouts if they changed
if (COMMAND == "monitor" || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) {
for (auto& m : g_pCompositor->m_vMonitors)
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
}

if (COMMAND.contains("explicit")) {
if (*PENABLEEXPLICIT != prevEnabledExplicit)
g_pHyprError->queueCreate("Warning: You changed the render:explicit_sync option, this requires you to restart Hyprland.", CColor(0.9, 0.76, 0.221, 1.0));
else
g_pHyprError->destroy();
}

// Update window border colors
g_pCompositor->updateAllWindowsAnimatedDecorationValues();

Expand Down

0 comments on commit d361fcb

Please sign in to comment.