mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 16:25:59 +01:00
Update border colors on config reload
This commit is contained in:
parent
795504dad0
commit
8a3ea54184
3 changed files with 32 additions and 11 deletions
|
@ -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);
|
||||
}
|
|
@ -121,6 +121,8 @@ public:
|
|||
bool isPointOnAnyMonitor(const Vector2D&);
|
||||
CWindow* getConstraintWindow(SMouse*);
|
||||
SMonitor* getMonitorInDirection(const char&);
|
||||
void updateAllWindowsBorders();
|
||||
void updateWindowBorderColor(CWindow*);
|
||||
|
||||
private:
|
||||
void initAllSignals();
|
||||
|
|
|
@ -523,7 +523,10 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
|
|||
// invalidate layouts jic
|
||||
for (auto& m : g_pCompositor->m_lMonitors)
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m.ID);
|
||||
|
||||
|
||||
// Update window border colors
|
||||
g_pCompositor->updateAllWindowsBorders();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -700,6 +703,9 @@ void CConfigManager::loadConfigLoadVars() {
|
|||
if (!isFirstLaunch) {
|
||||
m_bWantsMonitorReload = true;
|
||||
}
|
||||
|
||||
// Update window border colors
|
||||
g_pCompositor->updateAllWindowsBorders();
|
||||
}
|
||||
|
||||
void CConfigManager::tick() {
|
||||
|
|
Loading…
Reference in a new issue