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