summaryrefslogtreecommitdiff
path: root/src/desktop
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-06-19 16:20:06 +0200
committerVaxry <vaxry@vaxry.net>2024-06-19 16:20:15 +0200
commitfb15b7aa2a9bba0f0693f84d0c65d386942583f8 (patch)
treed4403944b5d6a3e03d2262f03a7d0b3ed6ffae24 /src/desktop
parent6e5804b53de753f24953d9d647940df66bc68f6d (diff)
core: Move to hyprutils for Math
Moves CRegion, CBox and Vector2D over to hyprutils. Requires hyprutils>=0.1.4
Diffstat (limited to 'src/desktop')
-rw-r--r--src/desktop/LayerSurface.cpp4
-rw-r--r--src/desktop/WLSurface.cpp2
-rw-r--r--src/desktop/WLSurface.hpp2
-rw-r--r--src/desktop/Window.cpp10
-rw-r--r--src/desktop/Window.hpp142
-rw-r--r--src/desktop/Workspace.cpp16
6 files changed, 88 insertions, 88 deletions
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index 64eeead1..9a891531 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -412,9 +412,9 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
}
const std::array<Vector2D, 4> edgePoints = {
- PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, 0},
+ PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, 0.0},
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, PMONITOR->vecSize.y},
- PMONITOR->vecPosition + Vector2D{0, PMONITOR->vecSize.y},
+ PMONITOR->vecPosition + Vector2D{0.0, PMONITOR->vecSize.y},
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x, PMONITOR->vecSize.y / 2},
};
diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp
index c7a09b40..97335d27 100644
--- a/src/desktop/WLSurface.cpp
+++ b/src/desktop/WLSurface.cpp
@@ -86,7 +86,7 @@ CRegion CWLSurface::logicalDamage() const {
return {};
CRegion damage = m_pResource->accumulateCurrentBufferDamage();
- damage.transform(m_pResource->current.transform, m_pResource->current.buffer->size.x, m_pResource->current.buffer->size.y);
+ damage.transform(wlTransformToHyprutils(m_pResource->current.transform), m_pResource->current.buffer->size.x, m_pResource->current.buffer->size.y);
damage.scale(1.0 / m_pResource->current.scale);
const auto VPSIZE = getViewporterCorrectedSize();
diff --git a/src/desktop/WLSurface.hpp b/src/desktop/WLSurface.hpp
index 4ba381a9..447f4582 100644
--- a/src/desktop/WLSurface.hpp
+++ b/src/desktop/WLSurface.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "../defines.hpp"
-#include "../helpers/Region.hpp"
+#include "../helpers/math/Math.hpp"
#include "../helpers/signal/Signal.hpp"
class CSubsurface;
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index d153b344..e67a3357 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -104,7 +104,7 @@ CWindow::~CWindow() {
std::erase_if(g_pHyprOpenGL->m_mWindowFramebuffers, [&](const auto& other) { return !other.first.lock() || other.first.lock().get() == this; });
}
-SWindowDecorationExtents CWindow::getFullWindowExtents() {
+SBoxExtents CWindow::getFullWindowExtents() {
if (m_bFadingOut)
return m_eOriginalClosedExtents;
@@ -116,9 +116,9 @@ SWindowDecorationExtents CWindow::getFullWindowExtents() {
{PMONITOR->vecSize.x - (m_vRealPosition.value().x - PMONITOR->vecPosition.x), PMONITOR->vecSize.y - (m_vRealPosition.value().y - PMONITOR->vecPosition.y)}};
}
- SWindowDecorationExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}};
+ SBoxExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}};
- const auto EXTENTS = g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock());
+ const auto EXTENTS = g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock());
if (EXTENTS.topLeft.x > maxExtents.topLeft.x)
maxExtents.topLeft.x = EXTENTS.topLeft.x;
@@ -224,7 +224,7 @@ CBox CWindow::getWindowBoxUnified(uint64_t properties) {
return {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
}
- SWindowDecorationExtents EXTENTS = {{0, 0}, {0, 0}};
+ SBoxExtents EXTENTS = {{0, 0}, {0, 0}};
if (properties & RESERVED_EXTENTS)
EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationReserved(m_pSelf.lock()));
if (properties & INPUT_EXTENTS)
@@ -242,7 +242,7 @@ CBox CWindow::getWindowMainSurfaceBox() {
return {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
}
-SWindowDecorationExtents CWindow::getFullWindowReservedArea() {
+SBoxExtents CWindow::getFullWindowReservedArea() {
return g_pDecorationPositioner->getWindowDecorationReserved(m_pSelf.lock());
}
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
index 3f387d31..6bfdbc50 100644
--- a/src/desktop/Window.hpp
+++ b/src/desktop/Window.hpp
@@ -6,7 +6,7 @@
#include "../config/ConfigDataValues.hpp"
#include "../defines.hpp"
#include "../helpers/AnimatedVariable.hpp"
-#include "../helpers/Vector2D.hpp"
+#include "../helpers/math/Math.hpp"
#include "../helpers/signal/Signal.hpp"
#include "../helpers/TagKeeper.hpp"
#include "../macros.hpp"
@@ -310,7 +310,7 @@ class CWindow {
bool m_bReadyToDelete = false;
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
Vector2D m_vOriginalClosedSize; // drawing the closing animations
- SWindowDecorationExtents m_eOriginalClosedExtents;
+ SBoxExtents m_eOriginalClosedExtents;
bool m_bAnimatingIn = false;
// For pinned (sticky) windows
@@ -386,75 +386,75 @@ class CWindow {
}
// methods
- CBox getFullWindowBoundingBox();
- SWindowDecorationExtents getFullWindowExtents();
- CBox getWindowBoxUnified(uint64_t props);
- CBox getWindowMainSurfaceBox();
- CBox getWindowIdealBoundingBoxIgnoreReserved();
- void addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco);
- void updateWindowDecos();
- void removeWindowDeco(IHyprWindowDecoration* deco);
- void uncacheWindowDecos();
- bool checkInputOnDecos(const eInputType, const Vector2D&, std::any = {});
- pid_t getPID();
- IHyprWindowDecoration* getDecorationByType(eDecorationType);
- void removeDecorationByType(eDecorationType);
- void updateToplevel();
- void updateSurfaceScaleTransformDetails(bool force = false);
- void moveToWorkspace(PHLWORKSPACE);
- PHLWINDOW X11TransientFor();
- void onUnmap();
- void onMap();
- void setHidden(bool hidden);
- bool isHidden();
- void applyDynamicRule(const SWindowRule& r);
- void updateDynamicRules();
- SWindowDecorationExtents getFullWindowReservedArea();
- Vector2D middle();
- bool opaque();
- float rounding();
- bool canBeTorn();
- bool shouldSendFullscreenState();
- void setSuspended(bool suspend);
- bool visibleOnMonitor(CMonitor* pMonitor);
- int workspaceID();
- bool onSpecialWorkspace();
- void activate(bool force = false);
- int surfacesCount();
-
- int getRealBorderSize();
- void updateSpecialRenderData();
- void updateSpecialRenderData(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();
- PHLWINDOW getGroupHead();
- PHLWINDOW getGroupTail();
- PHLWINDOW getGroupCurrent();
- PHLWINDOW getGroupPrevious();
- PHLWINDOW getGroupWindowByIndex(int);
- int getGroupSize();
- bool canBeGroupedInto(PHLWINDOW pWindow);
- void setGroupCurrent(PHLWINDOW pWindow);
- void insertWindowToGroup(PHLWINDOW pWindow);
- void updateGroupOutputs();
- void switchWithWindowInGroup(PHLWINDOW pWindow);
- void setAnimationsToMove();
- void onWorkspaceAnimUpdate();
- void onUpdateState();
- void onUpdateMeta();
- void onX11Configure(CBox box);
- void onResourceChangeX11();
- std::string fetchTitle();
- std::string fetchClass();
- void warpCursor();
- PHLWINDOW getSwallower();
+ CBox getFullWindowBoundingBox();
+ SBoxExtents getFullWindowExtents();
+ CBox getWindowBoxUnified(uint64_t props);
+ CBox getWindowMainSurfaceBox();
+ CBox getWindowIdealBoundingBoxIgnoreReserved();
+ void addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco);
+ void updateWindowDecos();
+ void removeWindowDeco(IHyprWindowDecoration* deco);
+ void uncacheWindowDecos();
+ bool checkInputOnDecos(const eInputType, const Vector2D&, std::any = {});
+ pid_t getPID();
+ IHyprWindowDecoration* getDecorationByType(eDecorationType);
+ void removeDecorationByType(eDecorationType);
+ void updateToplevel();
+ void updateSurfaceScaleTransformDetails(bool force = false);
+ void moveToWorkspace(PHLWORKSPACE);
+ PHLWINDOW X11TransientFor();
+ void onUnmap();
+ void onMap();
+ void setHidden(bool hidden);
+ bool isHidden();
+ void applyDynamicRule(const SWindowRule& r);
+ void updateDynamicRules();
+ SBoxExtents getFullWindowReservedArea();
+ Vector2D middle();
+ bool opaque();
+ float rounding();
+ bool canBeTorn();
+ bool shouldSendFullscreenState();
+ void setSuspended(bool suspend);
+ bool visibleOnMonitor(CMonitor* pMonitor);
+ int workspaceID();
+ bool onSpecialWorkspace();
+ void activate(bool force = false);
+ int surfacesCount();
+
+ int getRealBorderSize();
+ void updateSpecialRenderData();
+ void updateSpecialRenderData(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();
+ PHLWINDOW getGroupHead();
+ PHLWINDOW getGroupTail();
+ PHLWINDOW getGroupCurrent();
+ PHLWINDOW getGroupPrevious();
+ PHLWINDOW getGroupWindowByIndex(int);
+ int getGroupSize();
+ bool canBeGroupedInto(PHLWINDOW pWindow);
+ void setGroupCurrent(PHLWINDOW pWindow);
+ void insertWindowToGroup(PHLWINDOW pWindow);
+ void updateGroupOutputs();
+ void switchWithWindowInGroup(PHLWINDOW pWindow);
+ void setAnimationsToMove();
+ void onWorkspaceAnimUpdate();
+ void onUpdateState();
+ void onUpdateMeta();
+ void onX11Configure(CBox box);
+ void onResourceChangeX11();
+ std::string fetchTitle();
+ std::string fetchClass();
+ void warpCursor();
+ PHLWINDOW getSwallower();
// listeners
void onAck(uint32_t serial);
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index ed09fbc0..04685bd5 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -104,24 +104,24 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
if (ANIMSTYLE.starts_with("slidefadevert")) {
if (in) {
m_fAlpha.setValueAndWarp(0.f);
- m_vRenderOffset.setValueAndWarp(Vector2D(0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
+ m_vRenderOffset.setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
m_fAlpha = 1.f;
m_vRenderOffset = Vector2D(0, 0);
} else {
m_fAlpha.setValueAndWarp(1.f);
m_fAlpha = 0.f;
- m_vRenderOffset = Vector2D(0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
+ m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
}
} else {
if (in) {
m_fAlpha.setValueAndWarp(0.f);
- m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0));
+ m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
m_fAlpha = 1.f;
m_vRenderOffset = Vector2D(0, 0);
} else {
m_fAlpha.setValueAndWarp(1.f);
m_fAlpha = 0.f;
- m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0);
+ m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
}
}
} else if (ANIMSTYLE == "fade") {
@@ -142,10 +142,10 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
if (in) {
- m_vRenderOffset.setValueAndWarp(Vector2D(0, left ? YDISTANCE : -YDISTANCE));
+ m_vRenderOffset.setValueAndWarp(Vector2D(0.0, left ? YDISTANCE : -YDISTANCE));
m_vRenderOffset = Vector2D(0, 0);
} else {
- m_vRenderOffset = Vector2D(0, left ? -YDISTANCE : YDISTANCE);
+ m_vRenderOffset = Vector2D(0.0, left ? -YDISTANCE : YDISTANCE);
}
} else {
// fallback is slide
@@ -155,10 +155,10 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
if (in) {
- m_vRenderOffset.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0));
+ m_vRenderOffset.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0.0));
m_vRenderOffset = Vector2D(0, 0);
} else {
- m_vRenderOffset = Vector2D(left ? -XDISTANCE : XDISTANCE, 0);
+ m_vRenderOffset = Vector2D(left ? -XDISTANCE : XDISTANCE, 0.0);
}
}