Added toggleopaque dispatcher

This commit is contained in:
vaxerski 2022-07-28 12:07:41 +02:00
parent 3904351678
commit 9dd17a4be6
4 changed files with 18 additions and 0 deletions

View file

@ -16,6 +16,7 @@ struct SWindowAdditionalConfigData {
std::string animationStyle = "";
int rounding = -1; // -1 means no
bool forceNoBlur = false;
bool forceOpaque = false;
};
class CWindow {

View file

@ -35,6 +35,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["submap"] = setSubmap;
m_mDispatchers["pass"] = pass;
m_mDispatchers["layoutmsg"] = layoutmsg;
m_mDispatchers["toggleopaque"] = toggleOpaque;
m_tScrollTimer.reset();
}
@ -1310,3 +1311,14 @@ void CKeybindManager::layoutmsg(std::string msg) {
SLayoutMessageHeader hd = {g_pCompositor->m_pLastWindow};
g_pLayoutManager->getCurrentLayout()->layoutMessage(hd, msg);
}
void CKeybindManager::toggleOpaque(std::string unused) {
const auto PWINDOW = g_pCompositor->m_pLastWindow;
if (!g_pCompositor->windowValidMapped(PWINDOW))
return;
PWINDOW->m_sAdditionalConfigData.forceOpaque = !PWINDOW->m_sAdditionalConfigData.forceOpaque;
g_pHyprRenderer->damageWindow(PWINDOW);
}

View file

@ -97,6 +97,7 @@ private:
static void setSubmap(std::string);
static void pass(std::string);
static void layoutmsg(std::string);
static void toggleOpaque(std::string);
friend class CCompositor;
};

View file

@ -197,6 +197,10 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
else
renderdata.alpha *= pWindow == g_pCompositor->m_pLastWindow ? pWindow->m_sSpecialRenderData.alpha : pWindow->m_sSpecialRenderData.alphaInactive;
// apply opaque
if (pWindow->m_sAdditionalConfigData.forceOpaque)
renderdata.alpha = 1.f;
g_pHyprOpenGL->m_pCurrentWindow = pWindow;
// render window decorations first, if not fullscreen full