summaryrefslogtreecommitdiff
path: root/src/Compositor.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-26 21:23:13 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-26 21:23:13 +0200
commit8a3ea54184d123cec969e2e77c5bf87ec36befd3 (patch)
treeaa76b0a063f385e4c9000dbda4d2c141c9438e15 /src/Compositor.cpp
parent795504dad01e7d738f768315767523270e59ab54 (diff)
Update border colors on config reload
Diffstat (limited to 'src/Compositor.cpp')
-rw-r--r--src/Compositor.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 82e2986e..40741d22 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -427,11 +427,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
// we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window
if (windowValidMapped(PLASTWINDOW)) {
- const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(PLASTWINDOW);
- if (RENDERDATA.isBorderColor)
- PLASTWINDOW->m_cRealBorderColor = RENDERDATA.borderColor;
- else
- PLASTWINDOW->m_cRealBorderColor = CColor(g_pConfigManager->getInt("general:col.inactive_border"));
+ updateWindowBorderColor(PLASTWINDOW);
if (PLASTWINDOW->m_bIsX11) {
wlr_seat_keyboard_notify_clear_focus(m_sSeat.seat);
@@ -451,11 +447,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
const auto POINTERLOCAL = g_pInputManager->getMouseCoordsInternal() - pWindow->m_vRealPosition.goalv();
wlr_seat_pointer_notify_enter(m_sSeat.seat, PWINDOWSURFACE, POINTERLOCAL.x, POINTERLOCAL.y);
- const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(pWindow);
- if (RENDERDATA.isBorderColor)
- pWindow->m_cRealBorderColor = RENDERDATA.borderColor;
- else
- pWindow->m_cRealBorderColor = CColor(g_pConfigManager->getInt("general:col.active_border"));
+ updateWindowBorderColor(pWindow);
// Send an event
g_pEventManager->postEvent(SHyprIPCEvent("activewindow", pWindow->m_szTitle));
@@ -894,3 +886,24 @@ SMonitor* CCompositor::getMonitorInDirection(const char& dir) {
return nullptr;
}
+
+void CCompositor::updateAllWindowsBorders() {
+ for (auto& w : m_lWindows) {
+ if (!w.m_bIsMapped)
+ continue;
+
+ updateWindowBorderColor(&w);
+ }
+}
+
+void CCompositor::updateWindowBorderColor(CWindow* pWindow) {
+ // optimization
+ static int64_t* ACTIVECOL = &g_pConfigManager->getConfigValuePtr("general:col.active_border")->intValue;
+ static int64_t* INACTIVECOL = &g_pConfigManager->getConfigValuePtr("general:col.inactive_border")->intValue;
+
+ const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(pWindow);
+ if (RENDERDATA.isBorderColor)
+ pWindow->m_cRealBorderColor = RENDERDATA.borderColor;
+ else
+ pWindow->m_cRealBorderColor = CColor(pWindow == m_pLastWindow ? *ACTIVECOL : *INACTIVECOL);
+} \ No newline at end of file