mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-21 23:45:58 +01:00
Normalize color storage
Colors are now normalized to 0 - 1 values instead of 0 - 255 causes calculations to be simpler and generally cleans up the codebase.
This commit is contained in:
parent
0e3547e0f6
commit
96198dae55
18 changed files with 71 additions and 72 deletions
|
@ -1489,11 +1489,9 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
|||
if (RENDERDATA.isBorderGradient)
|
||||
setBorderColor(*RENDERDATA.borderGradient);
|
||||
else
|
||||
setBorderColor(
|
||||
pWindow == m_pLastWindow ?
|
||||
(pWindow->m_sSpecialRenderData.activeBorderColor >= 0 ? CGradientValueData(CColor(pWindow->m_sSpecialRenderData.activeBorderColor) * (1.f / 255.f)) : *ACTIVECOL) :
|
||||
(pWindow->m_sSpecialRenderData.inactiveBorderColor >= 0 ? CGradientValueData(CColor(pWindow->m_sSpecialRenderData.inactiveBorderColor) * (1.f / 255.f)) :
|
||||
*INACTIVECOL));
|
||||
setBorderColor(pWindow == m_pLastWindow ?
|
||||
(pWindow->m_sSpecialRenderData.activeBorderColor >= 0 ? CGradientValueData(CColor(pWindow->m_sSpecialRenderData.activeBorderColor)) : *ACTIVECOL) :
|
||||
(pWindow->m_sSpecialRenderData.inactiveBorderColor >= 0 ? CGradientValueData(CColor(pWindow->m_sSpecialRenderData.inactiveBorderColor)) : *INACTIVECOL));
|
||||
|
||||
// opacity
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||
|
@ -1814,13 +1812,13 @@ void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode
|
|||
if (w->m_iWorkspaceID == pWindow->m_iWorkspaceID) {
|
||||
w->m_bCreatedOverFullscreen = false;
|
||||
if (w.get() != pWindow && !w->m_bFadingOut && !w->m_bPinned)
|
||||
w->m_fAlpha = pWindow->m_bIsFullscreen ? 0.f : 255.f;
|
||||
w->m_fAlpha = pWindow->m_bIsFullscreen ? 0.f : 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||
if (!ls->fadingOut)
|
||||
ls->alpha = pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL ? 0.f : 255.f;
|
||||
ls->alpha = pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL ? 0.f : 1.f;
|
||||
}
|
||||
|
||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv(), true);
|
||||
|
|
|
@ -17,7 +17,7 @@ interface ICustomConfigValueData {
|
|||
class CGradientValueData : public ICustomConfigValueData {
|
||||
public:
|
||||
CGradientValueData(CColor col) {
|
||||
m_vColors.push_back(col * (1.f / 255.f));
|
||||
m_vColors.push_back(col);
|
||||
};
|
||||
virtual ~CGradientValueData(){};
|
||||
|
||||
|
@ -27,7 +27,7 @@ class CGradientValueData : public ICustomConfigValueData {
|
|||
|
||||
void reset(CColor col) {
|
||||
m_vColors.clear();
|
||||
m_vColors.emplace_back(col * (1.f / 255.f));
|
||||
m_vColors.emplace_back(col);
|
||||
m_fAngle = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ void CConfigManager::configSetValueSafe(const std::string& COMMAND, const std::s
|
|||
}
|
||||
|
||||
try {
|
||||
data->m_vColors.push_back(CColor(configStringToInt(var)) * (1.f / 255.f));
|
||||
data->m_vColors.push_back(CColor(configStringToInt(var)));
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(WARN, "Error reading value of %s", COMMAND.c_str());
|
||||
parseError = "Error setting value <" + VALUE + "> for field <" + COMMAND + ">. " + e.what();
|
||||
|
@ -1247,10 +1247,10 @@ void CConfigManager::loadConfigLoadVars() {
|
|||
|
||||
// parseError will be displayed next frame
|
||||
if (parseError != "")
|
||||
g_pHyprError->queueCreate(parseError + "\nHyprland may not work correctly.", CColor(255, 50, 50, 255));
|
||||
g_pHyprError->queueCreate(parseError + "\nHyprland may not work correctly.", CColor(1.0, 50.0 / 255.0, 50.0 / 255.0, 1.0));
|
||||
else if (configValues["autogenerated"].intValue == 1)
|
||||
g_pHyprError->queueCreate("Warning: You're using an autogenerated config! (config file: " + CONFIGPATH + " )\nSUPER+Q -> kitty\nSUPER+M -> exit Hyprland",
|
||||
CColor(255, 255, 70, 255));
|
||||
CColor(1.0, 1.0, 70.0 / 255.0, 1.0));
|
||||
else
|
||||
g_pHyprError->destroy();
|
||||
|
||||
|
|
|
@ -183,5 +183,5 @@ void CHyprDebugOverlay::draw() {
|
|||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecSize.x, PMONITOR->vecSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
|
||||
|
||||
wlr_box pMonBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
|
||||
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 255.f);
|
||||
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
|
|||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
|
||||
layersurface->alpha.setValue(0);
|
||||
layersurface->alpha = 255.f;
|
||||
layersurface->alpha = 1.f;
|
||||
layersurface->readyToDelete = false;
|
||||
layersurface->fadingOut = false;
|
||||
|
||||
|
@ -241,7 +241,7 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
|
||||
geomFixed = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->surface->current.width,
|
||||
(int)layersurface->layerSurface->surface->current.height};
|
||||
(int)layersurface->layerSurface->surface->current.height};
|
||||
layersurface->geometry = geomFixed; // because the surface can overflow... for some reason?
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||
if (PMONITOR->isMirror()) {
|
||||
g_pHyprOpenGL->renderMirrored();
|
||||
} else {
|
||||
g_pHyprOpenGL->clear(CColor(17, 17, 17, 255));
|
||||
g_pHyprOpenGL->clear(CColor(17.0 / 255.0, 17.0 / 255.0, 17.0 / 255.0, 1.0));
|
||||
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
|
||||
|
||||
g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now);
|
||||
|
@ -257,7 +257,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||
|
||||
if (*PDAMAGEBLINK && damageBlinkCleanup == 0) {
|
||||
wlr_box monrect = {0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
|
||||
g_pHyprOpenGL->renderRect(&monrect, CColor(255, 0, 255, 100), 0);
|
||||
g_pHyprOpenGL->renderRect(&monrect, CColor(1.0, 0.0, 1.0, 100.0 / 255.0), 0);
|
||||
damageBlinkCleanup = 1;
|
||||
} else if (*PDAMAGEBLINK) {
|
||||
damageBlinkCleanup++;
|
||||
|
|
|
@ -455,7 +455,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
// do the animation thing
|
||||
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, false);
|
||||
PWINDOW->m_fAlpha.setValueAndWarp(0.f);
|
||||
PWINDOW->m_fAlpha = 255.f;
|
||||
PWINDOW->m_fAlpha = 1.f;
|
||||
|
||||
PWINDOW->m_vRealPosition.setCallbackOnEnd(setAnimToMove);
|
||||
PWINDOW->m_vRealSize.setCallbackOnEnd(setAnimToMove);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
CColor::CColor() {}
|
||||
|
||||
CColor::CColor(float r, float g, float b, float a) {
|
||||
RASSERT(r <= 1.f && g <= 1.f && b <= 1.f && a <= 1.f, "un-normalized color assignment");
|
||||
this->r = r;
|
||||
this->g = g;
|
||||
this->b = b;
|
||||
|
@ -11,10 +12,10 @@ CColor::CColor(float r, float g, float b, float a) {
|
|||
}
|
||||
|
||||
CColor::CColor(uint64_t hex) {
|
||||
this->r = RED(hex) * 255.f;
|
||||
this->g = GREEN(hex) * 255.f;
|
||||
this->b = BLUE(hex) * 255.f;
|
||||
this->a = ALPHA(hex) * 255.f;
|
||||
this->r = RED(hex);
|
||||
this->g = GREEN(hex);
|
||||
this->b = BLUE(hex);
|
||||
this->a = ALPHA(hex);
|
||||
}
|
||||
|
||||
uint64_t CColor::getAsHex() {
|
||||
|
|
|
@ -8,12 +8,12 @@ class CColor {
|
|||
CColor(float, float, float, float);
|
||||
CColor(uint64_t);
|
||||
|
||||
float r = 0, g = 0, b = 0, a = 255;
|
||||
float r = 0, g = 0, b = 0, a = 1.f;
|
||||
|
||||
uint64_t getAsHex();
|
||||
|
||||
CColor operator-(const CColor& c2) const {
|
||||
return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a);
|
||||
return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a);
|
||||
}
|
||||
|
||||
CColor operator+(const CColor& c2) const {
|
||||
|
|
|
@ -57,7 +57,7 @@ struct SRenderData {
|
|||
bool dontRound = true;
|
||||
|
||||
// for fade
|
||||
float fadeAlpha = 255.f;
|
||||
float fadeAlpha = 1.f;
|
||||
|
||||
// for alpha settings
|
||||
float alpha = 1.f;
|
||||
|
|
|
@ -31,7 +31,7 @@ CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
|
|||
m_fAlpha.m_pWorkspace = this;
|
||||
m_fAlpha.create(AVARTYPE_FLOAT, special ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"),
|
||||
nullptr, AVARDAMAGE_ENTIRE);
|
||||
m_fAlpha.setValueAndWarp(255.f);
|
||||
m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
m_vRenderOffset.registerVar();
|
||||
m_fAlpha.registerVar();
|
||||
|
@ -61,16 +61,16 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
|
||||
if (in) {
|
||||
m_fAlpha.setValueAndWarp(0.f);
|
||||
m_fAlpha = 255.f;
|
||||
m_fAlpha = 1.f;
|
||||
} else {
|
||||
m_fAlpha.setValueAndWarp(255.f);
|
||||
m_fAlpha.setValueAndWarp(1.f);
|
||||
m_fAlpha = 0.f;
|
||||
}
|
||||
} else if (ANIMSTYLE == "slidevert") {
|
||||
// fallback is slide
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||
|
||||
m_fAlpha.setValueAndWarp(255.f); // fix a bug, if switching from fade -> slide.
|
||||
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
||||
|
||||
if (in) {
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y));
|
||||
|
@ -82,7 +82,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
// fallback is slide
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||
|
||||
m_fAlpha.setValueAndWarp(255.f); // fix a bug, if switching from fade -> slide.
|
||||
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
||||
|
||||
if (in) {
|
||||
m_vRenderOffset.setValueAndWarp(Vector2D(left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
|
||||
|
@ -102,7 +102,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||
if (!ls->fadingOut)
|
||||
ls->alpha = m_bHasFullscreenWindow && m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 255.f;
|
||||
ls->alpha = m_bHasFullscreenWindow && m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ void CHyprError::createQueued() {
|
|||
|
||||
const auto LINECOUNT = 1 + std::count(m_szQueued.begin(), m_szQueued.end(), '\n');
|
||||
|
||||
cairo_set_source_rgba(CAIRO, m_cQueued.r / 255.f, m_cQueued.g / 255.f, m_cQueued.b / 255.f, m_cQueued.a / 255.f);
|
||||
cairo_set_source_rgba(CAIRO, m_cQueued.r, m_cQueued.g, m_cQueued.b, m_cQueued.a);
|
||||
cairo_rectangle(CAIRO, 0, 0, PMONITOR->vecPixelSize.x, (FONTSIZE + 2 * (FONTSIZE / 10.f)) * LINECOUNT);
|
||||
|
||||
// outline
|
||||
|
@ -39,11 +39,11 @@ void CHyprError::createQueued() {
|
|||
cairo_fill(CAIRO);
|
||||
|
||||
// draw the text with a common font
|
||||
const CColor textColor = m_cQueued.r * m_cQueued.g * m_cQueued.b < 0.5f ? CColor(255, 255, 255, 255) : CColor(0, 0, 0, 255);
|
||||
const CColor textColor = m_cQueued.r * m_cQueued.g * m_cQueued.b < 0.5f ? CColor(1.0, 1.0, 1.0, 1.0) : CColor(0, 0, 0, 1.0);
|
||||
|
||||
cairo_select_font_face(CAIRO, "Noto Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
cairo_set_font_size(CAIRO, FONTSIZE);
|
||||
cairo_set_source_rgba(CAIRO, textColor.r / 255.f, textColor.g / 255.f, textColor.b / 255.f, textColor.a / 255.f);
|
||||
cairo_set_source_rgba(CAIRO, textColor.r, textColor.g, textColor.b, textColor.a);
|
||||
|
||||
float yoffset = FONTSIZE;
|
||||
while (m_szQueued != "") {
|
||||
|
@ -107,7 +107,7 @@ void CHyprError::draw() {
|
|||
|
||||
wlr_box windowBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
|
||||
|
||||
g_pHyprOpenGL->renderTexture(m_tTexture, &windowBox, 255.f, 0);
|
||||
g_pHyprOpenGL->renderTexture(m_tTexture, &windowBox, 1.f, 0);
|
||||
}
|
||||
|
||||
void CHyprError::destroy() {
|
||||
|
|
|
@ -126,7 +126,7 @@ void CKeybindManager::updateXKBTranslationState() {
|
|||
if (!PKEYMAP) {
|
||||
g_pHyprError->queueCreate("[Runtime Error] Invalid keyboard layout passed. ( rules: " + RULES + ", model: " + MODEL + ", variant: " + VARIANT + ", options: " + OPTIONS +
|
||||
", layout: " + LAYOUT + " )",
|
||||
CColor(255, 50, 50, 255));
|
||||
CColor(1.0, 50.0 / 255.0, 50.0 / 255.0, 1.0));
|
||||
|
||||
Debug::log(ERR, "[XKBTranslationState] Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant,
|
||||
rules.rules, rules.model, rules.options);
|
||||
|
@ -1017,10 +1017,10 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
|||
PWORKSPACE->m_fAlpha.setValueAndWarp(0.f);
|
||||
|
||||
POLDWORKSPACEIDRETURN->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
POLDWORKSPACEIDRETURN->m_fAlpha.setValueAndWarp(255.f);
|
||||
POLDWORKSPACEIDRETURN->m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
POLDWORKSPACEONMON->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||
POLDWORKSPACEONMON->m_fAlpha.setValueAndWarp(255.f);
|
||||
POLDWORKSPACEONMON->m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
g_pEventManager->m_bIgnoreEvents = false;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void CInputManager::beginWorkspaceSwipe() {
|
|||
|
||||
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
||||
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||
ls->alpha = 255.f;
|
||||
ls->alpha = 1.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,14 +110,14 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||
}
|
||||
|
||||
PWORKSPACEL->m_vRenderOffset.setValue(RENDEROFFSET);
|
||||
PWORKSPACEL->m_fAlpha.setValueAndWarp(255.f);
|
||||
PWORKSPACEL->m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValue(RENDEROFFSETMIDDLE);
|
||||
if (VERTANIMS)
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0, m_sActiveSwipe.pMonitor->vecSize.y);
|
||||
else
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(m_sActiveSwipe.pMonitor->vecSize.x, 0);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(255.f);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
g_pInputManager->unconstrainMouse();
|
||||
|
||||
|
@ -136,14 +136,14 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||
}
|
||||
|
||||
PWORKSPACER->m_vRenderOffset.setValue(RENDEROFFSET);
|
||||
PWORKSPACER->m_fAlpha.setValueAndWarp(255.f);
|
||||
PWORKSPACER->m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValue(RENDEROFFSETMIDDLE);
|
||||
if (VERTANIMS)
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(0, -m_sActiveSwipe.pMonitor->vecSize.y);
|
||||
else
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(-m_sActiveSwipe.pMonitor->vecSize.x, 0);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(255.f);
|
||||
m_sActiveSwipe.pWorkspaceBegin->m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
g_pInputManager->unconstrainMouse();
|
||||
|
||||
|
@ -166,7 +166,7 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
|||
|
||||
// apply alpha
|
||||
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||
ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 255.f;
|
||||
ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
|||
}
|
||||
|
||||
PWORKSPACE->m_bForceRendering = true;
|
||||
PWORKSPACE->m_fAlpha.setValueAndWarp(255.f);
|
||||
PWORKSPACE->m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
if (workspaceIDLeft != workspaceIDRight) {
|
||||
const auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight);
|
||||
|
@ -271,7 +271,7 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
|||
}
|
||||
|
||||
PWORKSPACE->m_bForceRendering = true;
|
||||
PWORKSPACE->m_fAlpha.setValueAndWarp(255.f);
|
||||
PWORKSPACE->m_fAlpha.setValueAndWarp(1.f);
|
||||
|
||||
if (workspaceIDLeft != workspaceIDRight) {
|
||||
const auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
|
||||
|
|
|
@ -348,7 +348,7 @@ bool CToplevelExportProtocolManager::copyFrameShm(SToplevelFrame* frame, timespe
|
|||
pixman_region32_init_rect(&fakeDamage, 0, 0, PMONITOR->vecPixelSize.x * 10, PMONITOR->vecPixelSize.y * 10);
|
||||
|
||||
g_pHyprOpenGL->begin(PMONITOR, &fakeDamage, true);
|
||||
g_pHyprOpenGL->clear(CColor(0, 0, 0, 255));
|
||||
g_pHyprOpenGL->clear(CColor(0, 0, 0, 1.0));
|
||||
|
||||
// render client at 0,0
|
||||
g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(frame->pWindow); // block the feedback to avoid spamming the surface if it's visible
|
||||
|
|
|
@ -151,12 +151,12 @@ void CHyprOpenGLImpl::end() {
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, m_iWLROutputFb);
|
||||
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
||||
|
||||
clear(CColor(11, 11, 11, 255));
|
||||
clear(CColor(11.0 / 255.0, 11.0 / 255.0, 11.0 / 255.0, 1.0));
|
||||
|
||||
m_bEndFrame = true;
|
||||
m_bApplyFinalShader = true;
|
||||
|
||||
renderTexture(m_RenderData.pCurrentMonData->primaryFB.m_cTex, &monbox, 255.f, 0);
|
||||
renderTexture(m_RenderData.pCurrentMonData->primaryFB.m_cTex, &monbox, 1.f, 0);
|
||||
|
||||
m_bApplyFinalShader = false;
|
||||
m_bEndFrame = false;
|
||||
|
@ -310,7 +310,7 @@ void CHyprOpenGLImpl::applyScreenShader(const std::string& path) {
|
|||
void CHyprOpenGLImpl::clear(const CColor& color) {
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to render without begin()!");
|
||||
|
||||
glClearColor(color.r / 255.f, color.g / 255.f, color.b / 255.f, color.a / 255.f);
|
||||
glClearColor(color.r, color.g, color.b, color.a);
|
||||
|
||||
if (pixman_region32_not_empty(m_RenderData.pDamage)) {
|
||||
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
||||
|
@ -391,7 +391,7 @@ void CHyprOpenGLImpl::renderRectWithDamage(wlr_box* box, const CColor& col, pixm
|
|||
wlr_matrix_transpose(glMatrix, glMatrix);
|
||||
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
||||
#endif
|
||||
glUniform4f(m_RenderData.pCurrentMonData->m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
||||
glUniform4f(m_RenderData.pCurrentMonData->m_shQUAD.color, col.r, col.g, col.b, col.a);
|
||||
|
||||
wlr_box transformedBox;
|
||||
wlr_box_transform(&transformedBox, box, wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
|
||||
|
@ -460,6 +460,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||
bool allowCustomUV, bool allowDim) {
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
||||
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
|
||||
RASSERT(alpha <= 1.0, "Tried to render texture with a > 1");
|
||||
|
||||
if (!pixman_region32_not_empty(m_RenderData.pDamage))
|
||||
return;
|
||||
|
@ -508,7 +509,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
|||
#endif
|
||||
glUniform1i(shader->tex, 0);
|
||||
if (!usingFinalShader) {
|
||||
glUniform1f(shader->alpha, alpha / 255.f);
|
||||
glUniform1f(shader->alpha, alpha);
|
||||
glUniform1i(shader->discardOpaque, (int)discardOpaque);
|
||||
}
|
||||
|
||||
|
@ -640,7 +641,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
|||
wlr_matrix_transpose(glMatrix, glMatrix);
|
||||
glUniformMatrix3fv(pShader->proj, 1, GL_FALSE, glMatrix);
|
||||
#endif
|
||||
glUniform1f(pShader->radius, *PBLURSIZE * (a / 255.f)); // this makes the blursize change with a
|
||||
glUniform1f(pShader->radius, *PBLURSIZE * a); // this makes the blursize change with a
|
||||
if (pShader == &m_RenderData.pCurrentMonData->m_shBLUR1)
|
||||
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR1.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f),
|
||||
0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f));
|
||||
|
@ -739,9 +740,9 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
|
|||
pixman_region32_t inverseOpaque;
|
||||
pixman_region32_init(&inverseOpaque);
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||
const float A = pWindow->m_fAlpha.fl() * pWindow->m_fActiveInactiveAlpha.fl() * PWORKSPACE->m_fAlpha.fl() / 255.f;
|
||||
const float A = pWindow->m_fAlpha.fl() * pWindow->m_fActiveInactiveAlpha.fl() * PWORKSPACE->m_fAlpha.fl();
|
||||
|
||||
if (A >= 255.f) {
|
||||
if (A >= 1.f) {
|
||||
pixman_box32_t surfbox = {0, 0, PSURFACE->current.width, PSURFACE->current.height};
|
||||
pixman_region32_copy(&inverseOpaque, &PSURFACE->current.opaque);
|
||||
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &surfbox);
|
||||
|
@ -784,7 +785,7 @@ void CHyprOpenGLImpl::preBlurForCurrentMonitor() {
|
|||
pixman_region32_t fakeDamage;
|
||||
pixman_region32_init_rect(&fakeDamage, 0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y);
|
||||
wlr_box wholeMonitor = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
||||
const auto POUTFB = blurMainFramebufferWithDamage(255, &wholeMonitor, &fakeDamage);
|
||||
const auto POUTFB = blurMainFramebufferWithDamage(1, &wholeMonitor, &fakeDamage);
|
||||
|
||||
// render onto blurFB
|
||||
m_RenderData.pCurrentMonData->blurFB.alloc(m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y);
|
||||
|
@ -793,7 +794,7 @@ void CHyprOpenGLImpl::preBlurForCurrentMonitor() {
|
|||
clear(CColor(0, 0, 0, 0));
|
||||
|
||||
m_bEndFrame = true; // fix transformed
|
||||
renderTextureInternalWithDamage(POUTFB->m_cTex, &wholeMonitor, 255, &fakeDamage, 0, false, true, false);
|
||||
renderTextureInternalWithDamage(POUTFB->m_cTex, &wholeMonitor, 1, &fakeDamage, 0, false, true, false);
|
||||
m_bEndFrame = false;
|
||||
|
||||
pixman_region32_fini(&fakeDamage);
|
||||
|
@ -839,7 +840,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||
// amazing hack: the surface has an opaque region!
|
||||
pixman_region32_t inverseOpaque;
|
||||
pixman_region32_init(&inverseOpaque);
|
||||
if (a >= 255.f) {
|
||||
if (a >= 1.f) {
|
||||
pixman_box32_t surfbox = {0, 0, pSurface->current.width * pSurface->current.scale, pSurface->current.height * pSurface->current.scale};
|
||||
pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque);
|
||||
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &surfbox);
|
||||
|
@ -906,7 +907,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||
// render our great blurred FB
|
||||
static auto* const PBLURIGNOREOPACITY = &g_pConfigManager->getConfigValuePtr("decoration:blur_ignore_opacity")->intValue;
|
||||
m_bEndFrame = true; // fix transformed
|
||||
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, *PBLURIGNOREOPACITY ? 255.f : a, &damage, 0, false, false, false);
|
||||
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, *PBLURIGNOREOPACITY ? 1.f : a, &damage, 0, false, false, false);
|
||||
m_bEndFrame = false;
|
||||
|
||||
// render the window, but clear stencil
|
||||
|
@ -1316,7 +1317,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(wlr_box* box, int round, int range, fl
|
|||
wlr_matrix_transpose(glMatrix, glMatrix);
|
||||
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shSHADOW.proj, 1, GL_FALSE, glMatrix);
|
||||
#endif
|
||||
glUniform4f(m_RenderData.pCurrentMonData->m_shSHADOW.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f * a);
|
||||
glUniform4f(m_RenderData.pCurrentMonData->m_shSHADOW.color, col.r, col.g, col.b, col.a * a);
|
||||
|
||||
const auto TOPLEFT = Vector2D(range + round, range + round);
|
||||
const auto BOTTOMRIGHT = Vector2D(box->width - (range + round), box->height - (range + round));
|
||||
|
@ -1369,7 +1370,7 @@ void CHyprOpenGLImpl::saveBufferForMirror() {
|
|||
|
||||
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
|
||||
|
||||
renderTexture(m_RenderData.pCurrentMonData->primaryFB.m_cTex, &monbox, 255.f, 0, false, false);
|
||||
renderTexture(m_RenderData.pCurrentMonData->primaryFB.m_cTex, &monbox, 1.f, 0, false, false);
|
||||
|
||||
m_RenderData.pCurrentMonData->primaryFB.bind();
|
||||
}
|
||||
|
@ -1382,7 +1383,7 @@ void CHyprOpenGLImpl::renderMirrored() {
|
|||
if (PFB->m_cTex.m_iTexID <= 0)
|
||||
return;
|
||||
|
||||
renderTexture(PFB->m_cTex, &monbox, 255.f, 0, false, false);
|
||||
renderTexture(PFB->m_cTex, &monbox, 1.f, 0, false, false);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const CAIROSURFACE, double offsetY) {
|
||||
|
@ -1502,7 +1503,7 @@ void CHyprOpenGLImpl::clearWithTex() {
|
|||
}
|
||||
|
||||
if (TEXIT != m_mMonitorBGTextures.end())
|
||||
renderTexture(TEXIT->second, &m_mMonitorRenderResources[m_RenderData.pMonitor].backgroundTexBox, 255, 0);
|
||||
renderTexture(TEXIT->second, &m_mMonitorRenderResources[m_RenderData.pMonitor].backgroundTexBox, 1.0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
|
|||
rounding -= 1; // to fix a border issue
|
||||
|
||||
if (RDATA->surface && surface == RDATA->surface) {
|
||||
if (wlr_surface_is_xwayland_surface(surface) && !wlr_xwayland_surface_from_wlr_surface(surface)->has_alpha && RDATA->fadeAlpha * RDATA->alpha == 255.f) {
|
||||
if (wlr_surface_is_xwayland_surface(surface) && !wlr_xwayland_surface_from_wlr_surface(surface)->has_alpha && RDATA->fadeAlpha * RDATA->alpha == 1.f) {
|
||||
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
|
||||
} else {
|
||||
if (RDATA->blur)
|
||||
|
@ -243,7 +243,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
renderdata.w = std::max(pWindow->m_vRealSize.vec().x, 5.0); // clamp the size to min 5,
|
||||
renderdata.h = std::max(pWindow->m_vRealSize.vec().y, 5.0); // otherwise we'll have issues later with invalid boxes
|
||||
renderdata.dontRound = (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) || (!pWindow->m_sSpecialRenderData.rounding);
|
||||
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : (PWORKSPACE->m_fAlpha.fl() / 255.f));
|
||||
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (pWindow->m_bPinned ? 1.f : PWORKSPACE->m_fAlpha.fl());
|
||||
renderdata.alpha = pWindow->m_fActiveInactiveAlpha.fl();
|
||||
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders && (pWindow->m_bIsFloating ? *PNOFLOATINGBORDERS == 0 : true) &&
|
||||
(!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL);
|
||||
|
@ -253,7 +253,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
|
||||
if (ignoreAllGeometry) {
|
||||
renderdata.alpha = 1.f;
|
||||
renderdata.fadeAlpha = 255.f;
|
||||
renderdata.fadeAlpha = 1.f;
|
||||
}
|
||||
|
||||
// apply opaque
|
||||
|
@ -300,7 +300,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_MAIN) {
|
||||
if (!pWindow->m_bIsFullscreen || PWORKSPACE->m_efFullscreenMode != FULLSCREEN_FULL)
|
||||
for (auto& wd : pWindow->m_dWindowDecorations)
|
||||
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha / 255.f, offset);
|
||||
wd->draw(pMonitor, renderdata.alpha * renderdata.fadeAlpha, offset);
|
||||
|
||||
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata);
|
||||
|
||||
|
@ -312,7 +312,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
|
||||
auto grad = g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColor;
|
||||
const bool ANIMATED = g_pHyprOpenGL->m_pCurrentWindow->m_fBorderAnimationProgress.isBeingAnimated();
|
||||
float a1 = renderdata.fadeAlpha * renderdata.alpha / 255.f * (ANIMATED ? g_pHyprOpenGL->m_pCurrentWindow->m_fBorderAnimationProgress.fl() : 1.f);
|
||||
float a1 = renderdata.fadeAlpha * renderdata.alpha * (ANIMATED ? g_pHyprOpenGL->m_pCurrentWindow->m_fBorderAnimationProgress.fl() : 1.f);
|
||||
|
||||
wlr_box windowBox = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h};
|
||||
|
||||
|
@ -321,7 +321,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
|||
g_pHyprOpenGL->renderBorder(&windowBox, grad, rounding, a1);
|
||||
|
||||
if (ANIMATED) {
|
||||
float a2 = renderdata.fadeAlpha * renderdata.alpha / 255.f * (1.f - g_pHyprOpenGL->m_pCurrentWindow->m_fBorderAnimationProgress.fl());
|
||||
float a2 = renderdata.fadeAlpha * renderdata.alpha * (1.f - g_pHyprOpenGL->m_pCurrentWindow->m_fBorderAnimationProgress.fl());
|
||||
g_pHyprOpenGL->renderBorder(&windowBox, g_pHyprOpenGL->m_pCurrentWindow->m_cRealBorderColorPrevious, rounding, a2);
|
||||
}
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
|||
const bool ANIMOUT = !PMONITOR->specialWorkspaceID;
|
||||
|
||||
wlr_box monbox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
|
||||
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMSPECIAL * 255.f * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)));
|
||||
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMSPECIAL * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)));
|
||||
}
|
||||
|
||||
renderedSpecialBG = true;
|
||||
|
@ -632,7 +632,7 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) {
|
|||
if (!PCANDIDATE)
|
||||
return false; // ????
|
||||
|
||||
if (PCANDIDATE->m_fAlpha.fl() != 255.f || PCANDIDATE->m_fActiveInactiveAlpha.fl() != 1.f || PWORKSPACE->m_fAlpha.fl() != 255.f)
|
||||
if (PCANDIDATE->m_fAlpha.fl() != 1.f || PCANDIDATE->m_fActiveInactiveAlpha.fl() != 1.f || PWORKSPACE->m_fAlpha.fl() != 1.f)
|
||||
return false;
|
||||
|
||||
if (PCANDIDATE->m_vRealSize.vec() != pMonitor->vecSize || PCANDIDATE->m_vRealPosition.vec() != pMonitor->vecPosition || PCANDIDATE->m_vRealPosition.isBeingAnimated() ||
|
||||
|
|
|
@ -92,7 +92,6 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
|
|||
CColor color = m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? ((CGradientValueData*)PGROUPCOLACTIVE->get())->m_vColors[0] :
|
||||
((CGradientValueData*)PGROUPCOLINACTIVE->get())->m_vColors[0];
|
||||
color.a *= a;
|
||||
color = color * 255.f; // gradient has 0 - 1
|
||||
g_pHyprOpenGL->renderRect(&rect, color);
|
||||
|
||||
xoff += PAD + BARW;
|
||||
|
|
Loading…
Reference in a new issue