summaryrefslogtreecommitdiff
path: root/src/render
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/render
parent834f019bab5df85b912a7aab7054fc8306f7c52a (diff)
desktop: cleanup, unify desktop elements as views (#12563)
Diffstat (limited to 'src/render')
-rw-r--r--src/render/OpenGL.cpp6
-rw-r--r--src/render/OpenGL.hpp46
-rw-r--r--src/render/Renderer.cpp73
-rw-r--r--src/render/Renderer.hpp25
-rw-r--r--src/render/decorations/DecorationPositioner.cpp2
-rw-r--r--src/render/decorations/DecorationPositioner.hpp1
-rw-r--r--src/render/decorations/IHyprWindowDecoration.cpp2
-rw-r--r--src/render/decorations/IHyprWindowDecoration.hpp1
-rw-r--r--src/render/pass/Pass.cpp8
-rw-r--r--src/render/pass/SurfacePassElement.cpp20
10 files changed, 84 insertions, 100 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 2f1bccb2..ae01d2a1 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -13,7 +13,7 @@
#include "../config/ConfigValue.hpp"
#include "../config/ConfigManager.hpp"
#include "../managers/PointerManager.hpp"
-#include "../desktop/LayerSurface.hpp"
+#include "../desktop/view/LayerSurface.hpp"
#include "../desktop/state/FocusState.hpp"
#include "../protocols/LayerShell.hpp"
#include "../protocols/core/Compositor.hpp"
@@ -2211,10 +2211,10 @@ void CHyprOpenGLImpl::preRender(PHLMONITOR pMonitor) {
if (pWindow->m_ruleApplicator->noBlur().valueOrDefault())
return false;
- if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall)
+ if (pWindow->wlSurface()->small() && !pWindow->wlSurface()->m_fillIgnoreSmall)
return true;
- const auto PSURFACE = pWindow->m_wlSurface->resource();
+ const auto PSURFACE = pWindow->wlSurface()->resource();
const auto PWORKSPACE = pWindow->m_workspace;
const float A = pWindow->m_alpha->value() * pWindow->m_activeInactiveAlpha->value() * PWORKSPACE->m_alpha->value();
diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp
index 45ed28dd..8d0c48aa 100644
--- a/src/render/OpenGL.hpp
+++ b/src/render/OpenGL.hpp
@@ -269,38 +269,38 @@ class CHyprOpenGLImpl {
void setDamage(const CRegion& damage, std::optional<CRegion> finalDamage = {});
uint32_t getPreferredReadFormat(PHLMONITOR pMonitor);
- std::vector<SDRMFormat> getDRMFormats();
- EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
+ std::vector<SDRMFormat> getDRMFormats();
+ EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
- bool initShaders();
+ bool initShaders();
- GLuint createProgram(const std::string&, const std::string&, bool dynamic = false, bool silent = false);
- GLuint compileShader(const GLuint&, std::string, bool dynamic = false, bool silent = false);
- void useProgram(GLuint prog);
+ GLuint createProgram(const std::string&, const std::string&, bool dynamic = false, bool silent = false);
+ GLuint compileShader(const GLuint&, std::string, bool dynamic = false, bool silent = false);
+ void useProgram(GLuint prog);
- void ensureLockTexturesRendered(bool load);
+ void ensureLockTexturesRendered(bool load);
- bool explicitSyncSupported();
+ bool explicitSyncSupported();
- bool m_shadersInitialized = false;
- SP<SPreparedShaders> m_shaders;
+ bool m_shadersInitialized = false;
+ SP<SPreparedShaders> m_shaders;
- SCurrentRenderData m_renderData;
+ SCurrentRenderData m_renderData;
- Hyprutils::OS::CFileDescriptor m_gbmFD;
- gbm_device* m_gbmDevice = nullptr;
- EGLContext m_eglContext = nullptr;
- EGLDisplay m_eglDisplay = nullptr;
- EGLDeviceEXT m_eglDevice = nullptr;
- uint m_failedAssetsNo = 0;
+ Hyprutils::OS::CFileDescriptor m_gbmFD;
+ gbm_device* m_gbmDevice = nullptr;
+ EGLContext m_eglContext = nullptr;
+ EGLDisplay m_eglDisplay = nullptr;
+ EGLDeviceEXT m_eglDevice = nullptr;
+ uint m_failedAssetsNo = 0;
- bool m_reloadScreenShader = true; // at launch it can be set
+ bool m_reloadScreenShader = true; // at launch it can be set
- std::map<PHLWINDOWREF, CFramebuffer> m_windowFramebuffers;
- std::map<PHLLSREF, CFramebuffer> m_layerFramebuffers;
- std::map<WP<CPopup>, CFramebuffer> m_popupFramebuffers;
- std::map<PHLMONITORREF, SMonitorRenderData> m_monitorRenderResources;
- std::map<PHLMONITORREF, CFramebuffer> m_monitorBGFBs;
+ std::map<PHLWINDOWREF, CFramebuffer> m_windowFramebuffers;
+ std::map<PHLLSREF, CFramebuffer> m_layerFramebuffers;
+ std::map<WP<Desktop::View::CPopup>, CFramebuffer> m_popupFramebuffers;
+ std::map<PHLMONITORREF, SMonitorRenderData> m_monitorRenderResources;
+ std::map<PHLMONITORREF, CFramebuffer> m_monitorBGFBs;
struct {
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 2c813000..38cd951d 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -12,8 +12,9 @@
#include "../managers/HookSystemManager.hpp"
#include "../managers/animation/AnimationManager.hpp"
#include "../managers/LayoutManager.hpp"
-#include "../desktop/Window.hpp"
-#include "../desktop/LayerSurface.hpp"
+#include "../desktop/view/Window.hpp"
+#include "../desktop/view/LayerSurface.hpp"
+#include "../desktop/view/GlobalViewMethods.hpp"
#include "../desktop/state/FocusState.hpp"
#include "../protocols/SessionLock.hpp"
#include "../protocols/LayerShell.hpp"
@@ -164,11 +165,11 @@ CHyprRenderer::CHyprRenderer() {
continue;
}
- if (!w->m_wlSurface || !w->m_wlSurface->resource() || shouldRenderWindow(w.lock()))
+ if (!w->wlSurface() || !w->wlSurface()->resource() || shouldRenderWindow(w.lock()))
continue;
- w->m_wlSurface->resource()->frame(Time::steadyNow());
- auto FEEDBACK = makeUnique<CQueuedPresentationData>(w->m_wlSurface->resource());
+ w->wlSurface()->resource()->frame(Time::steadyNow());
+ auto FEEDBACK = makeUnique<CQueuedPresentationData>(w->wlSurface()->resource());
FEEDBACK->attachMonitor(Desktop::focusState()->monitor());
FEEDBACK->discarded();
PROTO::presentation->queueData(std::move(FEEDBACK));
@@ -516,7 +517,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
// whether to use m_fMovingToWorkspaceAlpha, only if fading out into an invisible ws
const bool USE_WORKSPACE_FADE_ALPHA = pWindow->m_monitorMovedFrom != -1 && (!PWORKSPACE || !PWORKSPACE->isVisible());
- renderdata.surface = pWindow->m_wlSurface->resource();
+ renderdata.surface = pWindow->wlSurface()->resource();
renderdata.dontRound = pWindow->isEffectiveInternalFSMode(FSMODE_FULLSCREEN);
renderdata.fadeAlpha = pWindow->m_alpha->value() * (pWindow->m_pinned || USE_WORKSPACE_FADE_ALPHA ? 1.f : PWORKSPACE->m_alpha->value()) *
(USE_WORKSPACE_FADE_ALPHA ? pWindow->m_movingToWorkspaceAlpha->value() : 1.F) * pWindow->m_movingFromWorkspaceAlpha->value();
@@ -596,7 +597,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
if ((pWindow->m_isX11 && *PXWLUSENN) || pWindow->m_ruleApplicator->nearestNeighbor().valueOrDefault())
renderdata.useNearestNeighbor = true;
- if (pWindow->m_wlSurface->small() && !pWindow->m_wlSurface->m_fillIgnoreSmall && renderdata.blur) {
+ if (pWindow->wlSurface()->small() && !pWindow->wlSurface()->m_fillIgnoreSmall && renderdata.blur) {
CBox wb = {renderdata.pos.x - pMonitor->m_position.x, renderdata.pos.y - pMonitor->m_position.y, renderdata.w, renderdata.h};
wb.scale(pMonitor->m_scale).round();
CRectPassElement::SRectData data;
@@ -611,7 +612,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
}
renderdata.surfaceCounter = 0;
- pWindow->m_wlSurface->resource()->breadthfirst(
+ pWindow->wlSurface()->resource()->breadthfirst(
[this, &renderdata, &pWindow](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
@@ -622,7 +623,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
renderdata.localPos = offset;
renderdata.texture = s->m_current.texture;
renderdata.surface = s;
- renderdata.mainSurface = s == pWindow->m_wlSurface->resource();
+ renderdata.mainSurface = s == pWindow->wlSurface()->resource();
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
renderdata.surfaceCounter++;
},
@@ -677,20 +678,20 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
renderdata.surfaceCounter = 0;
pWindow->m_popupHead->breadthfirst(
- [this, &renderdata](WP<CPopup> popup, void* data) {
+ [this, &renderdata](WP<Desktop::View::CPopup> popup, void* data) {
if (popup->m_fadingOut) {
renderSnapshot(popup);
return;
}
- if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
+ if (!popup->visible())
return;
const auto pos = popup->coordsRelativeToParent();
const Vector2D oldPos = renderdata.pos;
renderdata.pos += pos;
renderdata.fadeAlpha = popup->m_alpha->value();
- popup->m_wlSurface->resource()->breadthfirst(
+ popup->wlSurface()->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
@@ -761,7 +762,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
CSurfacePassElement::SRenderData renderdata = {pMonitor, time, REALPOS};
renderdata.fadeAlpha = pLayer->m_alpha->value();
renderdata.blur = shouldBlur(pLayer);
- renderdata.surface = pLayer->m_surface->resource();
+ renderdata.surface = pLayer->wlSurface()->resource();
renderdata.decorate = false;
renderdata.w = REALSIZ.x;
renderdata.h = REALSIZ.y;
@@ -776,7 +777,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
}
if (!popups)
- pLayer->m_surface->resource()->breadthfirst(
+ pLayer->wlSurface()->resource()->breadthfirst(
[this, &renderdata, &pLayer](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
@@ -787,7 +788,7 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
renderdata.localPos = offset;
renderdata.texture = s->m_current.texture;
renderdata.surface = s;
- renderdata.mainSurface = s == pLayer->m_surface->resource();
+ renderdata.mainSurface = s == pLayer->wlSurface()->resource();
m_renderPass.add(makeUnique<CSurfacePassElement>(renderdata));
renderdata.surfaceCounter++;
},
@@ -800,11 +801,11 @@ void CHyprRenderer::renderLayer(PHLLS pLayer, PHLMONITOR pMonitor, const Time::s
renderdata.surfaceCounter = 0;
if (popups) {
pLayer->m_popupHead->breadthfirst(
- [this, &renderdata](WP<CPopup> popup, void* data) {
- if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
+ [this, &renderdata](WP<Desktop::View::CPopup> popup, void* data) {
+ if (!popup->visible())
return;
- const auto SURF = popup->m_wlSurface->resource();
+ const auto SURF = popup->wlSurface()->resource();
if (!SURF->m_current.texture)
return;
@@ -1138,7 +1139,7 @@ void CHyprRenderer::renderSessionLockMissing(PHLMONITOR pMonitor) {
static std::optional<Vector2D> getSurfaceExpectedSize(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface, PHLMONITOR pMonitor, bool main) {
const auto CAN_USE_WINDOW = pWindow && main;
- const auto WINDOW_SIZE_MISALIGN = CAN_USE_WINDOW && pWindow->getReportedSize() != pWindow->m_wlSurface->resource()->m_current.size;
+ const auto WINDOW_SIZE_MISALIGN = CAN_USE_WINDOW && pWindow->getReportedSize() != pWindow->wlSurface()->resource()->m_current.size;
if (pSurface->m_current.viewport.hasDestination)
return (pSurface->m_current.viewport.destination * pMonitor->m_scale).round();
@@ -1577,7 +1578,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
bool hdrIsHandled = false;
if (FS_WINDOW) {
- const auto ROOT_SURF = FS_WINDOW->m_wlSurface->resource();
+ const auto ROOT_SURF = FS_WINDOW->wlSurface()->resource();
const auto SURF = ROOT_SURF->findWithCM();
// we have a surface with image description
@@ -1706,23 +1707,11 @@ void CHyprRenderer::renderWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace
}
void CHyprRenderer::sendFrameEventsToWorkspace(PHLMONITOR pMonitor, PHLWORKSPACE pWorkspace, const Time::steady_tp& now) {
- for (auto const& w : g_pCompositor->m_windows) {
- if (w->isHidden() || !w->m_isMapped || w->m_fadingOut || !w->m_wlSurface->resource())
- continue;
-
- if (!shouldRenderWindow(w, pMonitor))
+ for (const auto& view : Desktop::View::getViewsForWorkspace(pWorkspace)) {
+ if (!view->visible())
continue;
- w->m_wlSurface->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
- }
-
- for (auto const& lsl : pMonitor->m_layerSurfaceLayers) {
- for (auto const& ls : lsl) {
- if (ls->m_fadingOut || !ls->m_surface->resource())
- continue;
-
- ls->m_surface->resource()->breadthfirst([now](SP<CWLSurfaceResource> r, const Vector2D& offset, void* d) { r->frame(now); }, nullptr);
- }
+ view->wlSurface()->resource()->frame(now);
}
}
@@ -1918,7 +1907,7 @@ void CHyprRenderer::damageSurface(SP<CWLSurfaceResource> pSurface, double x, dou
if (g_pCompositor->m_unsafeState)
return;
- const auto WLSURF = CWLSurface::fromResource(pSurface);
+ const auto WLSURF = Desktop::View::CWLSurface::fromResource(pSurface);
CRegion damageBox = WLSURF ? WLSURF->computeDamage() : CRegion{};
if (!WLSURF) {
Debug::log(ERR, "BUG THIS: No CWLSurface for surface in damageSurface!!!");
@@ -2052,7 +2041,7 @@ void CHyprRenderer::renderDragIcon(PHLMONITOR pMonitor, const Time::steady_tp& t
PROTO::data->renderDND(pMonitor, time);
}
-void CHyprRenderer::setCursorSurface(SP<CWLSurface> surf, int hotspotX, int hotspotY, bool force) {
+void CHyprRenderer::setCursorSurface(SP<Desktop::View::CWLSurface> surf, int hotspotX, int hotspotY, bool force) {
m_cursorHasSurface = surf;
m_lastCursorData.name = "";
@@ -2509,14 +2498,14 @@ void CHyprRenderer::makeSnapshot(PHLLS pLayer) {
m_bRenderingSnapshot = false;
}
-void CHyprRenderer::makeSnapshot(WP<CPopup> popup) {
+void CHyprRenderer::makeSnapshot(WP<Desktop::View::CPopup> popup) {
// we trust the window is valid.
const auto PMONITOR = popup->getMonitor();
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
return;
- if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
+ if (!popup->visible())
return;
Debug::log(LOG, "renderer: making a snapshot of {:x}", rc<uintptr_t>(popup.get()));
@@ -2544,7 +2533,7 @@ void CHyprRenderer::makeSnapshot(WP<CPopup> popup) {
renderdata.popup = true;
renderdata.blur = false;
- popup->m_wlSurface->resource()->breadthfirst(
+ popup->wlSurface()->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
if (!s->m_current.texture)
return;
@@ -2668,7 +2657,7 @@ void CHyprRenderer::renderSnapshot(PHLLS pLayer) {
m_renderPass.add(makeUnique<CTexPassElement>(std::move(data)));
}
-void CHyprRenderer::renderSnapshot(WP<CPopup> popup) {
+void CHyprRenderer::renderSnapshot(WP<Desktop::View::CPopup> popup) {
if (!g_pHyprOpenGL->m_popupFramebuffers.contains(popup))
return;
@@ -2720,7 +2709,7 @@ bool CHyprRenderer::shouldBlur(PHLWINDOW w) {
return *PBLUR && !DONT_BLUR;
}
-bool CHyprRenderer::shouldBlur(WP<CPopup> p) {
+bool CHyprRenderer::shouldBlur(WP<Desktop::View::CPopup> p) {
static CConfigValue PBLURPOPUPS = CConfigValue<Hyprlang::INT>("decoration:blur:popups");
static CConfigValue PBLUR = CConfigValue<Hyprlang::INT>("decoration:blur:enabled");
diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp
index 1980984d..6e0c69fa 100644
--- a/src/render/Renderer.hpp
+++ b/src/render/Renderer.hpp
@@ -3,7 +3,7 @@
#include "../defines.hpp"
#include <list>
#include "../helpers/Monitor.hpp"
-#include "../desktop/LayerSurface.hpp"
+#include "../desktop/view/LayerSurface.hpp"
#include "OpenGL.hpp"
#include "Renderbuffer.hpp"
#include "../helpers/time/Timer.hpp"
@@ -13,7 +13,6 @@
struct SMonitorRule;
class CWorkspace;
-class CWindow;
class CInputPopup;
class IHLBuffer;
class CEventLoopTimer;
@@ -70,7 +69,7 @@ class CHyprRenderer {
bool fixMisalignedFSV1 = false);
std::tuple<float, float, float> getRenderTimes(PHLMONITOR pMonitor); // avg max min
void renderLockscreen(PHLMONITOR pMonitor, const Time::steady_tp& now, const CBox& geometry);
- void setCursorSurface(SP<CWLSurface> surf, int hotspotX, int hotspotY, bool force = false);
+ void setCursorSurface(SP<Desktop::View::CWLSurface> surf, int hotspotX, int hotspotY, bool force = false);
void setCursorFromName(const std::string& name, bool force = false);
void onRenderbufferDestroy(CRenderbuffer* rb);
SP<CRenderbuffer> getCurrentRBO();
@@ -83,10 +82,10 @@ class CHyprRenderer {
void addWindowToRenderUnfocused(PHLWINDOW window);
void makeSnapshot(PHLWINDOW);
void makeSnapshot(PHLLS);
- void makeSnapshot(WP<CPopup>);
+ void makeSnapshot(WP<Desktop::View::CPopup>);
void renderSnapshot(PHLWINDOW);
void renderSnapshot(PHLLS);
- void renderSnapshot(WP<CPopup>);
+ void renderSnapshot(WP<Desktop::View::CPopup>);
// if RENDER_MODE_NORMAL, provided damage will be written to.
// otherwise, it will be the one used.
@@ -109,13 +108,13 @@ class CHyprRenderer {
std::vector<CHLBufferReference> m_usedAsyncBuffers;
struct {
- int hotspotX = 0;
- int hotspotY = 0;
- wpCursorShapeDeviceV1Shape shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
- wpCursorShapeDeviceV1Shape shapePrevious = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
- CTimer switchedTimer;
- std::optional<SP<CWLSurface>> surf;
- std::string name;
+ int hotspotX = 0;
+ int hotspotY = 0;
+ wpCursorShapeDeviceV1Shape shape = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
+ wpCursorShapeDeviceV1Shape shapePrevious = WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_DEFAULT;
+ CTimer switchedTimer;
+ std::optional<SP<Desktop::View::CWLSurface>> surf;
+ std::string name;
} m_lastCursorData;
CRenderPass m_renderPass = {};
@@ -140,7 +139,7 @@ class CHyprRenderer {
bool shouldBlur(PHLLS ls);
bool shouldBlur(PHLWINDOW w);
- bool shouldBlur(WP<CPopup> p);
+ bool shouldBlur(WP<Desktop::View::CPopup> p);
bool m_cursorHidden = false;
bool m_cursorHiddenByCondition = false;
diff --git a/src/render/decorations/DecorationPositioner.cpp b/src/render/decorations/DecorationPositioner.cpp
index 1082812f..561d366d 100644
--- a/src/render/decorations/DecorationPositioner.cpp
+++ b/src/render/decorations/DecorationPositioner.cpp
@@ -1,5 +1,5 @@
#include "DecorationPositioner.hpp"
-#include "../../desktop/Window.hpp"
+#include "../../desktop/view/Window.hpp"
#include "../../managers/HookSystemManager.hpp"
#include "../../managers/LayoutManager.hpp"
diff --git a/src/render/decorations/DecorationPositioner.hpp b/src/render/decorations/DecorationPositioner.hpp
index 8048c7ad..8fbb44c7 100644
--- a/src/render/decorations/DecorationPositioner.hpp
+++ b/src/render/decorations/DecorationPositioner.hpp
@@ -6,7 +6,6 @@
#include "../../helpers/math/Math.hpp"
#include "../../desktop/DesktopTypes.hpp"
-class CWindow;
class IHyprWindowDecoration;
enum eDecorationPositioningPolicy : uint8_t {
diff --git a/src/render/decorations/IHyprWindowDecoration.cpp b/src/render/decorations/IHyprWindowDecoration.cpp
index 0dd11867..26782098 100644
--- a/src/render/decorations/IHyprWindowDecoration.cpp
+++ b/src/render/decorations/IHyprWindowDecoration.cpp
@@ -1,7 +1,5 @@
#include "IHyprWindowDecoration.hpp"
-class CWindow;
-
IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) : m_window(pWindow) {
;
}
diff --git a/src/render/decorations/IHyprWindowDecoration.hpp b/src/render/decorations/IHyprWindowDecoration.hpp
index 26bfcb45..9916d392 100644
--- a/src/render/decorations/IHyprWindowDecoration.hpp
+++ b/src/render/decorations/IHyprWindowDecoration.hpp
@@ -26,7 +26,6 @@ enum eDecorationFlags : uint8_t {
DECORATION_NON_SOLID = 1 << 2, /* this decoration is not solid. Other decorations should draw on top of it. Example: shadow */
};
-class CWindow;
class CMonitor;
class CDecorationPositioner;
diff --git a/src/render/pass/Pass.cpp b/src/render/pass/Pass.cpp
index 8970e2af..3910e6a7 100644
--- a/src/render/pass/Pass.cpp
+++ b/src/render/pass/Pass.cpp
@@ -4,7 +4,7 @@
#include <ranges>
#include "../../Compositor.hpp"
#include "../../config/ConfigValue.hpp"
-#include "../../desktop/WLSurface.hpp"
+#include "../../desktop/view/WLSurface.hpp"
#include "../../managers/SeatManager.hpp"
#include "../../managers/eventLoop/EventLoopManager.hpp"
#include "../../render/Renderer.hpp"
@@ -211,7 +211,7 @@ void CRenderPass::renderDebugData() {
if (!surface || !texture)
return;
- auto hlSurface = CWLSurface::fromResource(surface);
+ auto hlSurface = Desktop::View::CWLSurface::fromResource(surface);
if (!hlSurface)
return;
@@ -244,12 +244,12 @@ void CRenderPass::renderDebugData() {
renderHLSurface(m_debugData.keyboardFocusText, g_pSeatManager->m_state.keyboardFocus.lock(), Colors::PURPLE.modifyA(0.1F));
renderHLSurface(m_debugData.pointerFocusText, g_pSeatManager->m_state.pointerFocus.lock(), Colors::ORANGE.modifyA(0.1F));
if (Desktop::focusState()->window())
- renderHLSurface(m_debugData.lastWindowText, Desktop::focusState()->window()->m_wlSurface->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
+ renderHLSurface(m_debugData.lastWindowText, Desktop::focusState()->window()->wlSurface()->resource(), Colors::LIGHT_BLUE.modifyA(0.1F));
if (g_pSeatManager->m_state.pointerFocus) {
if (g_pSeatManager->m_state.pointerFocus->m_current.input.intersect(CBox{{}, g_pSeatManager->m_state.pointerFocus->m_current.size}).getExtents().size() !=
g_pSeatManager->m_state.pointerFocus->m_current.size) {
- auto hlSurface = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
+ auto hlSurface = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
if (hlSurface) {
auto BOX = hlSurface->getSurfaceBoxGlobal();
if (BOX) {
diff --git a/src/render/pass/SurfacePassElement.cpp b/src/render/pass/SurfacePassElement.cpp
index 36b9e5f9..b5c42310 100644
--- a/src/render/pass/SurfacePassElement.cpp
+++ b/src/render/pass/SurfacePassElement.cpp
@@ -1,7 +1,7 @@
#include "SurfacePassElement.hpp"
#include "../OpenGL.hpp"
-#include "../../desktop/WLSurface.hpp"
-#include "../../desktop/Window.hpp"
+#include "../../desktop/view/WLSurface.hpp"
+#include "../../desktop/view/Window.hpp"
#include "../../protocols/core/Compositor.hpp"
#include "../../protocols/DRMSyncobj.hpp"
#include "../../managers/input/InputManager.hpp"
@@ -54,7 +54,7 @@ void CSurfacePassElement::draw(const CRegion& damage) {
const auto INTERACTIVERESIZEINPROGRESS = m_data.pWindow && g_pInputManager->m_currentlyDraggedWindow && g_pInputManager->m_dragMode == MBIND_RESIZE;
TRACY_GPU_ZONE("RenderSurface");
- auto PSURFACE = CWLSurface::fromResource(m_data.surface);
+ auto PSURFACE = Desktop::View::CWLSurface::fromResource(m_data.surface);
const float ALPHA = m_data.alpha * m_data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier : 1.F);
const float OVERALL_ALPHA = PSURFACE ? PSURFACE->m_overallOpacity : 1.F;
@@ -102,7 +102,7 @@ void CSurfacePassElement::draw(const CRegion& damage) {
roundingPower = 2.0f;
}
- const bool WINDOWOPAQUE = m_data.pWindow && m_data.pWindow->m_wlSurface->resource() == m_data.surface ? m_data.pWindow->opaque() : false;
+ const bool WINDOWOPAQUE = m_data.pWindow && m_data.pWindow->wlSurface()->resource() == m_data.surface ? m_data.pWindow->opaque() : false;
const bool CANDISABLEBLEND = ALPHA >= 1.f && OVERALL_ALPHA >= 1.f && rounding == 0 && WINDOWOPAQUE;
if (CANDISABLEBLEND)
@@ -164,14 +164,14 @@ CBox CSurfacePassElement::getTexBox() {
const double outputX = -m_data.pMonitor->m_position.x, outputY = -m_data.pMonitor->m_position.y;
const auto INTERACTIVERESIZEINPROGRESS = m_data.pWindow && g_pInputManager->m_currentlyDraggedWindow && g_pInputManager->m_dragMode == MBIND_RESIZE;
- auto PSURFACE = CWLSurface::fromResource(m_data.surface);
+ auto PSURFACE = Desktop::View::CWLSurface::fromResource(m_data.surface);
CBox windowBox;
if (m_data.surface && m_data.mainSurface) {
windowBox = {sc<int>(outputX) + m_data.pos.x + m_data.localPos.x, sc<int>(outputY) + m_data.pos.y + m_data.localPos.y, m_data.w, m_data.h};
// however, if surface buffer w / h < box, we need to adjust them
- const auto PWINDOW = PSURFACE ? PSURFACE->getWindow() : nullptr;
+ const auto PWINDOW = PSURFACE ? Desktop::View::CWindow::fromView(PSURFACE->view()) : nullptr;
// center the surface if it's smaller than the viewport we assign it
if (PSURFACE && !PSURFACE->m_fillIgnoreSmall && PSURFACE->small() /* guarantees PWINDOW */) {
@@ -216,7 +216,7 @@ CBox CSurfacePassElement::getTexBox() {
}
bool CSurfacePassElement::needsLiveBlur() {
- auto PSURFACE = CWLSurface::fromResource(m_data.surface);
+ auto PSURFACE = Desktop::View::CWLSurface::fromResource(m_data.surface);
const float ALPHA = m_data.alpha * m_data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
const bool BLUR = m_data.blur && (!m_data.texture || !m_data.texture->m_opaque || ALPHA < 1.F);
@@ -233,7 +233,7 @@ bool CSurfacePassElement::needsLiveBlur() {
}
bool CSurfacePassElement::needsPrecomputeBlur() {
- auto PSURFACE = CWLSurface::fromResource(m_data.surface);
+ auto PSURFACE = Desktop::View::CWLSurface::fromResource(m_data.surface);
const float ALPHA = m_data.alpha * m_data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
const bool BLUR = m_data.blur && (!m_data.texture || !m_data.texture->m_opaque || ALPHA < 1.F);
@@ -254,7 +254,7 @@ std::optional<CBox> CSurfacePassElement::boundingBox() {
}
CRegion CSurfacePassElement::opaqueRegion() {
- auto PSURFACE = CWLSurface::fromResource(m_data.surface);
+ auto PSURFACE = Desktop::View::CWLSurface::fromResource(m_data.surface);
const float ALPHA = m_data.alpha * m_data.fadeAlpha * (PSURFACE ? PSURFACE->m_alphaModifier * PSURFACE->m_overallOpacity : 1.F);
@@ -272,7 +272,7 @@ CRegion CSurfacePassElement::opaqueRegion() {
}
CRegion CSurfacePassElement::visibleRegion(bool& cancel) {
- auto PSURFACE = CWLSurface::fromResource(m_data.surface);
+ auto PSURFACE = Desktop::View::CWLSurface::fromResource(m_data.surface);
if (!PSURFACE)
return {};