mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 18:53:40 +01:00
Fix longstanding fullscreen issues
Fullscreen was implemented via recalculating window bounds with a fake node when you pressed fullscreen. The check has been moved into `recalcSizePosRecursive` which causes the override to fire every time a window's size is recalculated instead of only the first time. Closes #34, #39
This commit is contained in:
parent
352419bb9f
commit
c1718d38bc
3 changed files with 42 additions and 54 deletions
26
flake.lock
generated
26
flake.lock
generated
|
@ -9,11 +9,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1698018813,
|
"lastModified": 1698945632,
|
||||||
"narHash": "sha256-JMg+HRyTOZK3W8pRNyJTp7AOWYkbs+LaKqAFc+cScyM=",
|
"narHash": "sha256-D49t5G6JBDLRZv5nrMoOoC4J611z1S0LQ7RkNImpGI0=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "Hyprland",
|
"repo": "Hyprland",
|
||||||
"rev": "015664eb4cde5ab93cfacbfd8c2e831eeb876634",
|
"rev": "f10996b5753bfc854b019f6889d6bc0c91961e3f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -49,11 +49,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1694767346,
|
"lastModified": 1698134075,
|
||||||
"narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=",
|
"narHash": "sha256-foCD+nuKzfh49bIoiCBur4+Fx1nozo+4C/6k8BYk4sg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ace5093e36ab1e95cb9463863491bee90d5a4183",
|
"rev": "8efd5d1e283604f75a808a20e6cde0ef313d07d4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -87,18 +87,18 @@
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"host": "gitlab.freedesktop.org",
|
"host": "gitlab.freedesktop.org",
|
||||||
"lastModified": 1696410538,
|
"lastModified": 1697909146,
|
||||||
"narHash": "sha256-ecDhdYLXWHsxMv+EWG36mCNDvzRbu9qfjH7dLxL7aGM=",
|
"narHash": "sha256-jU0I6FoCKnj4zIBL4daosFWh81U1fM719Z6cae8PxSY=",
|
||||||
"owner": "wlroots",
|
"owner": "wlroots",
|
||||||
"repo": "wlroots",
|
"repo": "wlroots",
|
||||||
"rev": "3406c1b17a4a7e6d4e2a7d9c1176affa72bce1bc",
|
"rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"host": "gitlab.freedesktop.org",
|
"host": "gitlab.freedesktop.org",
|
||||||
"owner": "wlroots",
|
"owner": "wlroots",
|
||||||
"repo": "wlroots",
|
"repo": "wlroots",
|
||||||
"rev": "3406c1b17a4a7e6d4e2a7d9c1176affa72bce1bc",
|
"rev": "47bf87ade2bd32395615a385ebde1fefbcdf79a2",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -118,11 +118,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1694628480,
|
"lastModified": 1697981233,
|
||||||
"narHash": "sha256-Qg9hstRw0pvjGu5hStkr2UX1D73RYcQ9Ns/KnZMIm9w=",
|
"narHash": "sha256-y8q4XUwx+gVK7i2eLjfR32lVo7TYvEslyzrmzYEaPZU=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "xdg-desktop-portal-hyprland",
|
"repo": "xdg-desktop-portal-hyprland",
|
||||||
"rev": "8f45a6435069b9e24ebd3160eda736d7a391cbf2",
|
"rev": "22e7a65ff9633e1dedfa5317fdffc49f68de2ff2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -336,46 +336,6 @@ void Hy3Layout::recalculateMonitor(const int& monitor_id) {
|
||||||
top_node->recalcSizePosRecursive();
|
top_node->recalcSizePosRecursive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workspace->m_bHasFullscreenWindow) {
|
|
||||||
const auto window = g_pCompositor->getFullscreenWindowOnWorkspace(workspace->m_iID);
|
|
||||||
|
|
||||||
if (workspace->m_efFullscreenMode == FULLSCREEN_FULL) {
|
|
||||||
window->m_vRealPosition = monitor->vecPosition;
|
|
||||||
window->m_vRealSize = monitor->vecSize;
|
|
||||||
} else {
|
|
||||||
// Vaxry's hack from below, but again
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
|
|
||||||
static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
int outer_gaps = -(*gaps_in - *gaps_out);
|
|
||||||
auto gap_topleft_offset = Vector2D(outer_gaps, outer_gaps);
|
|
||||||
auto gap_bottomright_offset = Vector2D(outer_gaps, outer_gaps);
|
|
||||||
|
|
||||||
Hy3Node fakeNode = {
|
|
||||||
.data = window,
|
|
||||||
.position = monitor->vecPosition + monitor->vecReservedTopLeft,
|
|
||||||
.size = monitor->vecSize - monitor->vecReservedTopLeft - monitor->vecReservedBottomRight,
|
|
||||||
.gap_topleft_offset = gap_topleft_offset,
|
|
||||||
.gap_bottomright_offset = gap_bottomright_offset,
|
|
||||||
.workspace_id = window->m_iWorkspaceID,
|
|
||||||
};
|
|
||||||
|
|
||||||
this->applyNodeDataToWindow(&fakeNode);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const auto top_node = this->getWorkspaceRootGroup(monitor->activeWorkspace);
|
|
||||||
|
|
||||||
if (top_node != nullptr) {
|
|
||||||
top_node->position = monitor->vecPosition + monitor->vecReservedTopLeft;
|
|
||||||
top_node->size =
|
|
||||||
monitor->vecSize - monitor->vecReservedTopLeft - monitor->vecReservedBottomRight;
|
|
||||||
top_node->recalcSizePosRecursive();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hy3Layout::recalculateWindow(CWindow* window) {
|
void Hy3Layout::recalculateWindow(CWindow* window) {
|
||||||
|
|
|
@ -272,6 +272,34 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
|
||||||
static const auto* tab_bar_padding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
|
static const auto* tab_bar_padding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
if (this->data.type == Hy3NodeType::Window && this->data.as_window->m_bIsFullscreen) {
|
||||||
|
auto* workspace = g_pCompositor->getWorkspaceByID(this->workspace_id);
|
||||||
|
auto* monitor = g_pCompositor->getMonitorFromID(workspace->m_iMonitorID);
|
||||||
|
|
||||||
|
if (workspace->m_efFullscreenMode == FULLSCREEN_FULL) {
|
||||||
|
this->data.as_window->m_vRealPosition = monitor->vecPosition;
|
||||||
|
this->data.as_window->m_vRealSize = monitor->vecSize;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int outer_gaps = -(*gaps_in - *gaps_out);
|
||||||
|
|
||||||
|
auto gap_topleft_offset = Vector2D(outer_gaps, outer_gaps);
|
||||||
|
auto gap_bottomright_offset = Vector2D(outer_gaps, outer_gaps);
|
||||||
|
|
||||||
|
Hy3Node fake_node = {
|
||||||
|
.data = this->data.as_window,
|
||||||
|
.position = monitor->vecPosition + monitor->vecReservedTopLeft,
|
||||||
|
.size = monitor->vecSize - monitor->vecReservedTopLeft - monitor->vecReservedBottomRight,
|
||||||
|
.gap_topleft_offset = gap_topleft_offset,
|
||||||
|
.gap_bottomright_offset = gap_bottomright_offset,
|
||||||
|
.workspace_id = this->workspace_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
this->layout->applyNodeDataToWindow(&fake_node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int outer_gaps = 0;
|
int outer_gaps = 0;
|
||||||
Vector2D gap_topleft_offset;
|
Vector2D gap_topleft_offset;
|
||||||
Vector2D gap_bottomright_offset;
|
Vector2D gap_bottomright_offset;
|
||||||
|
@ -290,7 +318,7 @@ void Hy3Node::recalcSizePosRecursive(bool no_animation) {
|
||||||
|
|
||||||
double tab_height_offset = *tab_bar_height + *tab_bar_padding;
|
double tab_height_offset = *tab_bar_height + *tab_bar_padding;
|
||||||
|
|
||||||
if (this->data.type != Hy3NodeType::Group) {
|
if (this->data.type == Hy3NodeType::Window) {
|
||||||
this->data.as_window->setHidden(this->hidden);
|
this->data.as_window->setHidden(this->hidden);
|
||||||
this->layout->applyNodeDataToWindow(this, no_animation);
|
this->layout->applyNodeDataToWindow(this, no_animation);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue