Revert "windows/xdg: minor cleanup of min/max size calculations" and restore related functionalities in XWayland manager
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 3m20s
All checks were successful
PikaOS Package Build & Release (amd64-v3) / build (push) Successful in 3m20s
This commit is contained in:
parent
f7cbd3d673
commit
7c1d7141be
2
.github/release-nest-v3
vendored
2
.github/release-nest-v3
vendored
@ -1 +1 @@
|
||||
2
|
||||
1
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
hyprland (0.45.1git-101pika9) pika; urgency=medium
|
||||
hyprland (0.45.1git-101pika10) pika; urgency=medium
|
||||
|
||||
* Upstream update
|
||||
|
||||
|
294
debian/patches/0001-Revert-windows-xdg-minor-cleanup-of-min-max-size-cal.patch
vendored
Normal file
294
debian/patches/0001-Revert-windows-xdg-minor-cleanup-of-min-max-size-cal.patch
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
From ca899af4d454024bcc813581be87607cc67e94e3 Mon Sep 17 00:00:00 2001
|
||||
From: ferreo <harderthanfire@gmail.com>
|
||||
Date: Tue, 19 Nov 2024 14:37:42 +0000
|
||||
Subject: [PATCH] Revert "windows/xdg: minor cleanup of min/max size
|
||||
calculations"
|
||||
|
||||
This reverts commit b735295d2b0025b26f88852c06f65514a963c711.
|
||||
---
|
||||
src/desktop/Window.cpp | 26 --------------------------
|
||||
src/desktop/Window.hpp | 19 ++++++++++---------
|
||||
src/events/Windows.cpp | 8 ++++----
|
||||
src/layout/DwindleLayout.cpp | 2 +-
|
||||
src/layout/IHyprLayout.cpp | 8 ++++----
|
||||
src/layout/MasterLayout.cpp | 4 ++--
|
||||
src/managers/XWaylandManager.cpp | 30 ++++++++++++++++++++++++++++++
|
||||
src/managers/XWaylandManager.hpp | 2 ++
|
||||
src/protocols/XDGShell.cpp | 8 --------
|
||||
src/protocols/XDGShell.hpp | 3 ---
|
||||
10 files changed, 53 insertions(+), 57 deletions(-)
|
||||
|
||||
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
|
||||
index 33e6a5f8..7ad6d7ef 100644
|
||||
--- a/src/desktop/Window.cpp
|
||||
+++ b/src/desktop/Window.cpp
|
||||
@@ -1601,29 +1601,3 @@ bool CWindow::isX11OverrideRedirect() {
|
||||
bool CWindow::isModal() {
|
||||
return (m_pXWaylandSurface && m_pXWaylandSurface->modal);
|
||||
}
|
||||
-
|
||||
-Vector2D CWindow::requestedMinSize() {
|
||||
- if ((m_bIsX11 && !m_pXWaylandSurface->sizeHints) || (!m_bIsX11 && !m_pXDGSurface->toplevel))
|
||||
- return Vector2D(1, 1);
|
||||
-
|
||||
- Vector2D minSize = m_bIsX11 ? Vector2D(m_pXWaylandSurface->sizeHints->min_width, m_pXWaylandSurface->sizeHints->min_height) : m_pXDGSurface->toplevel->layoutMinSize();
|
||||
-
|
||||
- minSize = minSize.clamp({1, 1});
|
||||
-
|
||||
- return minSize;
|
||||
-}
|
||||
-
|
||||
-Vector2D CWindow::requestedMaxSize() {
|
||||
- constexpr int NO_MAX_SIZE_LIMIT = 99999;
|
||||
- if (((m_bIsX11 && !m_pXWaylandSurface->sizeHints) || (!m_bIsX11 && !m_pXDGSurface->toplevel) || m_sWindowData.noMaxSize.valueOrDefault()))
|
||||
- return Vector2D(NO_MAX_SIZE_LIMIT, NO_MAX_SIZE_LIMIT);
|
||||
-
|
||||
- Vector2D maxSize = m_bIsX11 ? Vector2D(m_pXWaylandSurface->sizeHints->max_width, m_pXWaylandSurface->sizeHints->max_height) : m_pXDGSurface->toplevel->layoutMaxSize();
|
||||
-
|
||||
- if (maxSize.x < 5)
|
||||
- maxSize.x = NO_MAX_SIZE_LIMIT;
|
||||
- if (maxSize.y < 5)
|
||||
- maxSize.y = NO_MAX_SIZE_LIMIT;
|
||||
-
|
||||
- return maxSize;
|
||||
-}
|
||||
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
|
||||
index ac81e5ef..b8dd3cf7 100644
|
||||
--- a/src/desktop/Window.hpp
|
||||
+++ b/src/desktop/Window.hpp
|
||||
@@ -403,9 +403,12 @@ class CWindow {
|
||||
}
|
||||
|
||||
// methods
|
||||
- CBox getFullWindowBoundingBox();
|
||||
- SBoxExtents getFullWindowExtents();
|
||||
- CBox getWindowBoxUnified(uint64_t props);
|
||||
+ CBox getFullWindowBoundingBox();
|
||||
+ SBoxExtents getFullWindowExtents();
|
||||
+ CBox getWindowBoxUnified(uint64_t props);
|
||||
+ inline CBox getWindowMainSurfaceBox() const {
|
||||
+ return {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
|
||||
+ }
|
||||
CBox getWindowIdealBoundingBoxIgnoreReserved();
|
||||
void addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco);
|
||||
void updateWindowDecos();
|
||||
@@ -438,15 +441,19 @@ class CWindow {
|
||||
void activate(bool force = false);
|
||||
int surfacesCount();
|
||||
void clampWindowSize(const std::optional<Vector2D> minSize, const std::optional<Vector2D> maxSize);
|
||||
+
|
||||
bool isFullscreen();
|
||||
bool isEffectiveInternalFSMode(const eFullscreenMode);
|
||||
+
|
||||
int getRealBorderSize();
|
||||
void updateWindowData();
|
||||
void updateWindowData(const struct SWorkspaceRule&);
|
||||
+
|
||||
void onBorderAngleAnimEnd(void* ptr);
|
||||
bool isInCurvedCorner(double x, double y);
|
||||
bool hasPopupAt(const Vector2D& pos);
|
||||
int popupsCount();
|
||||
+
|
||||
void applyGroupRules();
|
||||
void createGroup();
|
||||
void destroyGroup();
|
||||
@@ -474,12 +481,6 @@ class CWindow {
|
||||
void unsetWindowData(eOverridePriority priority);
|
||||
bool isX11OverrideRedirect();
|
||||
bool isModal();
|
||||
- Vector2D requestedMinSize();
|
||||
- Vector2D requestedMaxSize();
|
||||
-
|
||||
- inline CBox getWindowMainSurfaceBox() const {
|
||||
- return {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
|
||||
- }
|
||||
|
||||
// listeners
|
||||
void onAck(uint32_t serial);
|
||||
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
|
||||
index 73ab45c1..77df7373 100644
|
||||
--- a/src/events/Windows.cpp
|
||||
+++ b/src/events/Windows.cpp
|
||||
@@ -346,7 +346,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
|
||||
|
||||
- const auto MAXSIZE = PWINDOW->requestedMaxSize();
|
||||
+ const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW);
|
||||
|
||||
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, PMONITOR->vecSize.x) :
|
||||
stringToFloatClamp(SIZEXSTR, PWINDOW->m_vRealSize.goal().x, PMONITOR->vecSize.x);
|
||||
@@ -469,7 +469,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
|
||||
|
||||
- const auto MAXSIZE = PWINDOW->requestedMaxSize();
|
||||
+ const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW);
|
||||
|
||||
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, PMONITOR->vecSize.x) : stringToPercentage(SIZEXSTR, PMONITOR->vecSize.x);
|
||||
|
||||
@@ -753,8 +753,8 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
||||
PWINDOW->m_vReportedSize = PWINDOW->m_vPendingReportedSize; // apply pending size. We pinged, the window ponged.
|
||||
|
||||
if (!PWINDOW->m_bIsX11 && !PWINDOW->isFullscreen() && PWINDOW->m_bIsFloating) {
|
||||
- const auto MINSIZE = PWINDOW->m_pXDGSurface->toplevel->layoutMinSize();
|
||||
- const auto MAXSIZE = PWINDOW->m_pXDGSurface->toplevel->layoutMaxSize();
|
||||
+ const auto MINSIZE = PWINDOW->m_pXDGSurface->toplevel->current.minSize;
|
||||
+ const auto MAXSIZE = PWINDOW->m_pXDGSurface->toplevel->current.maxSize;
|
||||
|
||||
PWINDOW->clampWindowSize(MINSIZE, MAXSIZE > Vector2D{1, 1} ? std::optional<Vector2D>{MAXSIZE} : std::nullopt);
|
||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
|
||||
index c3e394f3..e6e9090f 100644
|
||||
--- a/src/layout/DwindleLayout.cpp
|
||||
+++ b/src/layout/DwindleLayout.cpp
|
||||
@@ -283,7 +283,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
|
||||
|
||||
// first, check if OPENINGON isn't too big.
|
||||
const auto PREDSIZEMAX = OPENINGON ? Vector2D(OPENINGON->box.w, OPENINGON->box.h) : PMONITOR->vecSize;
|
||||
- if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PREDSIZEMAX.x || MAXSIZE.y < PREDSIZEMAX.y) {
|
||||
+ if (const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow); MAXSIZE.x < PREDSIZEMAX.x || MAXSIZE.y < PREDSIZEMAX.y) {
|
||||
// we can't continue. make it floating.
|
||||
pWindow->m_bIsFloating = true;
|
||||
m_lDwindleNodesData.remove(*PNODE);
|
||||
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
|
||||
index af8b907c..a312555f 100644
|
||||
--- a/src/layout/IHyprLayout.cpp
|
||||
+++ b/src/layout/IHyprLayout.cpp
|
||||
@@ -597,12 +597,12 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
||||
} else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) {
|
||||
if (DRAGGINGWINDOW->m_bIsFloating) {
|
||||
|
||||
- Vector2D MINSIZE = DRAGGINGWINDOW->requestedMinSize().clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(20, 20)));
|
||||
+ Vector2D MINSIZE = g_pXWaylandManager->getMinSizeForWindow(DRAGGINGWINDOW).clamp(DRAGGINGWINDOW->m_sWindowData.minSize.valueOr(Vector2D(20, 20)));
|
||||
Vector2D MAXSIZE;
|
||||
if (DRAGGINGWINDOW->m_sWindowData.maxSize.hasValue())
|
||||
- MAXSIZE = DRAGGINGWINDOW->requestedMaxSize().clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.value());
|
||||
+ MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, DRAGGINGWINDOW->m_sWindowData.maxSize.value());
|
||||
else
|
||||
- MAXSIZE = DRAGGINGWINDOW->requestedMaxSize().clamp({}, Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
|
||||
+ MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW).clamp({}, Vector2D(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
|
||||
|
||||
Vector2D newSize = m_vBeginDragSizeXY;
|
||||
Vector2D newPos = m_vBeginDragPositionXY;
|
||||
@@ -884,7 +884,7 @@ Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // ge
|
||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
||||
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
|
||||
|
||||
- const auto MAXSIZE = pWindow->requestedMaxSize();
|
||||
+ const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow);
|
||||
|
||||
const float SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, MIN_WINDOW_SIZE, g_pCompositor->m_pLastMonitor->vecSize.x) :
|
||||
stringToPercentage(SIZEXSTR, g_pCompositor->m_pLastMonitor->vecSize.x);
|
||||
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
|
||||
index 695dcc99..b8b3efea 100644
|
||||
--- a/src/layout/MasterLayout.cpp
|
||||
+++ b/src/layout/MasterLayout.cpp
|
||||
@@ -200,7 +200,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire
|
||||
PNODE->percMaster = lastSplitPercent;
|
||||
|
||||
// first, check if it isn't too big.
|
||||
- if (const auto MAXSIZE = pWindow->requestedMaxSize(); MAXSIZE.x < PMONITOR->vecSize.x * lastSplitPercent || MAXSIZE.y < PMONITOR->vecSize.y) {
|
||||
+ if (const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow); MAXSIZE.x < PMONITOR->vecSize.x * lastSplitPercent || MAXSIZE.y < PMONITOR->vecSize.y) {
|
||||
// we can't continue. make it floating.
|
||||
pWindow->m_bIsFloating = true;
|
||||
m_lMasterNodesData.remove(*PNODE);
|
||||
@@ -212,7 +212,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire
|
||||
PNODE->percMaster = lastSplitPercent;
|
||||
|
||||
// first, check if it isn't too big.
|
||||
- if (const auto MAXSIZE = pWindow->requestedMaxSize();
|
||||
+ if (const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(pWindow);
|
||||
MAXSIZE.x < PMONITOR->vecSize.x * (1 - lastSplitPercent) || MAXSIZE.y < PMONITOR->vecSize.y * (1.f / (WINDOWSONWORKSPACE - 1))) {
|
||||
// we can't continue. make it floating.
|
||||
pWindow->m_bIsFloating = true;
|
||||
diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp
|
||||
index 832173eb..d0dda8e6 100644
|
||||
--- a/src/managers/XWaylandManager.cpp
|
||||
+++ b/src/managers/XWaylandManager.cpp
|
||||
@@ -213,6 +213,36 @@ void CHyprXWaylandManager::setWindowFullscreen(PHLWINDOW pWindow, bool fullscree
|
||||
pWindow->m_pXDGSurface->toplevel->setFullscreen(fullscreen);
|
||||
}
|
||||
|
||||
+Vector2D CHyprXWaylandManager::getMaxSizeForWindow(PHLWINDOW pWindow) {
|
||||
+ constexpr int NO_MAX_SIZE_LIMIT = 99999;
|
||||
+ if (!validMapped(pWindow) ||
|
||||
+ ((pWindow->m_bIsX11 && !pWindow->m_pXWaylandSurface->sizeHints) || (!pWindow->m_bIsX11 && !pWindow->m_pXDGSurface->toplevel) ||
|
||||
+ pWindow->m_sWindowData.noMaxSize.valueOrDefault()))
|
||||
+ return Vector2D(NO_MAX_SIZE_LIMIT, NO_MAX_SIZE_LIMIT);
|
||||
+
|
||||
+ Vector2D maxSize = pWindow->m_bIsX11 ? Vector2D(pWindow->m_pXWaylandSurface->sizeHints->max_width, pWindow->m_pXWaylandSurface->sizeHints->max_height) :
|
||||
+ pWindow->m_pXDGSurface->toplevel->current.maxSize;
|
||||
+
|
||||
+ if (maxSize.x < 5)
|
||||
+ maxSize.x = NO_MAX_SIZE_LIMIT;
|
||||
+ if (maxSize.y < 5)
|
||||
+ maxSize.y = NO_MAX_SIZE_LIMIT;
|
||||
+
|
||||
+ return maxSize;
|
||||
+}
|
||||
+
|
||||
+Vector2D CHyprXWaylandManager::getMinSizeForWindow(PHLWINDOW pWindow) {
|
||||
+ if (!validMapped(pWindow) || ((pWindow->m_bIsX11 && !pWindow->m_pXWaylandSurface->sizeHints) || (!pWindow->m_bIsX11 && !pWindow->m_pXDGSurface->toplevel)))
|
||||
+ return Vector2D(0, 0);
|
||||
+
|
||||
+ Vector2D minSize = pWindow->m_bIsX11 ? Vector2D(pWindow->m_pXWaylandSurface->sizeHints->min_width, pWindow->m_pXWaylandSurface->sizeHints->min_height) :
|
||||
+ pWindow->m_pXDGSurface->toplevel->current.minSize;
|
||||
+
|
||||
+ minSize = minSize.clamp({1, 1});
|
||||
+
|
||||
+ return minSize;
|
||||
+}
|
||||
+
|
||||
Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) {
|
||||
|
||||
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");
|
||||
diff --git a/src/managers/XWaylandManager.hpp b/src/managers/XWaylandManager.hpp
|
||||
index 508a20d6..a9f95974 100644
|
||||
--- a/src/managers/XWaylandManager.hpp
|
||||
+++ b/src/managers/XWaylandManager.hpp
|
||||
@@ -21,6 +21,8 @@ class CHyprXWaylandManager {
|
||||
void setWindowFullscreen(PHLWINDOW, bool);
|
||||
bool shouldBeFloated(PHLWINDOW, bool pending = false);
|
||||
void checkBorders(PHLWINDOW);
|
||||
+ Vector2D getMaxSizeForWindow(PHLWINDOW);
|
||||
+ Vector2D getMinSizeForWindow(PHLWINDOW);
|
||||
Vector2D xwaylandToWaylandCoords(const Vector2D&);
|
||||
};
|
||||
|
||||
diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp
|
||||
index 932882e9..25d8b1ba 100644
|
||||
--- a/src/protocols/XDGShell.cpp
|
||||
+++ b/src/protocols/XDGShell.cpp
|
||||
@@ -323,14 +323,6 @@ void CXDGToplevelResource::close() {
|
||||
resource->sendClose();
|
||||
}
|
||||
|
||||
-Vector2D CXDGToplevelResource::layoutMinSize() {
|
||||
- return owner ? current.minSize + owner->current.geometry.pos() : current.minSize;
|
||||
-}
|
||||
-
|
||||
-Vector2D CXDGToplevelResource::layoutMaxSize() {
|
||||
- return owner ? current.maxSize + owner->current.geometry.pos() : current.maxSize;
|
||||
-}
|
||||
-
|
||||
CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBase> owner_, SP<CWLSurfaceResource> surface_) :
|
||||
owner(owner_), surface(surface_), resource(resource_) {
|
||||
if (!good())
|
||||
diff --git a/src/protocols/XDGShell.hpp b/src/protocols/XDGShell.hpp
|
||||
index ef847f3b..9c766c20 100644
|
||||
--- a/src/protocols/XDGShell.hpp
|
||||
+++ b/src/protocols/XDGShell.hpp
|
||||
@@ -99,9 +99,6 @@ class CXDGToplevelResource {
|
||||
|
||||
bool good();
|
||||
|
||||
- Vector2D layoutMinSize();
|
||||
- Vector2D layoutMaxSize();
|
||||
-
|
||||
// schedule a configure event
|
||||
uint32_t setSize(const Vector2D& size);
|
||||
uint32_t setMaximized(bool maximized);
|
||||
--
|
||||
2.45.2
|
||||
|
1
debian/patches/series
vendored
Normal file
1
debian/patches/series
vendored
Normal file
@ -0,0 +1 @@
|
||||
0001-Revert-windows-xdg-minor-cleanup-of-min-max-size-cal.patch
|
Loading…
Reference in New Issue
Block a user