mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 05:25:58 +01:00
do not animate mouse resizes in layouts
This commit is contained in:
parent
c779a7c03b
commit
f36cd350cc
4 changed files with 27 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
#include "DwindleLayout.hpp"
|
#include "DwindleLayout.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
void SDwindleNodeData::recalcSizePosRecursive() {
|
void SDwindleNodeData::recalcSizePosRecursive(bool force) {
|
||||||
|
|
||||||
// check the group, if we are in one and not active, ignore.
|
// check the group, if we are in one and not active, ignore.
|
||||||
if (pGroupParent && pGroupParent->groupMembers[pGroupParent->groupMemberActive] != this) {
|
if (pGroupParent && pGroupParent->groupMembers[pGroupParent->groupMemberActive] != this) {
|
||||||
|
@ -47,7 +47,7 @@ void SDwindleNodeData::recalcSizePosRecursive() {
|
||||||
children[0]->recalcSizePosRecursive();
|
children[0]->recalcSizePosRecursive();
|
||||||
children[1]->recalcSizePosRecursive();
|
children[1]->recalcSizePosRecursive();
|
||||||
} else {
|
} else {
|
||||||
layout->applyNodeDataToWindow(this);
|
layout->applyNodeDataToWindow(this, force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ SDwindleNodeData* CHyprDwindleLayout::getMasterNodeOnWorkspace(const int& id) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) {
|
void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool force) {
|
||||||
// Don't set nodes, only windows.
|
// Don't set nodes, only windows.
|
||||||
if (pNode->isNode)
|
if (pNode->isNode)
|
||||||
return;
|
return;
|
||||||
|
@ -203,6 +203,11 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) {
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, calcSize);
|
g_pXWaylandManager->setWindowSize(PWINDOW, calcSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (force) {
|
||||||
|
PWINDOW->m_vRealPosition.warp();
|
||||||
|
PWINDOW->m_vRealSize.warp();
|
||||||
|
}
|
||||||
|
|
||||||
PWINDOW->updateWindowDecos();
|
PWINDOW->updateWindowDecos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,11 +509,11 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, CWindow*
|
||||||
if (PARENTSIDEBYSIDE) {
|
if (PARENTSIDEBYSIDE) {
|
||||||
allowedMovement.x *= 2.f / PPARENT->size.x;
|
allowedMovement.x *= 2.f / PPARENT->size.x;
|
||||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||||
PPARENT->recalcSizePosRecursive();
|
PPARENT->recalcSizePosRecursive(true);
|
||||||
} else {
|
} else {
|
||||||
allowedMovement.y *= 2.f / PPARENT->size.y;
|
allowedMovement.y *= 2.f / PPARENT->size.y;
|
||||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||||
PPARENT->recalcSizePosRecursive();
|
PPARENT->recalcSizePosRecursive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -523,11 +528,11 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, CWindow*
|
||||||
if (PARENTSIDEBYSIDE) {
|
if (PARENTSIDEBYSIDE) {
|
||||||
allowedMovement.x *= 2.f / PPARENT->size.x;
|
allowedMovement.x *= 2.f / PPARENT->size.x;
|
||||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||||
PPARENT->recalcSizePosRecursive();
|
PPARENT->recalcSizePosRecursive(true);
|
||||||
} else {
|
} else {
|
||||||
allowedMovement.y *= 2.f / PPARENT->size.y;
|
allowedMovement.y *= 2.f / PPARENT->size.y;
|
||||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||||
PPARENT->recalcSizePosRecursive();
|
PPARENT->recalcSizePosRecursive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -542,8 +547,8 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, CWindow*
|
||||||
|
|
||||||
SIDECONTAINER->splitRatio = std::clamp(SIDECONTAINER->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
SIDECONTAINER->splitRatio = std::clamp(SIDECONTAINER->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||||
TOPCONTAINER->splitRatio = std::clamp(TOPCONTAINER->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
TOPCONTAINER->splitRatio = std::clamp(TOPCONTAINER->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||||
SIDECONTAINER->recalcSizePosRecursive();
|
SIDECONTAINER->recalcSizePosRecursive(true);
|
||||||
TOPCONTAINER->recalcSizePosRecursive();
|
TOPCONTAINER->recalcSizePosRecursive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode, bool on) {
|
void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode, bool on) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct SDwindleNodeData {
|
||||||
return pWindow == rhs.pWindow && workspaceID == rhs.workspaceID && position == rhs.position && size == rhs.size && pParent == rhs.pParent && children[0] == rhs.children[0] && children[1] == rhs.children[1];
|
return pWindow == rhs.pWindow && workspaceID == rhs.workspaceID && position == rhs.position && size == rhs.size && pParent == rhs.pParent && children[0] == rhs.children[0] && children[1] == rhs.children[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void recalcSizePosRecursive();
|
void recalcSizePosRecursive(bool force = false);
|
||||||
void getAllChildrenRecursive(std::deque<SDwindleNodeData*>*);
|
void getAllChildrenRecursive(std::deque<SDwindleNodeData*>*);
|
||||||
CHyprDwindleLayout* layout = nullptr;
|
CHyprDwindleLayout* layout = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,7 @@ private:
|
||||||
std::list<SDwindleNodeData> m_lDwindleNodesData;
|
std::list<SDwindleNodeData> m_lDwindleNodesData;
|
||||||
|
|
||||||
int getNodesOnWorkspace(const int&);
|
int getNodesOnWorkspace(const int&);
|
||||||
void applyNodeDataToWindow(SDwindleNodeData*);
|
void applyNodeDataToWindow(SDwindleNodeData*, bool force = false);
|
||||||
SDwindleNodeData* getNodeFromWindow(CWindow*);
|
SDwindleNodeData* getNodeFromWindow(CWindow*);
|
||||||
SDwindleNodeData* getFirstNodeOnWorkspace(const int&);
|
SDwindleNodeData* getFirstNodeOnWorkspace(const int&);
|
||||||
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
|
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
|
||||||
|
|
|
@ -250,6 +250,11 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, calcSize);
|
g_pXWaylandManager->setWindowSize(PWINDOW, calcSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_bForceWarps) {
|
||||||
|
PWINDOW->m_vRealPosition.warp();
|
||||||
|
PWINDOW->m_vRealSize.warp();
|
||||||
|
}
|
||||||
|
|
||||||
PWINDOW->updateWindowDecos();
|
PWINDOW->updateWindowDecos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,6 +283,8 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, CWindow* p
|
||||||
if (getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) < 2)
|
if (getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_bForceWarps = true;
|
||||||
|
|
||||||
float delta = pixResize.x / PMONITOR->vecSize.x;
|
float delta = pixResize.x / PMONITOR->vecSize.x;
|
||||||
|
|
||||||
PMASTER->percMaster += delta;
|
PMASTER->percMaster += delta;
|
||||||
|
@ -285,6 +292,8 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, CWindow* p
|
||||||
std::clamp(PMASTER->percMaster, 0.05f, 0.95f);
|
std::clamp(PMASTER->percMaster, 0.05f, 0.95f);
|
||||||
|
|
||||||
recalculateMonitor(PMONITOR->ID);
|
recalculateMonitor(PMONITOR->ID);
|
||||||
|
|
||||||
|
m_bForceWarps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode, bool on) {
|
void CHyprMasterLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode, bool on) {
|
||||||
|
|
|
@ -44,6 +44,8 @@ private:
|
||||||
|
|
||||||
std::list<SMasterNodeData> m_lMasterNodesData;
|
std::list<SMasterNodeData> m_lMasterNodesData;
|
||||||
|
|
||||||
|
bool m_bForceWarps = false;
|
||||||
|
|
||||||
int getNodesOnWorkspace(const int&);
|
int getNodesOnWorkspace(const int&);
|
||||||
void applyNodeDataToWindow(SMasterNodeData*);
|
void applyNodeDataToWindow(SMasterNodeData*);
|
||||||
SMasterNodeData* getNodeFromWindow(CWindow*);
|
SMasterNodeData* getNodeFromWindow(CWindow*);
|
||||||
|
|
Loading…
Reference in a new issue