mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 17:45:58 +01:00
workspace: update windows when selector match could change (#5533)
* workspace: update windows when group updates * workspace: update windows when floating toggle * workspace: update windows when stop dragging window by mouse
This commit is contained in:
parent
b573c20125
commit
c35fa9bacc
6 changed files with 56 additions and 23 deletions
|
@ -2375,6 +2375,18 @@ void CCompositor::updateWorkspaceWindowDecos(const int& id) {
|
|||
}
|
||||
}
|
||||
|
||||
void CCompositor::updateWorkspaceSpecialRenderData(const int& id) {
|
||||
const auto PWORKSPACE = getWorkspaceByID(id);
|
||||
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
|
||||
|
||||
for (auto& w : m_vWindows) {
|
||||
if (w->workspaceID() != id)
|
||||
continue;
|
||||
|
||||
w->updateSpecialRenderData(WORKSPACERULE);
|
||||
}
|
||||
}
|
||||
|
||||
void CCompositor::scheduleFrameForMonitor(CMonitor* pMonitor) {
|
||||
if ((m_sWLRSession && !m_sWLRSession->active) || !m_bSessionActive)
|
||||
return;
|
||||
|
|
|
@ -150,6 +150,7 @@ class CCompositor {
|
|||
PHLWORKSPACE getWorkspaceByString(const std::string&);
|
||||
void sanityCheckWorkspaces();
|
||||
void updateWorkspaceWindowDecos(const int&);
|
||||
void updateWorkspaceSpecialRenderData(const int&);
|
||||
int getWindowsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {});
|
||||
int getGroupsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {});
|
||||
CWindow* getUrgentWindow();
|
||||
|
|
|
@ -792,12 +792,11 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
|
|||
refreshGroupBarGradients();
|
||||
|
||||
// Updates dynamic window and workspace rules
|
||||
for (auto& w : g_pCompositor->m_vWindows) {
|
||||
if (!w->m_bIsMapped)
|
||||
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||
if (w->inert())
|
||||
continue;
|
||||
|
||||
w->updateDynamicRules();
|
||||
w->updateSpecialRenderData();
|
||||
g_pCompositor->updateWorkspaceWindows(w->m_iID);
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(w->m_iID);
|
||||
}
|
||||
|
||||
// Update window border colors
|
||||
|
|
|
@ -390,7 +390,11 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
|
|||
|
||||
setAnimationsToMove();
|
||||
|
||||
updateSpecialRenderData();
|
||||
g_pCompositor->updateWorkspaceWindows(OLDWORKSPACE->m_iID);
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(OLDWORKSPACE->m_iID);
|
||||
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
|
||||
if (valid(pWorkspace)) {
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", std::format("{:x},{}", (uintptr_t)this, pWorkspace->m_szName)});
|
||||
|
@ -479,6 +483,8 @@ void CWindow::onUnmap() {
|
|||
PMONITOR->solitaryClient = nullptr;
|
||||
|
||||
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
|
||||
if (m_bIsX11)
|
||||
return;
|
||||
|
@ -845,6 +851,8 @@ void CWindow::createGroup() {
|
|||
addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(this));
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
|
||||
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
}
|
||||
}
|
||||
|
@ -858,6 +866,9 @@ void CWindow::destroyGroup() {
|
|||
m_sGroupData.pNextWindow = nullptr;
|
||||
m_sGroupData.head = false;
|
||||
updateWindowDecos();
|
||||
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -884,6 +895,10 @@ void CWindow::destroyGroup() {
|
|||
w->updateWindowDecos();
|
||||
}
|
||||
g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV;
|
||||
|
||||
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
}
|
||||
|
||||
CWindow* CWindow::getGroupHead() {
|
||||
|
@ -1100,20 +1115,23 @@ float CWindow::rounding() {
|
|||
}
|
||||
|
||||
void CWindow::updateSpecialRenderData() {
|
||||
const auto PWORKSPACE = m_pWorkspace;
|
||||
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
|
||||
bool border = true;
|
||||
const auto PWORKSPACE = m_pWorkspace;
|
||||
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
|
||||
updateSpecialRenderData(WORKSPACERULE);
|
||||
}
|
||||
|
||||
void CWindow::updateSpecialRenderData(const SWorkspaceRule& workspaceRule) {
|
||||
static auto PNOBORDERONFLOATING = CConfigValue<Hyprlang::INT>("general:no_border_on_floating");
|
||||
|
||||
bool border = true;
|
||||
if (m_bIsFloating && *PNOBORDERONFLOATING == 1)
|
||||
border = false;
|
||||
|
||||
m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(border);
|
||||
m_sSpecialRenderData.borderSize = WORKSPACERULE.borderSize.value_or(-1);
|
||||
m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true);
|
||||
m_sSpecialRenderData.rounding = WORKSPACERULE.rounding.value_or(true);
|
||||
m_sSpecialRenderData.shadow = WORKSPACERULE.shadow.value_or(true);
|
||||
m_sSpecialRenderData.border = workspaceRule.border.value_or(border);
|
||||
m_sSpecialRenderData.borderSize = workspaceRule.borderSize.value_or(-1);
|
||||
m_sSpecialRenderData.decorate = workspaceRule.decorate.value_or(true);
|
||||
m_sSpecialRenderData.rounding = workspaceRule.rounding.value_or(true);
|
||||
m_sSpecialRenderData.shadow = workspaceRule.shadow.value_or(true);
|
||||
}
|
||||
|
||||
int CWindow::getRealBorderSize() {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../helpers/AnimatedVariable.hpp"
|
||||
#include "../render/decorations/IHyprWindowDecoration.hpp"
|
||||
#include <deque>
|
||||
#include "../config/ConfigManager.hpp"
|
||||
#include "../config/ConfigDataValues.hpp"
|
||||
#include "../helpers/Vector2D.hpp"
|
||||
#include "WLSurface.hpp"
|
||||
|
@ -408,6 +409,7 @@ class CWindow {
|
|||
|
||||
int getRealBorderSize();
|
||||
void updateSpecialRenderData();
|
||||
void updateSpecialRenderData(const struct SWorkspaceRule&);
|
||||
|
||||
void onBorderAngleAnimEnd(void* ptr);
|
||||
bool isInCurvedCorner(double x, double y);
|
||||
|
|
|
@ -202,11 +202,17 @@ bool CKeybindManager::ensureMouseBindState() {
|
|||
return false;
|
||||
|
||||
if (g_pInputManager->currentlyDraggedWindow) {
|
||||
CWindow* lastDraggedWindow = g_pInputManager->currentlyDraggedWindow;
|
||||
|
||||
m_bIsMouseBindActive = false;
|
||||
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
||||
g_pInputManager->dragMode = MBIND_INVALID;
|
||||
|
||||
g_pCompositor->updateWorkspaceWindows(lastDraggedWindow->workspaceID());
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(lastDraggedWindow->workspaceID());
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -857,19 +863,16 @@ static void toggleActiveFloatingCore(std::string args, std::optional<bool> float
|
|||
CWindow* curr = PCURRENT->m_sGroupData.pNextWindow;
|
||||
while (curr != PCURRENT) {
|
||||
curr->m_bIsFloating = PCURRENT->m_bIsFloating;
|
||||
curr->updateDynamicRules();
|
||||
curr->updateSpecialRenderData();
|
||||
curr = curr->m_sGroupData.pNextWindow;
|
||||
curr = curr->m_sGroupData.pNextWindow;
|
||||
}
|
||||
|
||||
g_pCompositor->updateWorkspaceWindows(PWINDOW->workspaceID());
|
||||
} else {
|
||||
PWINDOW->m_bIsFloating = !PWINDOW->m_bIsFloating;
|
||||
|
||||
g_pCompositor->updateWorkspaceWindows(PWINDOW->workspaceID());
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PWINDOW);
|
||||
}
|
||||
g_pCompositor->updateWorkspaceWindows(PWINDOW->workspaceID());
|
||||
g_pCompositor->updateWorkspaceSpecialRenderData(PWINDOW->workspaceID());
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
}
|
||||
|
||||
void CKeybindManager::toggleActiveFloating(std::string args) {
|
||||
|
@ -1282,8 +1285,6 @@ void CKeybindManager::toggleGroup(std::string args) {
|
|||
PWINDOW->createGroup();
|
||||
else
|
||||
PWINDOW->destroyGroup();
|
||||
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
}
|
||||
|
||||
void CKeybindManager::changeGroupActive(std::string args) {
|
||||
|
|
Loading…
Reference in a new issue