Fix tab resize animation playing during non-animating node resize

This commit is contained in:
outfoxxed 2023-06-28 16:46:05 -07:00
parent 98165c5b2f
commit b3be42109f
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
4 changed files with 17 additions and 11 deletions

View file

@ -179,7 +179,7 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
child->setHidden(this->hidden);
child->recalcSizePosRecursive(no_animation);
this->updateTabBar();
this->updateTabBar(no_animation);
return;
}
@ -582,13 +582,13 @@ void findTopWindowInNode(Hy3Node& node, FindTopWindowInNodeResult& result) {
}
}
void Hy3Node::updateTabBar() {
void Hy3Node::updateTabBar(bool no_animation) {
if (this->data.type == Hy3NodeData::Group) {
auto& group = this->data.as_group;
if (group.layout == Hy3GroupLayout::Tabbed) {
if (group.tab_bar == nullptr) group.tab_bar = &this->layout->tab_groups.emplace_back(*this);
group.tab_bar->updateWithGroup(*this);
group.tab_bar->updateWithGroup(*this, no_animation);
FindTopWindowInNodeResult result;
findTopWindowInNode(*this, result);

View file

@ -108,7 +108,7 @@ struct Hy3Node {
Hy3Node* getFocusedNode();
void updateDecos();
void setHidden(bool);
void updateTabBar();
void updateTabBar(bool no_animation = false);
void updateTabBarRecursive();
bool isUrgent();
bool isIndirectlyFocused();

View file

@ -443,13 +443,12 @@ Hy3TabGroup::Hy3TabGroup(Hy3Node& node) {
this->pos.registerVar();
this->size.registerVar();
this->updateWithGroup(node);
this->bar.updateAnimations(true);
this->updateWithGroup(node, true);
this->pos.warp();
this->size.warp();
}
void Hy3TabGroup::updateWithGroup(Hy3Node& node) {
void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
Debug::log(LOG, "updated tab bar for %p", &node);
static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
@ -461,11 +460,18 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node) {
auto tsize = Vector2D(node.size.x - node.gap_size_offset.x - gaps * 2, *bar_height);
this->hidden = node.hidden;
if (this->pos.goalv() != tpos) this->pos = tpos;
if (this->size.goalv() != tsize) this->size = tsize;
if (this->pos.goalv() != tpos) {
this->pos = tpos;
if (warp) this->pos.warp();
}
if (this->size.goalv() != tsize) {
this->size = tsize;
if (warp) this->size.warp();
}
this->bar.updateNodeList(node.data.as_group.children);
this->bar.updateAnimations();
this->bar.updateAnimations(warp);
if (node.data.as_group.focused_child != nullptr) {
this->updateStencilWindows(*node.data.as_group.focused_child);

View file

@ -94,7 +94,7 @@ public:
Hy3TabGroup(Hy3Node&);
// update tab bar with node position and data. UB if node is not a group.
void updateWithGroup(Hy3Node&);
void updateWithGroup(Hy3Node&, bool warp);
void tick();
// render the scaled tab bar on the current monitor.
void renderTabBar();