layouts: apply [min|max]size window rules to dwindle & master layouts (#11898)
Uses min/max rules in the tiled layouts, akin to pseudotiling
This commit is contained in:
parent
6582f42db8
commit
7fcaf332e8
6 changed files with 105 additions and 5 deletions
|
|
@ -634,7 +634,8 @@ bool CWindow::isHidden() {
|
|||
}
|
||||
|
||||
void CWindow::applyDynamicRule(const SP<CWindowRule>& r) {
|
||||
const eOverridePriority priority = r->m_execRule ? PRIORITY_SET_PROP : PRIORITY_WINDOW_RULE;
|
||||
const eOverridePriority priority = r->m_execRule ? PRIORITY_SET_PROP : PRIORITY_WINDOW_RULE;
|
||||
static auto PCLAMP_TILED = CConfigValue<Hyprlang::INT>("misc:size_limits_tiled");
|
||||
|
||||
switch (r->m_ruleType) {
|
||||
case CWindowRule::RULE_TAG: {
|
||||
|
|
@ -751,7 +752,7 @@ void CWindow::applyDynamicRule(const SP<CWindowRule>& r) {
|
|||
}
|
||||
case CWindowRule::RULE_MAXSIZE: {
|
||||
try {
|
||||
if (!m_isFloating)
|
||||
if (!m_isFloating && !sc<bool>(*PCLAMP_TILED))
|
||||
return;
|
||||
const auto VEC = configStringToVector2D(r->m_rule.substr(8));
|
||||
if (VEC.x < 1 || VEC.y < 1) {
|
||||
|
|
@ -767,7 +768,7 @@ void CWindow::applyDynamicRule(const SP<CWindowRule>& r) {
|
|||
}
|
||||
case CWindowRule::RULE_MINSIZE: {
|
||||
try {
|
||||
if (!m_isFloating)
|
||||
if (!m_isFloating && !sc<bool>(*PCLAMP_TILED))
|
||||
return;
|
||||
const auto VEC = configStringToVector2D(r->m_rule.substr(8));
|
||||
if (VEC.x < 1 || VEC.y < 1) {
|
||||
|
|
@ -1359,7 +1360,8 @@ int CWindow::surfacesCount() {
|
|||
|
||||
void CWindow::clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize) {
|
||||
const Vector2D REALSIZE = m_realSize->goal();
|
||||
const Vector2D NEWSIZE = REALSIZE.clamp(minSize.value_or(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), maxSize.value_or(Vector2D{INFINITY, INFINITY}));
|
||||
const Vector2D MAX = isFullscreen() ? Vector2D{INFINITY, INFINITY} : maxSize.value_or(Vector2D{INFINITY, INFINITY});
|
||||
const Vector2D NEWSIZE = REALSIZE.clamp(minSize.value_or(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}), MAX);
|
||||
const Vector2D DELTA = REALSIZE - NEWSIZE;
|
||||
|
||||
*m_realPosition = m_realPosition->goal() + DELTA / 2.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue