mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
Fix expand mode shrink animation
This commit is contained in:
parent
367af67a44
commit
acd07dee93
2 changed files with 62 additions and 33 deletions
48
flake.lock
generated
48
flake.lock
generated
|
@ -4,15 +4,16 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"hyprland-protocols": "hyprland-protocols",
|
"hyprland-protocols": "hyprland-protocols",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
"systems": "systems",
|
||||||
"wlroots": "wlroots",
|
"wlroots": "wlroots",
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1691612137,
|
"lastModified": 1692123043,
|
||||||
"narHash": "sha256-7nMCJIZBB2XIjUqAjImoTaZBVIg/0REripGdNsClxlQ=",
|
"narHash": "sha256-6YoTjAZgtJb9OzKrZxtLxjfYiGWSqMmh1Wyh9dvwXn8=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "Hyprland",
|
"repo": "Hyprland",
|
||||||
"rev": "126792584fa4eb25f6c8e3b3eb6bfb00b58a787a",
|
"rev": "4986d74ef201171a930c312a8e3b72a22d9b84ee",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -26,14 +27,18 @@
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"hyprland",
|
"hyprland",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"systems": [
|
||||||
|
"hyprland",
|
||||||
|
"systems"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1684265364,
|
"lastModified": 1691753796,
|
||||||
"narHash": "sha256-AxNnWbthsuNx73HDQr0eBxrcE3+yfl/WsaXZqUFmkpQ=",
|
"narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprland-protocols",
|
"repo": "hyprland-protocols",
|
||||||
"rev": "8c279b9fb0f2b031427dc5ef4eab53f2ed835530",
|
"rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -44,11 +49,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1690179384,
|
"lastModified": 1691654369,
|
||||||
"narHash": "sha256-+arbgqFTAtoeKtepW9wCnA0njCOyoiDFyl0Q0SBSOtE=",
|
"narHash": "sha256-gSILTEx1jRaJjwZxRlnu3ZwMn1FVNk80qlwiCX8kmpo=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b12803b6d90e2e583429bb79b859ca53c348b39a",
|
"rev": "ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -63,6 +68,21 @@
|
||||||
"hyprland": "hyprland"
|
"hyprland": "hyprland"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1689347949,
|
||||||
|
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default-linux",
|
||||||
|
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default-linux",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"wlroots": {
|
"wlroots": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -91,14 +111,18 @@
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"hyprland",
|
"hyprland",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"systems": [
|
||||||
|
"hyprland",
|
||||||
|
"systems"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1691082525,
|
"lastModified": 1691841170,
|
||||||
"narHash": "sha256-C5AO0KnyAFJaCkOn+5nJfWm0kyiPn/Awh0lKTjhgr7Y=",
|
"narHash": "sha256-RCTm1/MVWYPnReMgyp7tr2ogGYo/pvw38jZaFwemgPU=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "xdg-desktop-portal-hyprland",
|
"repo": "xdg-desktop-portal-hyprland",
|
||||||
"rev": "42747d267ab4345c4ceb78cd4a4fe99f072d80fc",
|
"rev": "57a3a41ba6b358109e4fc25c6a4706b5f7d93c6b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -323,26 +323,28 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
|
||||||
g_pHyprRenderer->damageBox(&box);
|
g_pHyprRenderer->damageBox(&box);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: fix broken start positions when using hy3:expand, base
|
for (auto* child: group->children) {
|
||||||
if (expand_focused) {
|
if (expand_focused && child == group->focused_child) {
|
||||||
for (auto* child: group->children) {
|
child->position = tpos;
|
||||||
if (child == group->focused_child) {
|
child->size = tsize;
|
||||||
child->position = tpos;
|
child->setHidden(hidden);
|
||||||
child->size = tsize;
|
|
||||||
child->setHidden(hidden);
|
|
||||||
|
|
||||||
child->gap_pos_offset = gap_pos_offset;
|
child->gap_pos_offset = gap_pos_offset;
|
||||||
child->gap_size_offset = gap_size_offset;
|
child->gap_size_offset = gap_size_offset;
|
||||||
} else {
|
|
||||||
child->setHidden(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
child->recalcSizePosRecursive(no_animation);
|
child->recalcSizePosRecursive(no_animation);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto* child: group->children) {
|
switch (group->layout) {
|
||||||
|
case Hy3GroupLayout::SplitH: offset += child->size.x; break;
|
||||||
|
case Hy3GroupLayout::SplitV: offset += child->size.y; break;
|
||||||
|
case Hy3GroupLayout::Tabbed: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (expand_focused && child == group->focused_child) continue;
|
if (expand_focused && child == group->focused_child) continue;
|
||||||
|
auto was_hidden = child->hidden;
|
||||||
|
|
||||||
switch (group->layout) {
|
switch (group->layout) {
|
||||||
case Hy3GroupLayout::SplitH:
|
case Hy3GroupLayout::SplitH:
|
||||||
|
@ -351,7 +353,8 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
|
||||||
offset += child->size.x;
|
offset += child->size.x;
|
||||||
child->position.y = tpos.y;
|
child->position.y = tpos.y;
|
||||||
child->size.y = tsize.y;
|
child->size.y = tsize.y;
|
||||||
child->setHidden(this->hidden || expand_focused);
|
child->hidden = this->hidden || expand_focused;
|
||||||
|
// child->setHidden(this->hidden || expand_focused);
|
||||||
|
|
||||||
if (group->children.size() == 1) {
|
if (group->children.size() == 1) {
|
||||||
child->gap_pos_offset = gap_pos_offset;
|
child->gap_pos_offset = gap_pos_offset;
|
||||||
|
@ -371,7 +374,7 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
|
||||||
child->gap_size_offset = Vector2D(0, gap_size_offset.y);
|
child->gap_size_offset = Vector2D(0, gap_size_offset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
child->recalcSizePosRecursive(no_animation);
|
child->recalcSizePosRecursive(no_animation || was_hidden);
|
||||||
break;
|
break;
|
||||||
case Hy3GroupLayout::SplitV:
|
case Hy3GroupLayout::SplitV:
|
||||||
child->position.y = tpos.y + offset;
|
child->position.y = tpos.y + offset;
|
||||||
|
@ -379,7 +382,8 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
|
||||||
offset += child->size.y;
|
offset += child->size.y;
|
||||||
child->position.x = tpos.x;
|
child->position.x = tpos.x;
|
||||||
child->size.x = tsize.x;
|
child->size.x = tsize.x;
|
||||||
child->setHidden(this->hidden || expand_focused);
|
child->hidden = this->hidden || expand_focused;
|
||||||
|
// child->setHidden(this->hidden || expand_focused);
|
||||||
|
|
||||||
if (group->children.size() == 1) {
|
if (group->children.size() == 1) {
|
||||||
child->gap_pos_offset = gap_pos_offset;
|
child->gap_pos_offset = gap_pos_offset;
|
||||||
|
@ -399,17 +403,18 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
|
||||||
child->gap_size_offset = Vector2D(gap_size_offset.x, 0);
|
child->gap_size_offset = Vector2D(gap_size_offset.x, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
child->recalcSizePosRecursive(no_animation);
|
child->recalcSizePosRecursive(no_animation || was_hidden);
|
||||||
break;
|
break;
|
||||||
case Hy3GroupLayout::Tabbed:
|
case Hy3GroupLayout::Tabbed:
|
||||||
child->position = tpos;
|
child->position = tpos;
|
||||||
child->size = tsize;
|
child->size = tsize;
|
||||||
child->setHidden(this->hidden || expand_focused || group->focused_child != child);
|
child->hidden = this->hidden || expand_focused || group->focused_child != child;
|
||||||
|
// child->setHidden(this->hidden || expand_focused || group->focused_child != child);
|
||||||
|
|
||||||
child->gap_pos_offset = Vector2D(gap_pos_offset.x, gap_pos_offset.y + tab_height_offset);
|
child->gap_pos_offset = Vector2D(gap_pos_offset.x, gap_pos_offset.y + tab_height_offset);
|
||||||
child->gap_size_offset = Vector2D(gap_size_offset.x, gap_size_offset.y + tab_height_offset);
|
child->gap_size_offset = Vector2D(gap_size_offset.x, gap_size_offset.y + tab_height_offset);
|
||||||
|
|
||||||
child->recalcSizePosRecursive(no_animation);
|
child->recalcSizePosRecursive(no_animation || was_hidden);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue