mirror of
https://github.com/Trensa-Organization/hy3.git
synced 2025-03-16 03:03: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
|
# Changelog
|
||||||
|
|
||||||
## Upcoming
|
## Upcoming
|
||||||
|
|
||||||
|
- Added `no_gaps_when_only = 2`
|
||||||
- Fixed fullscreen not working on workspaces with only floating windows
|
- Fixed fullscreen not working on workspaces with only floating windows
|
||||||
|
|
||||||
## hl0.36.0 and before
|
## hl0.36.0 and before
|
||||||
|
|
|
@ -212,7 +212,10 @@ configuration options, and some explanation as to what they do.
|
||||||
plugin {
|
plugin {
|
||||||
hy3 {
|
hy3 {
|
||||||
# disable gaps when only one window is onscreen
|
# 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,
|
# policy controlling what happens when a node is removed from a group,
|
||||||
# leaving only a group
|
# leaving only a group
|
||||||
|
|
|
@ -1453,6 +1453,8 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
||||||
|
|
||||||
CMonitor* monitor = nullptr;
|
CMonitor* monitor = nullptr;
|
||||||
|
|
||||||
|
auto* workspace = g_pCompositor->getWorkspaceByID(node->workspace_id);
|
||||||
|
|
||||||
if (g_pCompositor->isWorkspaceSpecial(node->workspace_id)) {
|
if (g_pCompositor->isWorkspaceSpecial(node->workspace_id)) {
|
||||||
for (auto& m: g_pCompositor->m_vMonitors) {
|
for (auto& m: g_pCompositor->m_vMonitors) {
|
||||||
if (m->specialWorkspaceID == node->workspace_id) {
|
if (m->specialWorkspaceID == node->workspace_id) {
|
||||||
|
@ -1461,9 +1463,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
monitor = g_pCompositor->getMonitorFromID(
|
monitor = g_pCompositor->getMonitorFromID(workspace->m_iMonitorID);
|
||||||
g_pCompositor->getWorkspaceByID(node->workspace_id)->m_iMonitorID
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitor == nullptr) {
|
if (monitor == nullptr) {
|
||||||
|
@ -1476,9 +1476,11 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto workspace_rule = g_pConfigManager->getWorkspaceRuleFor(workspace);
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const auto gaps_in = ConfigValue<Hyprlang::CUSTOMTYPE, CCssGapData>("general:gaps_in");
|
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
|
// clang-format on
|
||||||
|
|
||||||
if (!g_pCompositor->windowExists(window) || !window->m_bIsMapped) {
|
if (!g_pCompositor->windowExists(window) || !window->m_bIsMapped) {
|
||||||
|
@ -1494,35 +1496,36 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->m_vSize = node->size;
|
window->updateSpecialRenderData();
|
||||||
window->m_vPosition = node->position;
|
|
||||||
|
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
|
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;
|
&& root_node->data.as_group.children.front()->data.type == Hy3NodeType::Window;
|
||||||
|
|
||||||
if (!g_pCompositor->isWorkspaceSpecial(window->m_iWorkspaceID)
|
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
|
|| (window->m_bIsFullscreen
|
||||||
&& g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID)->m_efFullscreenMode
|
&& g_pCompositor->getWorkspaceByID(window->m_iWorkspaceID)->m_efFullscreenMode
|
||||||
== FULLSCREEN_FULL)))
|
== FULLSCREEN_FULL)))
|
||||||
{
|
{
|
||||||
|
window->m_sSpecialRenderData.border = workspace_rule.border.value_or(*no_gaps_when_only == 2);
|
||||||
CBox wb = {window->m_vPosition, window->m_vSize};
|
window->m_sSpecialRenderData.rounding = false;
|
||||||
wb.round();
|
window->m_sSpecialRenderData.shadow = false;
|
||||||
|
|
||||||
window->m_vRealPosition = wb.pos();
|
|
||||||
window->m_vRealSize = wb.size();
|
|
||||||
|
|
||||||
window->updateWindowDecos();
|
window->updateWindowDecos();
|
||||||
|
|
||||||
window->m_sSpecialRenderData.rounding = false;
|
const auto reserved = window->getFullWindowReservedArea();
|
||||||
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;
|
|
||||||
|
|
||||||
|
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 calcPos = window->m_vPosition;
|
||||||
auto calcSize = window->m_vSize;
|
auto calcSize = window->m_vSize;
|
||||||
|
|
||||||
|
@ -1544,7 +1547,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) {
|
||||||
window->m_vRealPosition = wb.pos();
|
window->m_vRealPosition = wb.pos();
|
||||||
window->m_vRealSize = wb.size();
|
window->m_vRealSize = wb.size();
|
||||||
|
|
||||||
g_pXWaylandManager->setWindowSize(window, calcSize);
|
g_pXWaylandManager->setWindowSize(window, wb.size());
|
||||||
|
|
||||||
if (no_animation) {
|
if (no_animation) {
|
||||||
g_pHyprRenderer->damageWindow(window);
|
g_pHyprRenderer->damageWindow(window);
|
||||||
|
|
Loading…
Add table
Reference in a new issue