mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-15 10:43:40 +01:00
layout: add no_gaps_when_only=2
Also clean up window special render data, which may fix some unreported bugs. Closes #61
This commit is contained in:
parent
160fe1dda5
commit
8ac36f3954
3 changed files with 30 additions and 22 deletions
|
@ -1,6 +1,8 @@
|
|||
# Changelog
|
||||
|
||||
## Upcoming
|
||||
|
||||
- Added `no_gaps_when_only = 2`
|
||||
- Fixed fullscreen not working on workspaces with only floating windows
|
||||
|
||||
## hl0.36.0 and before
|
||||
|
|
|
@ -212,7 +212,10 @@ configuration options, and some explanation as to what they do.
|
|||
plugin {
|
||||
hy3 {
|
||||
# disable gaps when only one window is onscreen
|
||||
no_gaps_when_only = <bool> # default: false
|
||||
# 0 - always show gaps
|
||||
# 1 - hide gaps with a single window onscreen
|
||||
# 2 - 1 but also show the window border
|
||||
no_gaps_when_only = <int> # default: 0
|
||||
|
||||
# policy controlling what happens when a node is removed from a group,
|
||||
# leaving only a group
|
||||
|
|
|
@ -1453,6 +1453,8 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
|||
|
||||
CMonitor* monitor = nullptr;
|
||||
|
||||
auto* workspace = g_pCompositor->getWorkspaceByID(node->workspace_id);
|
||||
|
||||
if (g_pCompositor->isWorkspaceSpecial(node->workspace_id)) {
|
||||
for (auto& m: g_pCompositor->m_vMonitors) {
|
||||
if (m->specialWorkspaceID == node->workspace_id) {
|
||||
|
@ -1461,9 +1463,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
monitor = g_pCompositor->getMonitorFromID(
|
||||
g_pCompositor->getWorkspaceByID(node->workspace_id)->m_iMonitorID
|
||||
);
|
||||
monitor = g_pCompositor->getMonitorFromID(workspace->m_iMonitorID);
|
||||
}
|
||||
|
||||
if (monitor == nullptr) {
|
||||
|
@ -1476,9 +1476,11 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
|||
return;
|
||||
}
|
||||
|
||||
const auto workspace_rule = g_pConfigManager->getWorkspaceRuleFor(workspace);
|
||||
|
||||
// clang-format off
|
||||
static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
|
||||
static const auto single_window_no_gaps = ConfigValue<Hyprlang::INT>("plugin:hy3:no_gaps_when_only");
|
||||
static const auto no_gaps_when_only = ConfigValue<Hyprlang::INT>("plugin:hy3:no_gaps_when_only");
|
||||
// clang-format on
|
||||
|
||||
if (!g_pCompositor->windowExists(window) || !window->m_bIsMapped) {
|
||||
|
@ -1494,35 +1496,36 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
|||
return;
|
||||
}
|
||||
|
||||
window->m_vSize = node->size;
|
||||
window->m_vPosition = node->position;
|
||||
window->updateSpecialRenderData();
|
||||
|
||||
auto nodeBox = CBox(node->position, node->size);
|
||||
nodeBox.round();
|
||||
|
||||
window->m_vSize = nodeBox.size();
|
||||
window->m_vPosition = nodeBox.pos();
|
||||
|
||||
auto only_node = root_node != nullptr && root_node->data.as_group.children.size() == 1
|
||||
&& root_node->data.as_group.children.front()->data.type == Hy3NodeType::Window;
|
||||
|
||||
if (!g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID)
|
||||
&& ((*single_window_no_gaps && (only_node || window->m_bIsFullscreen))
|
||||
&& ((*no_gaps_when_only != 0 && (only_node || window->m_bIsFullscreen))
|
||||
|| (window->m_bIsFullscreen
|
||||
&& g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID)->m_efFullscreenMode
|
||||
== FULLSCREEN_FULL)))
|
||||
{
|
||||
|
||||
CBox wb = {window->m_vPosition, window->m_vSize};
|
||||
wb.round();
|
||||
|
||||
window->m_vRealPosition = wb.pos();
|
||||
window->m_vRealSize = wb.size();
|
||||
window->m_sSpecialRenderData.border = workspace_rule.border.value_or(*no_gaps_when_only == 2);
|
||||
window->m_sSpecialRenderData.rounding = false;
|
||||
window->m_sSpecialRenderData.shadow = false;
|
||||
|
||||
window->updateWindowDecos();
|
||||
|
||||
window->m_sSpecialRenderData.rounding = false;
|
||||
window->m_sSpecialRenderData.border = false;
|
||||
window->m_sSpecialRenderData.decorate = false;
|
||||
} else {
|
||||
window->m_sSpecialRenderData.rounding = true;
|
||||
window->m_sSpecialRenderData.border = true;
|
||||
window->m_sSpecialRenderData.decorate = true;
|
||||
const auto reserved = window->getFullWindowReservedArea();
|
||||
|
||||
window->m_vRealPosition = window->m_vPosition + reserved.topLeft;
|
||||
window->m_vRealSize = window->m_vSize - (reserved.topLeft + reserved.bottomRight);
|
||||
|
||||
g_pXWaylandManager->setWindowSize(window, window->m_vRealSize.goal());
|
||||
} else {
|
||||
auto calcPos = window->m_vPosition;
|
||||
auto calcSize = window->m_vSize;
|
||||
|
||||
|
@ -1544,7 +1547,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
|||
window->m_vRealPosition = wb.pos();
|
||||
window->m_vRealSize = wb.size();
|
||||
|
||||
g_pXWaylandManager->setWindowSize(window, calcSize);
|
||||
g_pXWaylandManager->setWindowSize(window, wb.size());
|
||||
|
||||
if (no_animation) {
|
||||
g_pHyprRenderer->damageWindow(window);
|
||||
|
|
Loading…
Add table
Reference in a new issue