summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2023-01-05 19:25:45 +0100
committervaxerski <vaxry@vaxry.net>2023-01-05 19:25:45 +0100
commit96198dae55b1429449504e49065a10763b288431 (patch)
treeee18d707952df6fcbd4f9295e138d1571b64267b /src/managers
parent0e3547e0f6b4016aa308292a86c43cd47dd206fd (diff)
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.
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/KeybindManager.cpp6
-rw-r--r--src/managers/input/Swipe.cpp16
2 files changed, 11 insertions, 11 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 2eb93a2a..15ed348b 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -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;
diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp
index f092355b..c4e89605 100644
--- a/src/managers/input/Swipe.cpp
+++ b/src/managers/input/Swipe.cpp
@@ -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);