mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
Fix visual defects when switching workspaces properly
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
11fcce5780
commit
3bf93f5457
2 changed files with 24 additions and 16 deletions
|
@ -409,14 +409,6 @@ Hy3TabGroup::Hy3TabGroup(Hy3Node& node) {
|
||||||
this->size.warp();
|
this->size.warp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hy3TabGroup::damage() {
|
|
||||||
auto pos = this->node->position;
|
|
||||||
auto size = this->node->size;
|
|
||||||
auto box = CBox {pos.x, pos.y, size.x, size.y};
|
|
||||||
|
|
||||||
g_pHyprRenderer->damageBox(&box);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
|
void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
|
||||||
this->node = &node;
|
this->node = &node;
|
||||||
|
|
||||||
|
@ -453,6 +445,11 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node, bool warp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void damageBox(const Vector2D* position, const Vector2D* size) {
|
||||||
|
auto box = CBox {position->x, position->y, size->x, size->y};
|
||||||
|
g_pHyprRenderer->damageBox(&box);
|
||||||
|
}
|
||||||
|
|
||||||
void Hy3TabGroup::tick() {
|
void Hy3TabGroup::tick() {
|
||||||
static const auto enter_from_top = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:from_top");
|
static const auto enter_from_top = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:from_top");
|
||||||
static const auto padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:padding");
|
static const auto padding = ConfigValue<Hyprlang::INT>("plugin:hy3:tabs:padding");
|
||||||
|
@ -466,8 +463,22 @@ void Hy3TabGroup::tick() {
|
||||||
if (this->bar.fade_opacity.goal() != 1.0) this->bar.fade_opacity = 1.0;
|
if (this->bar.fade_opacity.goal() != 1.0) this->bar.fade_opacity = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->workspace->m_vRenderOffset.isBeingAnimated()) {
|
auto workspaceOffset = this->workspace->m_vRenderOffset.value();
|
||||||
this->damage();
|
if (this->last_workspace_offset != workspaceOffset) {
|
||||||
|
// First we damage the area where the bar was during the previous
|
||||||
|
// tick, cleaning up after ourselves
|
||||||
|
auto pos = this->last_pos + this->last_workspace_offset;
|
||||||
|
auto size = this->last_size;
|
||||||
|
damageBox(&pos, &size);
|
||||||
|
|
||||||
|
// Then we damage the current position of the bar, to avoid seeing
|
||||||
|
// glitches with animations disabled
|
||||||
|
pos = this->pos.value() + workspaceOffset;
|
||||||
|
size = this->size.value();
|
||||||
|
damageBox(&pos, &size);
|
||||||
|
|
||||||
|
this->bar.damaged = true;
|
||||||
|
this->last_workspace_offset = workspaceOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,8 +486,7 @@ void Hy3TabGroup::tick() {
|
||||||
auto size = this->size.value();
|
auto size = this->size.value();
|
||||||
|
|
||||||
if (this->last_pos != pos || this->last_size != size) {
|
if (this->last_pos != pos || this->last_size != size) {
|
||||||
CBox damage_box = {this->last_pos.x, this->last_pos.y, this->last_size.x, this->last_size.y};
|
damageBox(&this->last_pos, &this->last_size);
|
||||||
g_pHyprRenderer->damageBox(&damage_box);
|
|
||||||
|
|
||||||
this->bar.damaged = true;
|
this->bar.damaged = true;
|
||||||
this->last_pos = pos;
|
this->last_pos = pos;
|
||||||
|
@ -490,8 +500,7 @@ void Hy3TabGroup::tick() {
|
||||||
pos.y -= *padding;
|
pos.y -= *padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBox damage_box = {pos.x, pos.y, size.x, size.y};
|
damageBox(&pos, &size);
|
||||||
g_pHyprRenderer->damageBox(&damage_box);
|
|
||||||
|
|
||||||
this->bar.damaged = true;
|
this->bar.damaged = true;
|
||||||
this->bar.dirty = false;
|
this->bar.dirty = false;
|
||||||
|
|
|
@ -103,6 +103,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<PHLWINDOWREF> stencil_windows;
|
std::vector<PHLWINDOWREF> stencil_windows;
|
||||||
|
Vector2D last_workspace_offset;
|
||||||
Vector2D last_pos;
|
Vector2D last_pos;
|
||||||
Vector2D last_size;
|
Vector2D last_size;
|
||||||
Hy3Node* node;
|
Hy3Node* node;
|
||||||
|
@ -114,6 +115,4 @@ private:
|
||||||
|
|
||||||
// UB if node is not a group.
|
// UB if node is not a group.
|
||||||
void updateStencilWindows(Hy3Node&);
|
void updateStencilWindows(Hy3Node&);
|
||||||
|
|
||||||
void damage();
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue