mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-16 03:03:40 +01:00
Fix tab bars appearing on all workspaces
This commit is contained in:
parent
76551a40ef
commit
45d0c20cba
3 changed files with 14 additions and 0 deletions
|
@ -586,6 +586,7 @@ void Hy3Node::updateTabBar() {
|
||||||
FindTopWindowInNodeResult result;
|
FindTopWindowInNodeResult result;
|
||||||
findTopWindowInNode(*this, result);
|
findTopWindowInNode(*this, result);
|
||||||
group.tab_bar->target_window = result.window;
|
group.tab_bar->target_window = result.window;
|
||||||
|
if (result.window != nullptr) group.tab_bar->workspace_id = result.window->m_iWorkspaceID;
|
||||||
} else if (group.tab_bar != nullptr) {
|
} else if (group.tab_bar != nullptr) {
|
||||||
group.tab_bar->bar.beginDestroy();
|
group.tab_bar->bar.beginDestroy();
|
||||||
group.tab_bar = nullptr;
|
group.tab_bar = nullptr;
|
||||||
|
|
|
@ -311,16 +311,28 @@ void Hy3TabGroup::renderTabBar() {
|
||||||
static const auto* padding = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
|
static const auto* padding = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
|
||||||
|
|
||||||
auto* monitor = g_pHyprOpenGL->m_RenderData.pMonitor;
|
auto* monitor = g_pHyprOpenGL->m_RenderData.pMonitor;
|
||||||
|
auto* workspace = g_pCompositor->getWorkspaceByID(this->workspace_id);
|
||||||
auto scale = monitor->scale;
|
auto scale = monitor->scale;
|
||||||
|
|
||||||
|
auto monitor_size = monitor->vecSize;
|
||||||
auto pos = this->pos.vec() - monitor->vecPosition;
|
auto pos = this->pos.vec() - monitor->vecPosition;
|
||||||
auto size = this->size.vec();
|
auto size = this->size.vec();
|
||||||
pos.y += (this->bar.vertical_pos.fl() * size.y) * (*enter_from_top ? -1 : 1);
|
pos.y += (this->bar.vertical_pos.fl() * size.y) * (*enter_from_top ? -1 : 1);
|
||||||
|
|
||||||
|
if (workspace != nullptr) {
|
||||||
|
pos = pos + workspace->m_vRenderOffset.vec();
|
||||||
|
}
|
||||||
|
|
||||||
auto scaled_pos = Vector2D(std::round(pos.x * scale), std::round(pos.y * scale));
|
auto scaled_pos = Vector2D(std::round(pos.x * scale), std::round(pos.y * scale));
|
||||||
auto scaled_size = Vector2D(std::round(size.x * scale), std::round(size.y * scale));
|
auto scaled_size = Vector2D(std::round(size.x * scale), std::round(size.y * scale));
|
||||||
wlr_box box = { scaled_pos.x, scaled_pos.y, scaled_size.x, scaled_size.y };
|
wlr_box box = { scaled_pos.x, scaled_pos.y, scaled_size.x, scaled_size.y };
|
||||||
|
|
||||||
|
if (scaled_pos.x > monitor_size.x
|
||||||
|
|| scaled_pos.y > monitor_size.y
|
||||||
|
|| scaled_pos.x + scaled_size.x < 0
|
||||||
|
|| scaled_pos.y + scaled_size.y < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!this->bar.damaged) {
|
if (!this->bar.damaged) {
|
||||||
pixman_region32 damage;
|
pixman_region32 damage;
|
||||||
pixman_region32_init(&damage);
|
pixman_region32_init(&damage);
|
||||||
|
|
|
@ -63,6 +63,7 @@ private:
|
||||||
class Hy3TabGroup {
|
class Hy3TabGroup {
|
||||||
public:
|
public:
|
||||||
CWindow* target_window = nullptr;
|
CWindow* target_window = nullptr;
|
||||||
|
int workspace_id = -1;
|
||||||
Hy3TabBar bar;
|
Hy3TabBar bar;
|
||||||
CAnimatedVariable pos;
|
CAnimatedVariable pos;
|
||||||
CAnimatedVariable size;
|
CAnimatedVariable size;
|
||||||
|
|
Loading…
Add table
Reference in a new issue