summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2022-08-28 20:44:00 +1200
committerBossCode45 <human.cyborg42@gmail.com>2022-08-28 20:44:00 +1200
commitb4eba3e98ed58f1dbfe454d702653e6caefc9635 (patch)
tree47140b5c6748e0c116a81446bbb5829b34219cb7
parent01a34fabc8cd6b5a7cb5ab1dd0e58f27094ec4d5 (diff)
downloadYATwm-b4eba3e98ed58f1dbfe454d702653e6caefc9635.tar.gz
YATwm-b4eba3e98ed58f1dbfe454d702653e6caefc9635.zip
Frame disolving for window moving
-rw-r--r--main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 57c85e3..1a5af57 100644
--- a/main.cpp
+++ b/main.cpp
@@ -118,6 +118,7 @@ void wToWS(const KeyArg arg)
{
if(pSF[i] == fID)
{
+ //Frame disolve
pSF.erase(pSF.begin() + i);
int pID = frames.find(fID)->second.pID;
if(pSF.size() < 2 && !frames.find(pID)->second.isRoot)
@@ -233,7 +234,25 @@ void wMove(const KeyArg arg)
if(pID!=oPID)
{
+ //Frame dissolve
oPSF.erase(oPSF.begin() + i);
+ if(oPSF.size() < 2 && !frames.find(oPID)->second.isRoot)
+ {
+ //Erase parent frame
+ int lastChildID = frames.find(frames.find(oPID)->second.subFrameIDs[0])->second.ID;
+ int parentParentID = frames.find(oPID)->second.pID;
+ vector<int>& parentParentSubFrameIDs = frames.find(parentParentID)->second.subFrameIDs;
+ for(int j = 0; j < parentParentSubFrameIDs.size(); j++)
+ {
+ if(parentParentSubFrameIDs[j] == oPID)
+ {
+ parentParentSubFrameIDs[j] = lastChildID;
+ frames.find(lastChildID)->second.pID = parentParentID;
+ frames.erase(oPID);
+ break;
+ }
+ }
+ }
frames.find(fID)->second.pID = pID;
pSF.push_back(fID);