From 332fa8a802dd89f16848765cab8a1483e09e73aa Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 20 Mar 2022 13:37:07 +0100 Subject: XWayland floating --- src/layout/DwindleLayout.cpp | 8 ++++++++ src/layout/DwindleLayout.hpp | 1 + src/layout/IHyprLayout.hpp | 1 + 3 files changed, 10 insertions(+) (limited to 'src/layout') diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 129c2142..9f97cece 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -303,4 +303,12 @@ void CHyprDwindleLayout::onMouseMove(const Vector2D& mousePos) { if (PMONITOR) DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID; +} + +void CHyprDwindleLayout::onWindowCreatedFloating(CWindow* pWindow) { + const auto PWINDOWSURFACE = g_pXWaylandManager->getWindowSurface(pWindow); + const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); + + pWindow->m_vRealSize = Vector2D(PWINDOWSURFACE->current.width, PWINDOWSURFACE->current.height); + pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.x) / 2.f, PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.y) / 2.f); } \ No newline at end of file diff --git a/src/layout/DwindleLayout.hpp b/src/layout/DwindleLayout.hpp index b9136727..5c2cbde8 100644 --- a/src/layout/DwindleLayout.hpp +++ b/src/layout/DwindleLayout.hpp @@ -35,6 +35,7 @@ public: virtual void changeWindowFloatingMode(CWindow*); virtual void onBeginDragWindow(); virtual void onMouseMove(const Vector2D&); + virtual void onWindowCreatedFloating(CWindow*); private: diff --git a/src/layout/IHyprLayout.hpp b/src/layout/IHyprLayout.hpp index bf0d135b..c3fbd667 100644 --- a/src/layout/IHyprLayout.hpp +++ b/src/layout/IHyprLayout.hpp @@ -14,5 +14,6 @@ public: virtual void changeWindowFloatingMode(CWindow*) = 0; virtual void onBeginDragWindow() = 0; virtual void onMouseMove(const Vector2D&) = 0; + virtual void onWindowCreatedFloating(CWindow*) = 0; }; \ No newline at end of file -- cgit v1.2.3