summaryrefslogtreecommitdiff
path: root/src/layout
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-12-08 15:04:40 +0000
committerGitHub <noreply@github.com>2025-12-08 15:04:40 +0000
commit920353370bba555010506a1c0b204675c60362fe (patch)
tree87ba1036ecad6294a9c86dfc828ed2a356c810bd /src/layout
parent834f019bab5df85b912a7aab7054fc8306f7c52a (diff)
desktop: cleanup, unify desktop elements as views (#12563)
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/DwindleLayout.cpp5
-rw-r--r--src/layout/IHyprLayout.cpp23
-rw-r--r--src/layout/IHyprLayout.hpp1
3 files changed, 16 insertions, 13 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index a12f9029..c78b6f28 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -296,7 +296,8 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
if (PMONITOR->m_id == MONFROMCURSOR->m_id &&
(PNODE->workspaceID == PMONITOR->activeWorkspaceID() || (g_pCompositor->isWorkspaceSpecial(PNODE->workspaceID) && PMONITOR->m_activeSpecialWorkspace)) && !*PUSEACTIVE) {
- OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | SKIP_FULLSCREEN_PRIORITY));
+ OPENINGON = getNodeFromWindow(
+ g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::SKIP_FULLSCREEN_PRIORITY));
if (!OPENINGON && g_pCompositor->isPointOnReservedArea(MOUSECOORDS, PMONITOR))
OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS);
@@ -306,7 +307,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
Desktop::focusState()->window()->m_workspace == pWindow->m_workspace && Desktop::focusState()->window()->m_isMapped) {
OPENINGON = getNodeFromWindow(Desktop::focusState()->window());
} else {
- OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS));
+ OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS));
}
if (!OPENINGON && g_pCompositor->isPointOnReservedArea(MOUSECOORDS, PMONITOR))
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index e86f00bc..73f9d853 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -4,7 +4,7 @@
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
#include "../config/ConfigValue.hpp"
#include "../config/ConfigManager.hpp"
-#include "../desktop/Window.hpp"
+#include "../desktop/view/Window.hpp"
#include "../desktop/state/FocusState.hpp"
#include "../protocols/XDGShell.hpp"
#include "../protocols/core/Compositor.hpp"
@@ -122,7 +122,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
}
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
- const auto PWINDOWSURFACE = pWindow->m_wlSurface->resource();
+ const auto PWINDOWSURFACE = pWindow->wlSurface()->resource();
*pWindow->m_realSize = PWINDOWSURFACE->m_current.size;
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_isX11 &&
@@ -329,7 +329,8 @@ void IHyprLayout::onEndDragWindow() {
if (g_pInputManager->m_dragMode == MBIND_MOVE) {
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
- PHLWINDOW pWindow = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, DRAGGINGWINDOW);
+ PHLWINDOW pWindow =
+ g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING, DRAGGINGWINDOW);
if (pWindow) {
if (pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, DRAGGINGWINDOW))
@@ -371,8 +372,9 @@ void IHyprLayout::onEndDragWindow() {
if (*PPRECISEMOUSE) {
eDirection direction = DIRECTION_DEFAULT;
- const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
- const PHLWINDOW pReferenceWindow = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, DRAGGINGWINDOW);
+ const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
+ const PHLWINDOW pReferenceWindow =
+ g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING, DRAGGINGWINDOW);
if (pReferenceWindow && pReferenceWindow != DRAGGINGWINDOW) {
const Vector2D draggedCenter = DRAGGINGWINDOW->m_realPosition->goal() + DRAGGINGWINDOW->m_realSize->goal() / 2.f;
@@ -432,7 +434,7 @@ void IHyprLayout::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWIND
double start = 0;
double end = 0;
};
- const auto EXTENTS = DRAGGINGWINDOW->getWindowExtentsUnified(RESERVED_EXTENTS | INPUT_EXTENTS);
+ const auto EXTENTS = DRAGGINGWINDOW->getWindowExtentsUnified(Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
SRange sourceX = {sourcePos.x - EXTENTS.topLeft.x, sourcePos.x + sourceSize.x + EXTENTS.bottomRight.x};
SRange sourceY = {sourcePos.y - EXTENTS.topLeft.y, sourcePos.y + sourceSize.y + EXTENTS.bottomRight.y};
@@ -450,7 +452,7 @@ void IHyprLayout::performSnap(Vector2D& sourcePos, Vector2D& sourceSize, PHLWIND
other->isX11OverrideRedirect())
continue;
- const CBox SURF = other->getWindowBoxUnified(RESERVED_EXTENTS);
+ const CBox SURF = other->getWindowBoxUnified(Desktop::View::RESERVED_EXTENTS);
const SRange SURFBX = {SURF.x - GAPSX, SURF.x + SURF.w + GAPSX};
const SRange SURFBY = {SURF.y - GAPSY, SURF.y + SURF.h + GAPSY};
@@ -833,7 +835,7 @@ void IHyprLayout::fitFloatingWindowOnMonitor(PHLWINDOW w, std::optional<CBox> tb
if (!PMONITOR)
return;
- const auto EXTENTS = w->getWindowExtentsUnified(RESERVED_EXTENTS | INPUT_EXTENTS);
+ const auto EXTENTS = w->getWindowExtentsUnified(Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
CBox targetBoxMonLocal = tb.value_or(w->getWindowMainSurfaceBox()).translate(-PMONITOR->m_position).addExtents(EXTENTS);
const auto MONITOR_LOCAL_BOX = PMONITOR->logicalBoxMinusReserved().translate(-PMONITOR->m_position);
@@ -906,7 +908,8 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
return m_lastTiledWindow.lock();
// if we don't, let's try to find any window that is in the middle
- if (const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowUnified(pWindow->middle(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
+ if (const auto PWINDOWCANDIDATE =
+ g_pCompositor->vectorToWindowUnified(pWindow->middle(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
PWINDOWCANDIDATE && PWINDOWCANDIDATE != pWindow)
return PWINDOWCANDIDATE;
@@ -922,7 +925,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
}
// if it was a tiled window, we first try to find the window that will replace it.
- auto pWindowCandidate = g_pCompositor->vectorToWindowUnified(pWindow->middle(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
+ auto pWindowCandidate = g_pCompositor->vectorToWindowUnified(pWindow->middle(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
if (!pWindowCandidate)
pWindowCandidate = PWORKSPACE->getTopLeftWindow();
diff --git a/src/layout/IHyprLayout.hpp b/src/layout/IHyprLayout.hpp
index ad19700d..0b23bc3b 100644
--- a/src/layout/IHyprLayout.hpp
+++ b/src/layout/IHyprLayout.hpp
@@ -4,7 +4,6 @@
#include "../managers/input/InputManager.hpp"
#include <any>
-class CWindow;
class CGradientValueData;
struct SWindowRenderLayoutHints {