From 61e10e20484e8867656d39cbaa6d75c3aab7eba6 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 19 Mar 2022 15:59:53 +0100 Subject: added a layoutmanager and basic dwindle --- src/managers/InputManager.cpp | 2 +- src/managers/LayoutManager.cpp | 11 +++++++++++ src/managers/LayoutManager.hpp | 20 ++++++++++++++++++++ src/managers/XWaylandManager.cpp | 4 ++-- 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/managers/LayoutManager.cpp create mode 100644 src/managers/LayoutManager.hpp (limited to 'src/managers') diff --git a/src/managers/InputManager.cpp b/src/managers/InputManager.cpp index 725ce672..492251fd 100644 --- a/src/managers/InputManager.cpp +++ b/src/managers/InputManager.cpp @@ -45,7 +45,7 @@ void CInputManager::mouseMoveUnified(uint32_t time) { g_pCompositor->focusWindow(PWINDOW); - Vector2D surfaceLocal = m_vWLRMouseCoords - PWINDOW->m_vPosition; + Vector2D surfaceLocal = m_vWLRMouseCoords - PWINDOW->m_vEffectivePosition; wlr_seat_pointer_notify_enter(g_pCompositor->m_sWLRSeat, g_pXWaylandManager->getWindowSurface(PWINDOW), surfaceLocal.x, surfaceLocal.y); wlr_seat_pointer_notify_motion(g_pCompositor->m_sWLRSeat, time, surfaceLocal.x, surfaceLocal.y); diff --git a/src/managers/LayoutManager.cpp b/src/managers/LayoutManager.cpp new file mode 100644 index 00000000..ec723350 --- /dev/null +++ b/src/managers/LayoutManager.cpp @@ -0,0 +1,11 @@ +#include "LayoutManager.hpp" + +IHyprLayout* CLayoutManager::getCurrentLayout() { + switch (m_iCurrentLayoutID) { + case DWINDLE: + return &m_cDwindleLayout; + } + + // fallback + return &m_cDwindleLayout; +} \ No newline at end of file diff --git a/src/managers/LayoutManager.hpp b/src/managers/LayoutManager.hpp new file mode 100644 index 00000000..20f1f7f9 --- /dev/null +++ b/src/managers/LayoutManager.hpp @@ -0,0 +1,20 @@ +#pragma once + +#include "../layout/DwindleLayout.hpp" + +class CLayoutManager { +public: + + IHyprLayout* getCurrentLayout(); + +private: + enum HYPRLAYOUTS { + DWINDLE = 0, + }; + + HYPRLAYOUTS m_iCurrentLayoutID = DWINDLE; + + CHyprDwindleLayout m_cDwindleLayout; +}; + +inline std::unique_ptr g_pLayoutManager; \ No newline at end of file diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index 1c28ec35..dfe6cb19 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -64,8 +64,8 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) { } void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size) { - if (pWindow->m_bIsX11) - wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vPosition.x, pWindow->m_vPosition.y, size.x, size.y); + if (pWindow->m_bIsX11) + wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vEffectivePosition.x, pWindow->m_vEffectivePosition.y, size.x, size.y); else wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y); -- cgit v1.2.3