diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 2b7a78c7..74c3a1e8 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -298,7 +298,7 @@ void CCompositor::startCompositor() { wl_display_run(m_sWLDisplay); } -SMonitor* CCompositor::getMonitorFromID(const int& id) { +CMonitor* CCompositor::getMonitorFromID(const int& id) { for (auto& m : m_vMonitors) { if (m->ID == (uint64_t)id) { return m.get(); @@ -308,7 +308,7 @@ SMonitor* CCompositor::getMonitorFromID(const int& id) { return nullptr; } -SMonitor* CCompositor::getMonitorFromName(const std::string& name) { +CMonitor* CCompositor::getMonitorFromName(const std::string& name) { for (auto& m : m_vMonitors) { if (m->szName == name) { return m.get(); @@ -318,18 +318,18 @@ SMonitor* CCompositor::getMonitorFromName(const std::string& name) { return nullptr; } -SMonitor* CCompositor::getMonitorFromCursor() { +CMonitor* CCompositor::getMonitorFromCursor() { const auto COORDS = Vector2D(m_sWLRCursor->x, m_sWLRCursor->y); return getMonitorFromVector(COORDS); } -SMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) { +CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) { const auto OUTPUT = wlr_output_layout_output_at(m_sWLROutputLayout, point.x, point.y); if (!OUTPUT) { float bestDistance = 0.f; - SMonitor* pBestMon = nullptr; + CMonitor* pBestMon = nullptr; for (auto& m : m_vMonitors) { float dist = vecToRectDistanceSquared(point, m->vecPosition, m->vecPosition + m->vecSize); @@ -582,7 +582,7 @@ wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pW return PSURFACE->surface; } -SMonitor* CCompositor::getMonitorFromOutput(wlr_output* out) { +CMonitor* CCompositor::getMonitorFromOutput(wlr_output* out) { for (auto& m : m_vMonitors) { if (m->output == out) { return m.get(); @@ -1145,12 +1145,12 @@ CWindow* CCompositor::getConstraintWindow(SMouse* pMouse) { return nullptr; } -SMonitor* CCompositor::getMonitorInDirection(const char& dir) { +CMonitor* CCompositor::getMonitorInDirection(const char& dir) { const auto POSA = m_pLastMonitor->vecPosition; const auto SIZEA = m_pLastMonitor->vecSize; auto longestIntersect = -1; - SMonitor* longestIntersectMonitor = nullptr; + CMonitor* longestIntersectMonitor = nullptr; for (auto& m : m_vMonitors) { if (m.get() == m_pLastMonitor) @@ -1281,7 +1281,7 @@ int CCompositor::getNextAvailableMonitorID() { return topID + 1; } -void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, SMonitor* pMonitor) { +void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMonitor) { // We trust the workspace and monitor to be correct. @@ -1416,7 +1416,7 @@ void CCompositor::updateWorkspaceWindowDecos(const int& id) { } } -void CCompositor::scheduleFrameForMonitor(SMonitor* pMonitor) { +void CCompositor::scheduleFrameForMonitor(CMonitor* pMonitor) { if ((m_sWLRSession && !m_sWLRSession->active) || !m_bSessionActive) return; diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 05bf4b7e..00b758e3 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -72,7 +72,8 @@ public: std::string m_szInstanceSignature = ""; std::string m_szCurrentSplash = "error"; - std::vector> m_vMonitors; + std::vector> m_vMonitors; + std::vector> m_vRealMonitors; // for all monitors, even those turned off std::vector> m_vWindows; std::deque> m_dUnmanagedX11Windows; std::vector> m_vXDGPopups; @@ -86,7 +87,7 @@ public: wlr_surface* m_pLastFocus = nullptr; CWindow* m_pLastWindow = nullptr; - SMonitor* m_pLastMonitor = nullptr; + CMonitor* m_pLastMonitor = nullptr; SSeat m_sSeat; @@ -95,10 +96,10 @@ public: // ------------------------------------------------- // - SMonitor* getMonitorFromID(const int&); - SMonitor* getMonitorFromName(const std::string&); - SMonitor* getMonitorFromCursor(); - SMonitor* getMonitorFromVector(const Vector2D&); + CMonitor* getMonitorFromID(const int&); + CMonitor* getMonitorFromName(const std::string&); + CMonitor* getMonitorFromCursor(); + CMonitor* getMonitorFromVector(const Vector2D&); void removeWindowFromVectorSafe(CWindow*); void focusWindow(CWindow*, wlr_surface* pSurface = nullptr); void focusSurface(wlr_surface*, CWindow* pWindowOwner = nullptr); @@ -111,7 +112,7 @@ public: wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl); CWindow* windowFromCursor(); CWindow* windowFloatingFromCursor(); - SMonitor* getMonitorFromOutput(wlr_output*); + CMonitor* getMonitorFromOutput(wlr_output*); CWindow* getWindowForPopup(wlr_xdg_popup*); CWindow* getWindowFromSurface(wlr_surface*); bool isWorkspaceVisible(const int&); @@ -135,17 +136,17 @@ public: int getNextAvailableNamedWorkspace(); bool isPointOnAnyMonitor(const Vector2D&); CWindow* getConstraintWindow(SMouse*); - SMonitor* getMonitorInDirection(const char&); + CMonitor* getMonitorInDirection(const char&); void updateAllWindowsAnimatedDecorationValues(); void updateWindowAnimatedDecorationValues(CWindow*); void moveWindowToWorkspace(CWindow*, const std::string&); int getNextAvailableMonitorID(); - void moveWorkspaceToMonitor(CWorkspace*, SMonitor*); + void moveWorkspaceToMonitor(CWorkspace*, CMonitor*); bool workspaceIDOutOfBounds(const int&); void setWindowFullscreen(CWindow*, bool, eFullscreenMode); void moveUnmanagedX11ToWindows(CWindow*); CWindow* getX11Parent(CWindow*); - void scheduleFrameForMonitor(SMonitor*); + void scheduleFrameForMonitor(CMonitor*); void addToFadingOutSafe(SLayerSurface*); void addToFadingOutSafe(CWindow*); CWindow* getWindowByRegex(const std::string&); diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 1b639791..ed4511c6 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -958,6 +958,9 @@ void CConfigManager::loadConfigLoadVars() { // and they'll be taken care of in the newMonitor event if (!isFirstLaunch) { m_bWantsMonitorReload = true; + + // check + ensureDPMS(); } // Update window border colors @@ -1212,3 +1215,14 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) { return false; } + +void CConfigManager::ensureDPMS() { + for (auto& rm : g_pCompositor->m_vRealMonitors) { + auto rule = getMonitorRuleFor(rm->szName); + + if (rule.disabled == rm->m_bEnabled) { + rm->m_pThisWrap = &rm; + g_pHyprRenderer->applyMonitorRule(rm.get(), &rule); + } + } +} diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 7f51f7e7..f26e8ea5 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -111,6 +111,7 @@ private: // internal methods void setDefaultVars(); void setDeviceDefaultVars(const std::string&); + void ensureDPMS(); void applyUserDefinedVars(std::string&, const size_t); void loadConfigLoadVars(); diff --git a/src/debug/HyprDebugOverlay.cpp b/src/debug/HyprDebugOverlay.cpp index b8d7c32b..4fc370b6 100644 --- a/src/debug/HyprDebugOverlay.cpp +++ b/src/debug/HyprDebugOverlay.cpp @@ -1,7 +1,7 @@ #include "HyprDebugOverlay.hpp" #include "../Compositor.hpp" -void CHyprMonitorDebugOverlay::renderData(SMonitor* pMonitor, float µs) { +void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float µs) { m_dLastRenderTimes.push_back(µs / 1000.f); if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate) @@ -11,7 +11,7 @@ void CHyprMonitorDebugOverlay::renderData(SMonitor* pMonitor, float µs) { m_pMonitor = pMonitor; } -void CHyprMonitorDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs) { +void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) { m_dLastRenderTimesNoOverlay.push_back(µs / 1000.f); if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate) @@ -21,7 +21,7 @@ void CHyprMonitorDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs m_pMonitor = pMonitor; } -void CHyprMonitorDebugOverlay::frameData(SMonitor* pMonitor) { +void CHyprMonitorDebugOverlay::frameData(CMonitor* pMonitor) { m_dLastFrametimes.push_back(std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f); if (m_dLastFrametimes.size() > (long unsigned int)pMonitor->refreshRate) @@ -126,15 +126,15 @@ int CHyprMonitorDebugOverlay::draw(int offset) { return yOffset - offset; } -void CHyprDebugOverlay::renderData(SMonitor* pMonitor, float µs) { +void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float µs) { m_mMonitorOverlays[pMonitor].renderData(pMonitor, µs); } -void CHyprDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs) { +void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) { m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, µs); } -void CHyprDebugOverlay::frameData(SMonitor* pMonitor) { +void CHyprDebugOverlay::frameData(CMonitor* pMonitor) { m_mMonitorOverlays[pMonitor].frameData(pMonitor); } diff --git a/src/debug/HyprDebugOverlay.hpp b/src/debug/HyprDebugOverlay.hpp index 8899ab15..2573a6e1 100644 --- a/src/debug/HyprDebugOverlay.hpp +++ b/src/debug/HyprDebugOverlay.hpp @@ -11,16 +11,16 @@ class CHyprMonitorDebugOverlay { public: int draw(int offset); - void renderData(SMonitor* pMonitor, float µs); - void renderDataNoOverlay(SMonitor* pMonitor, float µs); - void frameData(SMonitor* pMonitor); + void renderData(CMonitor* pMonitor, float µs); + void renderDataNoOverlay(CMonitor* pMonitor, float µs); + void frameData(CMonitor* pMonitor); private: std::deque m_dLastFrametimes; std::deque m_dLastRenderTimes; std::deque m_dLastRenderTimesNoOverlay; std::chrono::high_resolution_clock::time_point m_tpLastFrame; - SMonitor* m_pMonitor = nullptr; + CMonitor* m_pMonitor = nullptr; wlr_box m_wbLastDrawnBox; }; @@ -28,13 +28,13 @@ class CHyprDebugOverlay { public: void draw(); - void renderData(SMonitor*, float µs); - void renderDataNoOverlay(SMonitor*, float µs); - void frameData(SMonitor*); + void renderData(CMonitor*, float µs); + void renderDataNoOverlay(CMonitor*, float µs); + void frameData(CMonitor*); private: - std::unordered_map m_mMonitorOverlays; + std::unordered_map m_mMonitorOverlays; cairo_surface_t* m_pCairoSurface = nullptr; cairo_t* m_pCairo = nullptr; diff --git a/src/events/Layers.cpp b/src/events/Layers.cpp index afa702c4..83d7d8dd 100644 --- a/src/events/Layers.cpp +++ b/src/events/Layers.cpp @@ -31,7 +31,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) { WLRLAYERSURFACE->output = PMONITOR->output; } - const auto PMONITOR = (SMonitor*)g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output); + const auto PMONITOR = (CMonitor*)g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output); SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique()).get(); layerSurface->szNamespace = WLRLAYERSURFACE->_namespace; diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 44bba5d6..5f3560e1 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -15,7 +15,7 @@ // // // --------------------------------------------------------- // -SMonitor* pMostHzMonitor = nullptr; +CMonitor* pMostHzMonitor = nullptr; void Events::listener_change(wl_listener* listener, void* data) { // layout got changed, let's update monitors. @@ -58,117 +58,34 @@ void Events::listener_newOutput(wl_listener* listener, void* data) { return; } - // get monitor rule that matches - SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(OUTPUT->name); - - // if it's disabled, disable and ignore - if (monitorRule.disabled) { - wlr_output_enable(OUTPUT, 0); - wlr_output_commit(OUTPUT); - - if (const auto PMONITOR = g_pCompositor->getMonitorFromName(std::string(OUTPUT->name)); PMONITOR) { - listener_monitorDestroy(nullptr, PMONITOR->output); - } - return; - } - - const auto PNEWMONITOR = g_pCompositor->m_vMonitors.emplace_back(std::make_unique()).get(); - - PNEWMONITOR->output = OUTPUT; - PNEWMONITOR->ID = g_pCompositor->getNextAvailableMonitorID(); - PNEWMONITOR->szName = OUTPUT->name; + // add it to real + const auto PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared()); + const auto PNEWMONITOR = PNEWMONITORWRAP->get(); wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer); - wlr_output_set_scale(OUTPUT, monitorRule.scale); - wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale); - wlr_output_set_transform(OUTPUT, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms + PNEWMONITOR->output = OUTPUT; + PNEWMONITOR->m_pThisWrap = PNEWMONITORWRAP; - wlr_output_enable_adaptive_sync(OUTPUT, 1); + PNEWMONITOR->onConnect(false); - // create it in the arr - PNEWMONITOR->vecPosition = monitorRule.offset; - PNEWMONITOR->vecSize = monitorRule.resolution; - PNEWMONITOR->refreshRate = monitorRule.refreshRate; - - PNEWMONITOR->hyprListener_monitorFrame.initCallback(&OUTPUT->events.frame, &Events::listener_monitorFrame, PNEWMONITOR); - PNEWMONITOR->hyprListener_monitorDestroy.initCallback(&OUTPUT->events.destroy, &Events::listener_monitorDestroy, PNEWMONITOR); - - wlr_output_enable(OUTPUT, 1); - - // TODO: this doesn't seem to set the X and Y correctly, - // wlr_output_layout_output_coords returns invalid values, I think... - wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, OUTPUT, monitorRule.offset.x, monitorRule.offset.y); - - // set mode, also applies - g_pHyprRenderer->applyMonitorRule(PNEWMONITOR, &monitorRule, true); - - Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", OUTPUT->name, (int)monitorRule.offset.x, (int)monitorRule.offset.y, (int)monitorRule.resolution.x, (int)monitorRule.resolution.y, OUTPUT); - - PNEWMONITOR->damage = wlr_output_damage_create(PNEWMONITOR->output); - - // add a WLR workspace group - PNEWMONITOR->pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr); - wlr_ext_workspace_group_handle_v1_output_enter(PNEWMONITOR->pWLRWorkspaceGroupHandle, PNEWMONITOR->output); - - // Workspace - std::string newDefaultWorkspaceName = ""; - auto WORKSPACEID = monitorRule.defaultWorkspace == "" ? g_pCompositor->m_vWorkspaces.size() + 1 : getWorkspaceIDFromString(monitorRule.defaultWorkspace, newDefaultWorkspaceName); - - if (WORKSPACEID == INT_MAX || WORKSPACEID == (long unsigned int)SPECIAL_WORKSPACE_ID) { - WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1; - newDefaultWorkspaceName = std::to_string(WORKSPACEID); - - Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", monitorRule.defaultWorkspace.c_str()); - } - - auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID); - - Debug::log(LOG, "New monitor: WORKSPACEID %d, exists: %d", WORKSPACEID, (int)(PNEWWORKSPACE != nullptr)); - - if (PNEWWORKSPACE) { - // workspace exists, move it to the newly connected monitor - g_pCompositor->moveWorkspaceToMonitor(PNEWWORKSPACE, PNEWMONITOR); - PNEWMONITOR->activeWorkspace = PNEWWORKSPACE->m_iID; - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PNEWMONITOR->ID); - PNEWWORKSPACE->startAnim(true,true,true); - } else { - PNEWWORKSPACE = g_pCompositor->m_vWorkspaces.emplace_back(std::make_unique(PNEWMONITOR->ID, newDefaultWorkspaceName)).get(); - - // We are required to set the name here immediately - wlr_ext_workspace_handle_v1_set_name(PNEWWORKSPACE->m_pWlrHandle, newDefaultWorkspaceName.c_str()); - - PNEWWORKSPACE->m_iID = WORKSPACEID; - } - - PNEWMONITOR->activeWorkspace = PNEWWORKSPACE->m_iID; - PNEWMONITOR->scale = monitorRule.scale; - - PNEWMONITOR->forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering. - - g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle); - PNEWWORKSPACE->setActive(true); - // - - if (!pMostHzMonitor || monitorRule.refreshRate > pMostHzMonitor->refreshRate) + if (!pMostHzMonitor || PNEWMONITOR->refreshRate > pMostHzMonitor->refreshRate) pMostHzMonitor = PNEWMONITOR; - if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet - g_pCompositor->m_pLastMonitor = PNEWMONITOR; - - g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", PNEWMONITOR->szName}); - // ready to process cuz we have a monitor g_pCompositor->m_bReadyToProcess = true; } void Events::listener_monitorFrame(void* owner, void* data) { - SMonitor* const PMONITOR = (SMonitor*)owner; + CMonitor* const PMONITOR = (CMonitor*)owner; if ((g_pCompositor->m_sWLRSession && !g_pCompositor->m_sWLRSession->active) || !g_pCompositor->m_bSessionActive) { Debug::log(WARN, "Attempted to render frame on inactive session!"); return; // cannot draw on session inactive (different tty) } + + if (!PMONITOR->m_bEnabled) + return; static std::chrono::high_resolution_clock::time_point startRender = std::chrono::high_resolution_clock::now(); static std::chrono::high_resolution_clock::time_point startRenderOverlay = std::chrono::high_resolution_clock::now(); @@ -352,7 +269,7 @@ void Events::listener_monitorFrame(void* owner, void* data) { void Events::listener_monitorDestroy(void* owner, void* data) { const auto OUTPUT = (wlr_output*)data; - SMonitor* pMonitor = nullptr; + CMonitor* pMonitor = nullptr; for (auto& m : g_pCompositor->m_vMonitors) { if (m->szName == OUTPUT->name) { @@ -364,46 +281,14 @@ void Events::listener_monitorDestroy(void* owner, void* data) { if (!pMonitor) return; - // Cleanup everything. Move windows back, snap cursor, shit. - const auto BACKUPMON = g_pCompositor->m_vMonitors.front().get(); + pMonitor->onDisconnect(); - if (!BACKUPMON) { - Debug::log(CRIT, "No monitors! Unplugged last! Exiting."); - g_pCompositor->cleanup(); - return; - } - - const auto BACKUPWORKSPACE = BACKUPMON->activeWorkspace > 0 ? std::to_string(BACKUPMON->activeWorkspace) : "name:" + g_pCompositor->getWorkspaceByID(BACKUPMON->activeWorkspace)->m_szName; - - // snap cursor - wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f); - - // move workspaces - std::deque wspToMove; - for (auto& w : g_pCompositor->m_vWorkspaces) { - if (w->m_iMonitorID == pMonitor->ID) { - wspToMove.push_back(w.get()); - } - } - - for (auto& w : wspToMove) { - g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON); - w->startAnim(true, true, true); - } - - pMonitor->activeWorkspace = -1; - - g_pCompositor->m_vWorkspaces.erase(std::remove_if(g_pCompositor->m_vWorkspaces.begin(), g_pCompositor->m_vWorkspaces.end(), [&](std::unique_ptr& el) { return el->m_iMonitorID == pMonitor->ID; })); - - Debug::log(LOG, "Removed monitor %s!", pMonitor->szName.c_str()); - - g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", pMonitor->szName}); - - g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::unique_ptr& el) { return el.get() == pMonitor; })); + // cleanup + g_pCompositor->m_vRealMonitors.erase(std::remove_if(g_pCompositor->m_vRealMonitors.begin(), g_pCompositor->m_vRealMonitors.end(), [&](std::shared_ptr& el) { return el.get() == pMonitor; })); if (pMostHzMonitor == pMonitor) { int mostHz = 0; - SMonitor* pMonitorMostHz = nullptr; + CMonitor* pMonitorMostHz = nullptr; for (auto& m : g_pCompositor->m_vMonitors) { if (m->refreshRate > mostHz) { diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp new file mode 100644 index 00000000..8dc239fc --- /dev/null +++ b/src/helpers/Monitor.cpp @@ -0,0 +1,162 @@ +#include "Monitor.hpp" + +#include "../Compositor.hpp" + +void CMonitor::onConnect(bool noRule) { + // get monitor rule that matches + SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name); + + hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this); + hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this); + + // if it's disabled, disable and ignore + if (monitorRule.disabled) { + wlr_output_enable(output, 0); + wlr_output_commit(output); + + hyprListener_monitorFrame.removeCallback(); + return; + } + + if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()){ + g_pCompositor->m_vMonitors.push_back(*m_pThisWrap); + } + + m_bEnabled = true; + + ID = g_pCompositor->getNextAvailableMonitorID(); + szName = output->name; + + wlr_output_set_scale(output, monitorRule.scale); + wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale); + wlr_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms + + wlr_output_enable_adaptive_sync(output, 1); + + // create it in the arr + vecPosition = monitorRule.offset; + vecSize = monitorRule.resolution; + refreshRate = monitorRule.refreshRate; + + wlr_output_enable(output, 1); + + // TODO: this doesn't seem to set the X and Y correctly, + // wlr_output_layout_output_coords returns invalid values, I think... + wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, output, monitorRule.offset.x, monitorRule.offset.y); + + // set mode, also applies + if (!noRule) + g_pHyprRenderer->applyMonitorRule(this, &monitorRule, true); + + Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", output->name, (int)monitorRule.offset.x, (int)monitorRule.offset.y, (int)monitorRule.resolution.x, (int)monitorRule.resolution.y, output); + + damage = wlr_output_damage_create(output); + + // add a WLR workspace group + if (!pWLRWorkspaceGroupHandle) { + pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr); + } + + wlr_ext_workspace_group_handle_v1_output_enter(pWLRWorkspaceGroupHandle, output); + + // Workspace + std::string newDefaultWorkspaceName = ""; + auto WORKSPACEID = monitorRule.defaultWorkspace == "" ? g_pCompositor->m_vWorkspaces.size() + 1 : getWorkspaceIDFromString(monitorRule.defaultWorkspace, newDefaultWorkspaceName); + + if (WORKSPACEID == INT_MAX || WORKSPACEID == (long unsigned int)SPECIAL_WORKSPACE_ID) { + WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1; + newDefaultWorkspaceName = std::to_string(WORKSPACEID); + + Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", monitorRule.defaultWorkspace.c_str()); + } + + auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID); + + Debug::log(LOG, "New monitor: WORKSPACEID %d, exists: %d", WORKSPACEID, (int)(PNEWWORKSPACE != nullptr)); + + if (PNEWWORKSPACE) { + // workspace exists, move it to the newly connected monitor + g_pCompositor->moveWorkspaceToMonitor(PNEWWORKSPACE, this); + activeWorkspace = PNEWWORKSPACE->m_iID; + g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID); + PNEWWORKSPACE->startAnim(true, true, true); + } else { + PNEWWORKSPACE = g_pCompositor->m_vWorkspaces.emplace_back(std::make_unique(ID, newDefaultWorkspaceName)).get(); + + // We are required to set the name here immediately + wlr_ext_workspace_handle_v1_set_name(PNEWWORKSPACE->m_pWlrHandle, newDefaultWorkspaceName.c_str()); + + PNEWWORKSPACE->m_iID = WORKSPACEID; + } + + activeWorkspace = PNEWWORKSPACE->m_iID; + scale = monitorRule.scale; + + forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering. + + g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle); + PNEWWORKSPACE->setActive(true); + // + + if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet + g_pCompositor->m_pLastMonitor = this; + + g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName}); +} + +void CMonitor::onDisconnect() { + // Cleanup everything. Move windows back, snap cursor, shit. + CMonitor* BACKUPMON = nullptr; + for (auto& m : g_pCompositor->m_vMonitors) { + if (m.get() != this) { + BACKUPMON = m.get(); + break; + } + } + + if (!BACKUPMON) { + Debug::log(CRIT, "No monitors! Unplugged last! Exiting."); + g_pCompositor->cleanup(); + return; + } + + m_bEnabled = false; + + hyprListener_monitorFrame.removeCallback(); + + const auto BACKUPWORKSPACE = BACKUPMON->activeWorkspace > 0 ? std::to_string(BACKUPMON->activeWorkspace) : "name:" + g_pCompositor->getWorkspaceByID(BACKUPMON->activeWorkspace)->m_szName; + + // snap cursor + wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f); + + // move workspaces + std::deque wspToMove; + for (auto& w : g_pCompositor->m_vWorkspaces) { + if (w->m_iMonitorID == ID) { + wspToMove.push_back(w.get()); + } + } + + for (auto& w : wspToMove) { + g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON); + w->startAnim(true, true, true); + } + + activeWorkspace = -1; + + wlr_output_damage_destroy(damage); + + wlr_output_layout_remove(g_pCompositor->m_sWLROutputLayout, output); + + wlr_output_enable(output, false); + + wlr_output_commit(output); + + g_pCompositor->m_vWorkspaces.erase(std::remove_if(g_pCompositor->m_vWorkspaces.begin(), g_pCompositor->m_vWorkspaces.end(), [&](std::unique_ptr& el) { return el->m_iMonitorID == ID; })); + + Debug::log(LOG, "Removed monitor %s!", szName.c_str()); + + g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName}); + + g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::shared_ptr& el) { return el.get() == this; })); +} diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 0112aab5..6f54aa14 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -7,7 +7,8 @@ #include #include -struct SMonitor { +class CMonitor { +public: Vector2D vecPosition = Vector2D(0,0); Vector2D vecSize = Vector2D(0,0); Vector2D vecPixelSize = Vector2D(0,0); @@ -51,9 +52,16 @@ struct SMonitor { wlr_ext_workspace_group_handle_v1* pWLRWorkspaceGroupHandle = nullptr; + // methods + void onConnect(bool noRule); + void onDisconnect(); + + std::shared_ptr* m_pThisWrap = nullptr; + bool m_bEnabled = false; + // For the list lookup - bool operator==(const SMonitor& rhs) { + bool operator==(const CMonitor& rhs) { return vecPosition == rhs.vecPosition && vecSize == rhs.vecSize && szName == rhs.szName; } }; \ No newline at end of file diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp index 65b18211..c740fd91 100644 --- a/src/helpers/WLClasses.hpp +++ b/src/helpers/WLClasses.hpp @@ -143,13 +143,13 @@ struct SConstraint { } }; -struct SMonitor; +struct CMonitor; struct SXDGPopup { CWindow* parentWindow = nullptr; SXDGPopup* parentPopup = nullptr; wlr_xdg_popup* popup = nullptr; - SMonitor* monitor = nullptr; + CMonitor* monitor = nullptr; DYNLISTENER(newPopupFromPopupXDG); DYNLISTENER(destroyPopupXDG); @@ -270,5 +270,5 @@ struct SSwipeGesture { float avgSpeed = 0; int speedPoints = 0; - SMonitor* pMonitor = nullptr; + CMonitor* pMonitor = nullptr; }; \ No newline at end of file diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index c1bd0996..3ff24aa0 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -99,7 +99,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) { if (pNode->isNode) return; - SMonitor* PMONITOR = nullptr; + CMonitor* PMONITOR = nullptr; if (pNode->workspaceID == SPECIAL_WORKSPACE_ID) { for (auto& m : g_pCompositor->m_vMonitors) { diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 6521ae80..eb92458b 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -171,7 +171,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) { } void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { - SMonitor* PMONITOR = nullptr; + CMonitor* PMONITOR = nullptr; if (pNode->workspaceID == SPECIAL_WORKSPACE_ID) { for (auto& m : g_pCompositor->m_vMonitors) { diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 5d3027c9..8257d8eb 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -59,7 +59,7 @@ void CAnimationManager::tick() { const auto PWINDOW = (CWindow*)av->m_pWindow; const auto PWORKSPACE = (CWorkspace*)av->m_pWorkspace; const auto PLAYER = (SLayerSurface*)av->m_pLayer; - SMonitor* PMONITOR = nullptr; + CMonitor* PMONITOR = nullptr; wlr_box WLRBOXPREV = {0,0,0,0}; if (PWINDOW) { diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index dfcf47ef..9910ed6c 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -996,7 +996,7 @@ void CKeybindManager::exitHyprland(std::string argz) { } void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) { - SMonitor* PMONITOR = nullptr; + CMonitor* PMONITOR = nullptr; try { if (!isNumber(args) && !isDirection(args)) { @@ -1025,7 +1025,7 @@ void CKeybindManager::moveWorkspaceToMonitor(std::string args) { std::string workspace = args.substr(0, args.find_first_of(' ')); std::string monitor = args.substr(args.find_first_of(' ') + 1); - SMonitor* PMONITOR = nullptr; + CMonitor* PMONITOR = nullptr; try { if (!isNumber(monitor) && !isDirection(monitor)) { diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 91d6b0c5..eaf029a5 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -139,7 +139,7 @@ GLuint CHyprOpenGLImpl::compileShader(const GLuint& type, std::string src) { return shader; } -void CHyprOpenGLImpl::begin(SMonitor* pMonitor, pixman_region32_t* pDamage, bool fake) { +void CHyprOpenGLImpl::begin(CMonitor* pMonitor, pixman_region32_t* pDamage, bool fake) { m_RenderData.pMonitor = pMonitor; glViewport(0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y); @@ -941,7 +941,7 @@ void CHyprOpenGLImpl::renderSplash(cairo_t *const CAIRO, cairo_surface_t *const cairo_surface_flush(CAIROSURFACE); } -void CHyprOpenGLImpl::createBGTextureForMonitor(SMonitor* pMonitor) { +void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) { RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!"); static auto *const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue; @@ -1011,7 +1011,7 @@ void CHyprOpenGLImpl::clearWithTex() { } } -void CHyprOpenGLImpl::destroyMonitorResources(SMonitor* pMonitor) { +void CHyprOpenGLImpl::destroyMonitorResources(CMonitor* pMonitor) { g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].mirrorFB.release(); g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].primaryFB.release(); g_pHyprOpenGL->m_mMonitorRenderResources[pMonitor].stencilTex.destroyTexture(); diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 84cfcd39..8c70529c 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -40,7 +40,7 @@ struct SMonitorRenderData { }; struct SCurrentRenderData { - SMonitor* pMonitor = nullptr; + CMonitor* pMonitor = nullptr; float projection[9]; SMonitorRenderData* pCurrentMonData = nullptr; @@ -56,7 +56,7 @@ public: CHyprOpenGLImpl(); - void begin(SMonitor*, pixman_region32_t*, bool fake = false); + void begin(CMonitor*, pixman_region32_t*, bool fake = false); void end(); void renderRect(wlr_box*, const CColor&, int round = 0); @@ -78,7 +78,7 @@ public: void scissor(const pixman_box32*); void scissor(const int x, const int y, const int w, const int h); - void destroyMonitorResources(SMonitor*); + void destroyMonitorResources(CMonitor*); SCurrentRenderData m_RenderData; @@ -91,8 +91,8 @@ public: std::unordered_map m_mWindowFramebuffers; std::unordered_map m_mLayerFramebuffers; - std::unordered_map m_mMonitorRenderResources; - std::unordered_map m_mMonitorBGTextures; + std::unordered_map m_mMonitorRenderResources; + std::unordered_map m_mMonitorBGTextures; private: std::list m_lBuffers; @@ -117,7 +117,7 @@ private: GLuint createProgram(const std::string&, const std::string&); GLuint compileShader(const GLuint&, std::string); - void createBGTextureForMonitor(SMonitor*); + void createBGTextureForMonitor(CMonitor*); // returns the out FB, can be either Mirror or MirrorSwap CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index a00d6f11..11e0384b 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -65,7 +65,7 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) { wlr_presentation_surface_sampled_on_output(g_pCompositor->m_sWLRPresentation, surface, RDATA->output); } -bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, SMonitor* pMonitor) { +bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor) { wlr_box geometry = pWindow->getFullWindowBoundingBox(); if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &geometry)) @@ -107,7 +107,7 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow) { return false; } -void CHyprRenderer::renderWorkspaceWithFullscreenWindow(SMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) { +void CHyprRenderer::renderWorkspaceWithFullscreenWindow(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time) { CWindow* pWorkspaceWindow = nullptr; for (auto& w : g_pCompositor->m_vWindows) { @@ -162,7 +162,7 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(SMonitor* pMonitor, CWor g_pHyprError->draw(); } -void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec* time, bool decorate, eRenderPassMode mode) { +void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* time, bool decorate, eRenderPassMode mode) { if (pWindow->m_bHidden) return; @@ -266,7 +266,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec* g_pHyprOpenGL->m_pCurrentWindow = nullptr; } -void CHyprRenderer::renderLayer(SLayerSurface* pLayer, SMonitor* pMonitor, timespec* time) { +void CHyprRenderer::renderLayer(SLayerSurface* pLayer, CMonitor* pMonitor, timespec* time) { if (pLayer->fadingOut) { g_pHyprOpenGL->renderSnapshot(&pLayer); return; @@ -504,7 +504,7 @@ void apply_exclusive(struct wlr_box* usable_area, uint32_t anchor, int32_t exclu } } -void CHyprRenderer::arrangeLayerArray(SMonitor* pMonitor, const std::vector>& layerSurfaces, bool exclusiveZone, wlr_box* usableArea) { +void CHyprRenderer::arrangeLayerArray(CMonitor* pMonitor, const std::vector>& layerSurfaces, bool exclusiveZone, wlr_box* usableArea) { wlr_box full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y}; for (auto& ls : layerSurfaces) { @@ -674,7 +674,7 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) { Debug::log(LOG, "Damage: Window (%s): xy: %d, %d wh: %d, %d", pWindow->m_szTitle.c_str(), damageBox.x, damageBox.y, damageBox.width, damageBox.height); } -void CHyprRenderer::damageMonitor(SMonitor* pMonitor) { +void CHyprRenderer::damageMonitor(CMonitor* pMonitor) { wlr_box damageBox = {0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y}; wlr_output_damage_add_box(pMonitor->damage, &damageBox); @@ -709,7 +709,7 @@ void CHyprRenderer::damageRegion(pixman_region32_t* rg) { } } -void CHyprRenderer::renderDragIcon(SMonitor* pMonitor, timespec* time) { +void CHyprRenderer::renderDragIcon(CMonitor* pMonitor, timespec* time) { if (!(g_pInputManager->m_sDrag.dragIcon && g_pInputManager->m_sDrag.iconMapped && g_pInputManager->m_sDrag.dragIcon->surface)) return; @@ -735,19 +735,24 @@ DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string& return DAMAGE_TRACKING_INVALID; } -bool CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) { +bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) { Debug::log(LOG, "Applying monitor rule for %s", pMonitor->szName.c_str()); // if it's disabled, disable and ignore if (pMonitorRule->disabled) { - wlr_output_enable(pMonitor->output, 0); - wlr_output_commit(pMonitor->output); - Events::listener_monitorDestroy(nullptr, pMonitor->output); + if (pMonitor->m_bEnabled) + pMonitor->onDisconnect(); + return false; } + if (!pMonitor->m_bEnabled) { + pMonitor->onConnect(true); // enable it. + force = true; + } + // Check if the rule isn't already applied if (!force && DELTALESSTHAN(pMonitor->vecPixelSize.x, pMonitorRule->resolution.x, 1) && DELTALESSTHAN(pMonitor->vecPixelSize.y, pMonitorRule->resolution.y, 1) && DELTALESSTHAN(pMonitor->refreshRate, pMonitorRule->refreshRate, 1) && pMonitor->scale == pMonitorRule->scale && DELTALESSTHAN(pMonitor->vecPosition.x, pMonitorRule->offset.x, 1) && DELTALESSTHAN(pMonitor->vecPosition.y, pMonitorRule->offset.y, 1) && pMonitor->transform == pMonitorRule->transform) { Debug::log(LOG, "Not applying a new rule to %s because it's already applied!", pMonitor->szName.c_str()); diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index 3c9b18bd..728f278d 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -34,9 +34,9 @@ public: void damageBox(wlr_box*); void damageBox(const int& x, const int& y, const int& w, const int& h); void damageRegion(pixman_region32_t*); - void damageMonitor(SMonitor*); - bool applyMonitorRule(SMonitor*, SMonitorRule*, bool force = false); - bool shouldRenderWindow(CWindow*, SMonitor*); + void damageMonitor(CMonitor*); + bool applyMonitorRule(CMonitor*, SMonitorRule*, bool force = false); + bool shouldRenderWindow(CWindow*, CMonitor*); bool shouldRenderWindow(CWindow*); void ensureCursorRenderingMode(); bool shouldRenderCursor(); @@ -46,11 +46,11 @@ public: DAMAGETRACKINGMODES damageTrackingModeFromStr(const std::string&); private: - void arrangeLayerArray(SMonitor*, const std::vector>&, bool, wlr_box*); - void renderWorkspaceWithFullscreenWindow(SMonitor*, CWorkspace*, timespec*); - void renderWindow(CWindow*, SMonitor*, timespec*, bool, eRenderPassMode); - void renderLayer(SLayerSurface*, SMonitor*, timespec*); - void renderDragIcon(SMonitor*, timespec*); + void arrangeLayerArray(CMonitor*, const std::vector>&, bool, wlr_box*); + void renderWorkspaceWithFullscreenWindow(CMonitor*, CWorkspace*, timespec*); + void renderWindow(CWindow*, CMonitor*, timespec*, bool, eRenderPassMode); + void renderLayer(SLayerSurface*, CMonitor*, timespec*); + void renderDragIcon(CMonitor*, timespec*); bool m_bHasARenderedCursor = true; diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index a03181c0..5c2d00b9 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -48,7 +48,7 @@ void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) { } } -void CHyprDropShadowDecoration::draw(SMonitor* pMonitor, float a) { +void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) { if (!g_pCompositor->windowValidMapped(m_pWindow)) return; diff --git a/src/render/decorations/CHyprDropShadowDecoration.hpp b/src/render/decorations/CHyprDropShadowDecoration.hpp index f734c111..a90f2b0f 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.hpp +++ b/src/render/decorations/CHyprDropShadowDecoration.hpp @@ -9,7 +9,7 @@ public: virtual SWindowDecorationExtents getWindowDecorationExtents(); - virtual void draw(SMonitor*, float a); + virtual void draw(CMonitor*, float a); virtual eDecorationType getDecorationType(); diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 2d46d7a0..eadcd167 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -64,7 +64,7 @@ void CHyprGroupBarDecoration::damageEntire() { g_pHyprRenderer->damageBox(&dm); } -void CHyprGroupBarDecoration::draw(SMonitor* pMonitor, float a) { +void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) { // get how many bars we will draw int barsToDraw = m_dwGroupMembers.size(); diff --git a/src/render/decorations/CHyprGroupBarDecoration.hpp b/src/render/decorations/CHyprGroupBarDecoration.hpp index 76baab65..00570347 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.hpp +++ b/src/render/decorations/CHyprGroupBarDecoration.hpp @@ -10,7 +10,7 @@ public: virtual SWindowDecorationExtents getWindowDecorationExtents(); - virtual void draw(SMonitor*, float a); + virtual void draw(CMonitor*, float a); virtual eDecorationType getDecorationType(); diff --git a/src/render/decorations/IHyprWindowDecoration.hpp b/src/render/decorations/IHyprWindowDecoration.hpp index 4066b6f3..e6f65f7e 100644 --- a/src/render/decorations/IHyprWindowDecoration.hpp +++ b/src/render/decorations/IHyprWindowDecoration.hpp @@ -14,7 +14,7 @@ struct SWindowDecorationExtents { }; class CWindow; -struct SMonitor; +struct CMonitor; interface IHyprWindowDecoration { public: @@ -22,7 +22,7 @@ public: virtual SWindowDecorationExtents getWindowDecorationExtents() = 0; - virtual void draw(SMonitor*, float a) = 0; + virtual void draw(CMonitor*, float a) = 0; virtual eDecorationType getDecorationType() = 0;