From bc937e3e711e53774e2c9fa26d13125427f6378b Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 17 Mar 2022 20:22:29 +0100 Subject: Renderer --- src/Compositor.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 7a535b5d..fbf98eb9 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -62,6 +62,8 @@ CCompositor::CCompositor() { wl_signal_add(&m_sWLRSeat->events.request_set_cursor, &Events::listen_requestMouse); wl_signal_add(&m_sWLRSeat->events.request_set_selection, &Events::listen_requestSetSel); + m_sWLRPresentation = wlr_presentation_create(m_sWLDisplay, m_sWLRBackend); + // TODO: XWayland } @@ -82,6 +84,9 @@ void CCompositor::startCompositor() { Debug::log(LOG, "Creating the InputManager!"); g_pInputManager = std::make_unique(); + + Debug::log(LOG, "Creating the HyprRenderer!"); + g_pHyprRenderer = std::make_unique(); // // @@ -111,4 +116,31 @@ void CCompositor::startCompositor() { // This blocks until we are done. Debug::log(LOG, "Hyprland is ready, running the event loop!"); wl_display_run(m_sWLDisplay); +} + +SMonitor* CCompositor::getMonitorFromID(const int& id) { + for (auto& m : m_vMonitors) { + if (m.ID == id) { + return &m; + } + } + + return nullptr; +} + +SMonitor* CCompositor::getMonitorFromCursor() { + const auto COORDS = g_pInputManager->getMouseCoordsInternal(); + const auto OUTPUT = wlr_output_layout_output_at(m_sWLROutputLayout, COORDS.x, COORDS.y); + + if (!OUTPUT) { + Debug::log(WARN, "getMonitorFromCursor: cursour outside monitors??"); + return &m_vMonitors[0]; + } + + for (auto& m : m_vMonitors) { + if (m.output == OUTPUT) + return &m; + } + + return &m_vMonitors[0]; } \ No newline at end of file -- cgit v1.2.3