core: drop using deques in favor of vectors

No point in most of these.
This commit is contained in:
Vaxry 2024-12-16 15:58:19 +00:00
parent de3ad245dc
commit a5234f26e4
25 changed files with 181 additions and 157 deletions

View file

@ -21,7 +21,6 @@
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <filesystem>
#include <cstdarg>
#include <regex>
@ -322,11 +321,11 @@ void instancesRequest(bool json) {
log(result + "\n");
}
std::deque<std::string> splitArgs(int argc, char** argv) {
std::deque<std::string> result;
std::vector<std::string> splitArgs(int argc, char** argv) {
std::vector<std::string> result;
for (auto i = 1 /* skip the executable */; i < argc; ++i)
result.push_back(std::string(argv[i]));
result.emplace_back(argv[i]);
return result;
}

View file

@ -1349,13 +1349,13 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
else {
// move X11 window stack
std::deque<PHLWINDOW> toMove;
std::vector<PHLWINDOW> toMove;
auto x11Stack = [&](PHLWINDOW pw, bool top, auto&& x11Stack) -> void {
if (top)
toMove.emplace_back(pw);
else
toMove.emplace_front(pw);
toMove.insert(toMove.begin(), pw);
for (auto const& w : m_vWindows) {
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsX11 && w->x11TransientFor() == pw && w != pw && std::find(toMove.begin(), toMove.end(), w) == toMove.end()) {

View file

@ -1,7 +1,6 @@
#pragma once
#include <memory>
#include <deque>
#include <list>
#include <sys/resource.h>

View file

@ -838,16 +838,16 @@ void CConfigManager::setDefaultAnimationVars() {
}
std::optional<std::string> CConfigManager::resetHLConfig() {
m_dMonitorRules.clear();
m_dWindowRules.clear();
m_vMonitorRules.clear();
m_vWindowRules.clear();
g_pKeybindManager->clearKeybinds();
g_pAnimationManager->removeAllBeziers();
m_mAdditionalReservedAreas.clear();
m_dBlurLSNamespaces.clear();
m_dWorkspaceRules.clear();
m_vWorkspaceRules.clear();
setDefaultAnimationVars(); // reset anims
m_vDeclaredPlugins.clear();
m_dLayerRules.clear();
m_vLayerRules.clear();
m_vFailedPluginConfigValues.clear();
finalExecRequests.clear();
@ -1154,7 +1154,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const PHLMONITOR PMONITOR) {
return rule;
};
for (auto const& r : m_dMonitorRules | std::views::reverse) {
for (auto const& r : m_vMonitorRules | std::views::reverse) {
if (PMONITOR->matchesStaticSelector(r.name)) {
return applyWlrOutputConfig(r);
}
@ -1162,7 +1162,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const PHLMONITOR PMONITOR) {
Debug::log(WARN, "No rule found for {}, trying to use the first.", PMONITOR->szName);
for (auto const& r : m_dMonitorRules) {
for (auto const& r : m_vMonitorRules) {
if (r.name.empty()) {
return applyWlrOutputConfig(r);
}
@ -1179,7 +1179,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const PHLMONITOR PMONITOR) {
SWorkspaceRule CConfigManager::getWorkspaceRuleFor(PHLWORKSPACE pWorkspace) {
SWorkspaceRule mergedRule{};
for (auto const& rule : m_dWorkspaceRules) {
for (auto const& rule : m_vWorkspaceRules) {
if (!pWorkspace->matchesStaticSelector(rule.workspaceString))
continue;
@ -1252,7 +1252,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, boo
// local tags for dynamic tag rule match
auto tags = pWindow->m_tags;
for (auto const& rule : m_dWindowRules) {
for (auto const& rule : m_vWindowRules) {
// check if we have a matching rule
if (!rule.v2) {
try {
@ -1437,7 +1437,7 @@ std::vector<SLayerRule> CConfigManager::getMatchingRules(PHLLS pLS) {
if (!pLS->layerSurface || pLS->fadingOut)
return returns;
for (auto const& lr : m_dLayerRules) {
for (auto const& lr : m_vLayerRules) {
if (lr.targetNamespace.starts_with("address:0x")) {
if (std::format("address:0x{:x}", (uintptr_t)pLS.get()) != lr.targetNamespace)
continue;
@ -1510,13 +1510,13 @@ void CConfigManager::dispatchExecShutdown() {
}
void CConfigManager::appendMonitorRule(const SMonitorRule& r) {
m_dMonitorRules.emplace_back(r);
m_vMonitorRules.emplace_back(r);
}
bool CConfigManager::replaceMonitorRule(const SMonitorRule& newrule) {
// Looks for an existing monitor rule (compared by name).
// If the rule exists, it is replaced with the input rule.
for (auto& r : m_dMonitorRules) {
for (auto& r : m_vMonitorRules) {
if (r.name == newrule.name) {
r = newrule;
return true;
@ -1693,7 +1693,7 @@ PHLMONITOR CConfigManager::getBoundMonitorForWS(const std::string& wsname) {
}
std::string CConfigManager::getBoundMonitorStringForWS(const std::string& wsname) {
for (auto const& wr : m_dWorkspaceRules) {
for (auto const& wr : m_vWorkspaceRules) {
const auto WSNAME = wr.workspaceName.starts_with("name:") ? wr.workspaceName.substr(5) : wr.workspaceName;
if (WSNAME == wsname)
@ -1703,8 +1703,8 @@ std::string CConfigManager::getBoundMonitorStringForWS(const std::string& wsname
return "";
}
const std::deque<SWorkspaceRule>& CConfigManager::getAllWorkspaceRules() {
return m_dWorkspaceRules;
const std::vector<SWorkspaceRule>& CConfigManager::getAllWorkspaceRules() {
return m_vWorkspaceRules;
}
void CConfigManager::addExecRule(const SExecRequestedRule& rule) {
@ -1782,7 +1782,7 @@ void CConfigManager::removePluginConfig(HANDLE handle) {
}
std::string CConfigManager::getDefaultWorkspaceFor(const std::string& name) {
for (auto other = m_dWorkspaceRules.begin(); other != m_dWorkspaceRules.end(); ++other) {
for (auto other = m_vWorkspaceRules.begin(); other != m_vWorkspaceRules.end(); ++other) {
if (other->isDefault) {
if (other->monitor == name)
return other->workspaceString;
@ -1900,7 +1900,7 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
const auto TRANSFORM = (wl_output_transform)TSF;
// overwrite if exists
for (auto& r : m_dMonitorRules) {
for (auto& r : m_vMonitorRules) {
if (r.name == newrule.name) {
r.transform = TRANSFORM;
return {};
@ -1925,9 +1925,9 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
return "parse error: curitem bogus";
}
std::erase_if(m_dMonitorRules, [&](const auto& other) { return other.name == newrule.name; });
std::erase_if(m_vMonitorRules, [&](const auto& other) { return other.name == newrule.name; });
m_dMonitorRules.push_back(newrule);
m_vMonitorRules.push_back(newrule);
return {};
}
@ -1960,7 +1960,7 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
if (ARGS[2].starts_with("auto")) {
newrule.offset = Vector2D(-INT32_MAX, -INT32_MAX);
// If this is the first monitor rule needs to be on the right.
if (ARGS[2] == "auto-right" || ARGS[2] == "auto" || m_dMonitorRules.empty())
if (ARGS[2] == "auto-right" || ARGS[2] == "auto" || m_vMonitorRules.empty())
newrule.autoDir = eAutoDirs::DIR_AUTO_RIGHT;
else if (ARGS[2] == "auto-left")
newrule.autoDir = eAutoDirs::DIR_AUTO_LEFT;
@ -2043,7 +2043,7 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
wsRule.workspaceId = id;
wsRule.workspaceName = name;
m_dWorkspaceRules.emplace_back(wsRule);
m_vWorkspaceRules.emplace_back(wsRule);
argno++;
} else {
Debug::log(ERR, "Config error: invalid monitor syntax at \"{}\"", ARGS[argno]);
@ -2053,9 +2053,9 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
argno++;
}
std::erase_if(m_dMonitorRules, [&](const auto& other) { return other.name == newrule.name; });
std::erase_if(m_vMonitorRules, [&](const auto& other) { return other.name == newrule.name; });
m_dMonitorRules.push_back(newrule);
m_vMonitorRules.push_back(newrule);
if (error.empty())
return {};
@ -2338,7 +2338,7 @@ std::optional<std::string> CConfigManager::handleWindowRule(const std::string& c
return "empty rule?";
if (RULE == "unset") {
std::erase_if(m_dWindowRules, [&](const SWindowRule& other) { return other.szValue == VALUE; });
std::erase_if(m_vWindowRules, [&](const SWindowRule& other) { return other.szValue == VALUE; });
return {};
}
@ -2349,9 +2349,9 @@ std::optional<std::string> CConfigManager::handleWindowRule(const std::string& c
}
if (RULE.starts_with("size") || RULE.starts_with("maxsize") || RULE.starts_with("minsize"))
m_dWindowRules.push_front({RULE, VALUE});
m_vWindowRules.insert(m_vWindowRules.begin(), {RULE, VALUE});
else
m_dWindowRules.push_back({RULE, VALUE});
m_vWindowRules.push_back({RULE, VALUE});
return {};
}
@ -2365,7 +2365,7 @@ std::optional<std::string> CConfigManager::handleLayerRule(const std::string& co
return "empty rule?";
if (RULE == "unset") {
std::erase_if(m_dLayerRules, [&](const SLayerRule& other) { return other.targetNamespace == VALUE; });
std::erase_if(m_vLayerRules, [&](const SLayerRule& other) { return other.targetNamespace == VALUE; });
return {};
}
@ -2374,7 +2374,7 @@ std::optional<std::string> CConfigManager::handleLayerRule(const std::string& co
return "Invalid rule found: " + RULE;
}
m_dLayerRules.push_back({VALUE, RULE});
m_vLayerRules.push_back({VALUE, RULE});
for (auto const& m : g_pCompositor->m_vMonitors)
for (auto const& lsl : m->m_aLayerSurfaceLayers)
@ -2512,7 +2512,7 @@ std::optional<std::string> CConfigManager::handleWindowRuleV2(const std::string&
rule.szOnWorkspace = extract(ONWORKSPACEPOS + 12);
if (RULE == "unset") {
std::erase_if(m_dWindowRules, [&](const SWindowRule& other) {
std::erase_if(m_vWindowRules, [&](const SWindowRule& other) {
if (!other.v2) {
return other.szClass == rule.szClass && !rule.szClass.empty();
} else {
@ -2562,9 +2562,9 @@ std::optional<std::string> CConfigManager::handleWindowRuleV2(const std::string&
}
if (RULE.starts_with("size") || RULE.starts_with("maxsize") || RULE.starts_with("minsize"))
m_dWindowRules.push_front(rule);
m_vWindowRules.insert(m_vWindowRules.begin(), rule);
else
m_dWindowRules.push_back(rule);
m_vWindowRules.push_back(rule);
return {};
}
@ -2713,10 +2713,10 @@ std::optional<std::string> CConfigManager::handleWorkspaceRules(const std::strin
wsRule.workspaceId = id;
wsRule.workspaceName = name;
const auto IT = std::find_if(m_dWorkspaceRules.begin(), m_dWorkspaceRules.end(), [&](const auto& other) { return other.workspaceString == wsRule.workspaceString; });
const auto IT = std::find_if(m_vWorkspaceRules.begin(), m_vWorkspaceRules.end(), [&](const auto& other) { return other.workspaceString == wsRule.workspaceString; });
if (IT == m_dWorkspaceRules.end())
m_dWorkspaceRules.emplace_back(wsRule);
if (IT == m_vWorkspaceRules.end())
m_vWorkspaceRules.emplace_back(wsRule);
else
*IT = mergeWorkspaceRules(*IT, wsRule);

View file

@ -8,7 +8,6 @@
#include "../defines.hpp"
#include <variant>
#include <vector>
#include <deque>
#include <algorithm>
#include <regex>
#include <optional>
@ -175,7 +174,7 @@ class CConfigManager {
PHLMONITOR getBoundMonitorForWS(const std::string&);
std::string getBoundMonitorStringForWS(const std::string&);
const std::deque<SWorkspaceRule>& getAllWorkspaceRules();
const std::vector<SWorkspaceRule>& getAllWorkspaceRules();
std::vector<SWindowRule> getMatchingRules(PHLWINDOW, bool dynamic = true, bool shadowExec = false);
std::vector<SLayerRule> getMatchingRules(PHLLS);
@ -275,7 +274,7 @@ class CConfigManager {
private:
std::unique_ptr<Hyprlang::CConfig> m_pConfig;
std::deque<std::string> configPaths; // stores all the config paths
std::vector<std::string> configPaths; // stores all the config paths
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values
@ -290,16 +289,16 @@ class CConfigManager {
bool isFirstLaunch = true; // For exec-once
std::deque<SMonitorRule> m_dMonitorRules;
std::deque<SWorkspaceRule> m_dWorkspaceRules;
std::deque<SWindowRule> m_dWindowRules;
std::deque<SLayerRule> m_dLayerRules;
std::deque<std::string> m_dBlurLSNamespaces;
std::vector<SMonitorRule> m_vMonitorRules;
std::vector<SWorkspaceRule> m_vWorkspaceRules;
std::vector<SWindowRule> m_vWindowRules;
std::vector<SLayerRule> m_vLayerRules;
std::vector<std::string> m_dBlurLSNamespaces;
bool firstExecDispatched = false;
bool m_bManualCrashInitiated = false;
std::deque<std::string> firstExecRequests;
std::deque<std::string> finalExecRequests;
std::vector<std::string> firstExecRequests;
std::vector<std::string> finalExecRequests;
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
std::string m_szConfigErrors = "";

View file

@ -8,7 +8,12 @@ CHyprDebugOverlay::CHyprDebugOverlay() {
}
void CHyprMonitorDebugOverlay::renderData(PHLMONITOR pMonitor, float durationUs) {
m_dLastRenderTimes.push_back(durationUs / 1000.f);
static auto PDEBUGOVERLAY = CConfigValue<Hyprlang::INT>("debug:overlay");
if (!*PDEBUGOVERLAY)
return;
m_dLastRenderTimes.emplace_back(durationUs / 1000.f);
if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
m_dLastRenderTimes.pop_front();
@ -18,7 +23,12 @@ void CHyprMonitorDebugOverlay::renderData(PHLMONITOR pMonitor, float durationUs)
}
void CHyprMonitorDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float durationUs) {
m_dLastRenderTimesNoOverlay.push_back(durationUs / 1000.f);
static auto PDEBUGOVERLAY = CConfigValue<Hyprlang::INT>("debug:overlay");
if (!*PDEBUGOVERLAY)
return;
m_dLastRenderTimesNoOverlay.emplace_back(durationUs / 1000.f);
if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
m_dLastRenderTimesNoOverlay.pop_front();
@ -28,7 +38,12 @@ void CHyprMonitorDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float du
}
void CHyprMonitorDebugOverlay::frameData(PHLMONITOR pMonitor) {
m_dLastFrametimes.push_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f);
static auto PDEBUGOVERLAY = CConfigValue<Hyprlang::INT>("debug:overlay");
if (!*PDEBUGOVERLAY)
return;
m_dLastFrametimes.emplace_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f);
if (m_dLastFrametimes.size() > (long unsigned int)pMonitor->refreshRate)
m_dLastFrametimes.pop_front();
@ -189,14 +204,29 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
}
void CHyprDebugOverlay::renderData(PHLMONITOR pMonitor, float durationUs) {
static auto PDEBUGOVERLAY = CConfigValue<Hyprlang::INT>("debug:overlay");
if (!*PDEBUGOVERLAY)
return;
m_mMonitorOverlays[pMonitor].renderData(pMonitor, durationUs);
}
void CHyprDebugOverlay::renderDataNoOverlay(PHLMONITOR pMonitor, float durationUs) {
static auto PDEBUGOVERLAY = CConfigValue<Hyprlang::INT>("debug:overlay");
if (!*PDEBUGOVERLAY)
return;
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, durationUs);
}
void CHyprDebugOverlay::frameData(PHLMONITOR pMonitor) {
static auto PDEBUGOVERLAY = CConfigValue<Hyprlang::INT>("debug:overlay");
if (!*PDEBUGOVERLAY)
return;
m_mMonitorOverlays[pMonitor].frameData(pMonitor);
}

View file

@ -3,9 +3,9 @@
#include "../defines.hpp"
#include "../helpers/Monitor.hpp"
#include "../render/Texture.hpp"
#include <deque>
#include <cairo/cairo.h>
#include <map>
#include <deque>
class CHyprRenderer;

View file

@ -18,7 +18,7 @@ inline auto iconBackendFromLayout(PangoLayout* layout) {
CHyprNotificationOverlay::CHyprNotificationOverlay() {
static auto P = g_pHookSystem->hookDynamic("focusedMon", [&](void* self, SCallbackInfo& info, std::any param) {
if (m_dNotifications.size() == 0)
if (m_vNotifications.size() == 0)
return;
g_pHyprRenderer->damageBox(&m_bLastDamage);
@ -35,7 +35,7 @@ CHyprNotificationOverlay::~CHyprNotificationOverlay() {
}
void CHyprNotificationOverlay::addNotification(const std::string& text, const CHyprColor& color, const float timeMs, const eIcons icon, const float fontSize) {
const auto PNOTIF = m_dNotifications.emplace_back(std::make_unique<SNotification>()).get();
const auto PNOTIF = m_vNotifications.emplace_back(std::make_unique<SNotification>()).get();
PNOTIF->text = icon != eIcons::ICON_NONE ? " " + text /* tiny bit of padding otherwise icon touches text */ : text;
PNOTIF->color = color == CHyprColor(0) ? ICONS_COLORS[icon] : color;
@ -51,12 +51,12 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CH
void CHyprNotificationOverlay::dismissNotifications(const int amount) {
if (amount == -1)
m_dNotifications.clear();
m_vNotifications.clear();
else {
const int AMT = std::min(amount, static_cast<int>(m_dNotifications.size()));
const int AMT = std::min(amount, static_cast<int>(m_vNotifications.size()));
for (int i = 0; i < AMT; ++i) {
m_dNotifications.pop_front();
m_vNotifications.erase(m_vNotifications.begin());
}
}
}
@ -87,7 +87,7 @@ CBox CHyprNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) {
const auto iconBackendID = iconBackendFromLayout(layout);
const auto PBEZIER = g_pAnimationManager->getBezier("default");
for (auto const& notif : m_dNotifications) {
for (auto const& notif : m_vNotifications) {
const auto ICONPADFORNOTIF = notif->icon == ICON_NONE ? 0 : ICON_PAD;
const auto FONTSIZE = std::clamp((int)(notif->fontSize * ((pMonitor->vecPixelSize.x * SCALE) / 1920.f)), 8, 40);
@ -182,7 +182,7 @@ CBox CHyprNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) {
g_object_unref(layout);
// cleanup notifs
std::erase_if(m_dNotifications, [](const auto& notif) { return notif->started.getMillis() > notif->timeMs; });
std::erase_if(m_vNotifications, [](const auto& notif) { return notif->started.getMillis() > notif->timeMs; });
return CBox{(int)(pMonitor->vecPosition.x + pMonitor->vecSize.x - maxWidth - 20), (int)pMonitor->vecPosition.y, (int)maxWidth + 20, (int)offsetY + 10};
}
@ -205,7 +205,7 @@ void CHyprNotificationOverlay::draw(PHLMONITOR pMonitor) {
}
// Draw the notifications
if (m_dNotifications.size() == 0)
if (m_vNotifications.size() == 0)
return;
// Render to the monitor
@ -246,5 +246,5 @@ void CHyprNotificationOverlay::draw(PHLMONITOR pMonitor) {
}
bool CHyprNotificationOverlay::hasAny() {
return !m_dNotifications.empty();
return !m_vNotifications.empty();
}

View file

@ -6,7 +6,7 @@
#include "../render/Texture.hpp"
#include "../SharedDefs.hpp"
#include <deque>
#include <vector>
#include <cairo/cairo.h>
@ -50,7 +50,7 @@ class CHyprNotificationOverlay {
CBox drawNotifications(PHLMONITOR pMonitor);
CBox m_bLastDamage;
std::deque<std::unique_ptr<SNotification>> m_dNotifications;
std::vector<std::unique_ptr<SNotification>> m_vNotifications;
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;

View file

@ -1,6 +1,6 @@
#pragma once
#include <deque>
#include <vector>
#include <string>
#include "../config/ConfigDataValues.hpp"
@ -344,7 +344,7 @@ class CWindow {
// Window decorations
// TODO: make this a SP.
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
std::vector<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
// Special render data, rules, etc

View file

@ -9,18 +9,18 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
const auto BEGIN = std::chrono::high_resolution_clock::now();
// Avoid reallocations by reserving enough memory upfront
m_dPoints.resize(pVec->size() + 2);
m_dPoints[0] = Vector2D(0, 0); // Start point
m_vPoints.resize(pVec->size() + 2);
m_vPoints[0] = Vector2D(0, 0); // Start point
size_t index = 1; // Start after the first element
for (const auto& vec : *pVec) {
if (index < m_dPoints.size() - 1) { // Bounds check to ensure safety
m_dPoints[index] = vec;
if (index < m_vPoints.size() - 1) { // Bounds check to ensure safety
m_vPoints[index] = vec;
++index;
}
}
m_dPoints.back() = Vector2D(1, 1); // End point
m_vPoints.back() = Vector2D(1, 1); // End point
RASSERT(m_dPoints.size() == 4, "CBezierCurve only supports cubic beziers! (points num: {})", m_dPoints.size());
RASSERT(m_vPoints.size() == 4, "CBezierCurve only supports cubic beziers! (points num: {})", m_vPoints.size());
// bake BAKEDPOINTS points for faster lookups
// T -> X ( / BAKEDPOINTS )
@ -47,14 +47,14 @@ float CBezierCurve::getXForT(float const& t) {
float t2 = t * t;
float t3 = t2 * t;
return 3 * t * (1 - t) * (1 - t) * m_dPoints[1].x + 3 * t2 * (1 - t) * m_dPoints[2].x + t3 * m_dPoints[3].x;
return 3 * t * (1 - t) * (1 - t) * m_vPoints[1].x + 3 * t2 * (1 - t) * m_vPoints[2].x + t3 * m_vPoints[3].x;
}
float CBezierCurve::getYForT(float const& t) {
float t2 = t * t;
float t3 = t2 * t;
return 3 * t * (1 - t) * (1 - t) * m_dPoints[1].y + 3 * t2 * (1 - t) * m_dPoints[2].y + t3 * m_dPoints[3].y;
return 3 * t * (1 - t) * (1 - t) * m_vPoints[1].y + 3 * t2 * (1 - t) * m_vPoints[2].y + t3 * m_vPoints[3].y;
}
// Todo: this probably can be done better and faster

View file

@ -1,6 +1,6 @@
#pragma once
#include <deque>
#include <vector>
#include <array>
#include <vector>
#include "math/Math.hpp"
@ -22,7 +22,7 @@ class CBezierCurve {
private:
// this INCLUDES the 0,0 and 1,1 points.
std::vector<Vector2D> m_dPoints;
std::vector<Vector2D> m_vPoints;
std::array<Vector2D, BAKEDPOINTS> m_aPointsBaked;
};

View file

@ -314,7 +314,7 @@ void CMonitor::onDisconnect(bool destroy) {
g_pCompositor->warpCursorTo(BACKUPMON->vecPosition + BACKUPMON->vecTransformedSize / 2.F, true);
// move workspaces
std::deque<PHLWORKSPACE> wspToMove;
std::vector<PHLWORKSPACE> wspToMove;
for (auto const& w : g_pCompositor->m_vWorkspaces) {
if (w->m_pMonitor == self || !w->m_pMonitor)
wspToMove.push_back(w);
@ -541,7 +541,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
}
// move all the WS
std::deque<PHLWORKSPACE> wspToMove;
std::vector<PHLWORKSPACE> wspToMove;
for (auto const& w : g_pCompositor->m_vWorkspaces) {
if (w->m_pMonitor == self || !w->m_pMonitor)
wspToMove.push_back(w);

View file

@ -1,7 +1,7 @@
#pragma once
#include "../defines.hpp"
#include <deque>
#include <vector>
#include "WLClasses.hpp"
#include <vector>
#include <array>

View file

@ -38,13 +38,12 @@ void SDwindleNodeData::recalcSizePosRecursive(bool force, bool horizontalOverrid
}
}
void SDwindleNodeData::getAllChildrenRecursive(std::deque<SDwindleNodeData*>* pDeque) {
void SDwindleNodeData::getAllChildrenRecursive(std::vector<SDwindleNodeData*>* pVec) {
if (children[0]) {
children[0]->getAllChildrenRecursive(pDeque);
children[1]->getAllChildrenRecursive(pDeque);
} else {
pDeque->push_back(this);
}
children[0]->getAllChildrenRecursive(pVec);
children[1]->getAllChildrenRecursive(pVec);
} else
pVec->push_back(this);
}
int CHyprDwindleLayout::getNodesOnWorkspace(const WORKSPACEID& id) {
@ -805,14 +804,13 @@ void CHyprDwindleLayout::recalculateWindow(PHLWINDOW pWindow) {
PNODE->recalcSizePosRecursive();
}
void addToDequeRecursive(std::deque<SDwindleNodeData*>* pDeque, std::deque<SDwindleNodeData*>* pParents, SDwindleNodeData* node) {
static void addToVectorRecursive(std::vector<SDwindleNodeData*>* pVec, std::vector<SDwindleNodeData*>* pParents, SDwindleNodeData* node) {
if (node->isNode) {
pParents->push_back(node);
addToDequeRecursive(pDeque, pParents, node->children[0]);
addToDequeRecursive(pDeque, pParents, node->children[1]);
} else {
pDeque->emplace_back(node);
}
pParents->emplace_back(node);
addToVectorRecursive(pVec, pParents, node->children[0]);
addToVectorRecursive(pVec, pParents, node->children[1]);
} else
pVec->emplace_back(node);
}
SWindowRenderLayoutHints CHyprDwindleLayout::requestRenderHints(PHLWINDOW pWindow) {

View file

@ -4,7 +4,7 @@
#include "../desktop/DesktopTypes.hpp"
#include <list>
#include <deque>
#include <vector>
#include <array>
#include <optional>
#include <format>
@ -39,7 +39,7 @@ struct SDwindleNodeData {
}
void recalcSizePosRecursive(bool force = false, bool horizontalOverride = false, bool verticalOverride = false);
void getAllChildrenRecursive(std::deque<SDwindleNodeData*>*);
void getAllChildrenRecursive(std::vector<SDwindleNodeData*>*);
CHyprDwindleLayout* layout = nullptr;
};

View file

@ -5,7 +5,7 @@
#include "../config/ConfigManager.hpp"
#include <vector>
#include <list>
#include <deque>
#include <vector>
#include <any>
enum eFullscreenMode : int8_t;

View file

@ -301,7 +301,7 @@ void CAnimationManager::tick() {
g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_ANIMATION);
}
// do it here, because if this alters the animation vars deque we would be in trouble above.
// do it here, because if this alters the animation vars vec we would be in trouble above.
for (auto const& ave : animationEndedVars) {
ave->onAnimationEnd();
}

View file

@ -116,7 +116,7 @@ int CEventManager::onClientEvent(int fd, uint32_t mask) {
if (write(CLIENTIT->fd, event->c_str(), event->length()) < 0)
break;
CLIENTIT->events.pop_front();
CLIENTIT->events.erase(CLIENTIT->events.begin());
}
// stop polling when we sent all events

View file

@ -1,5 +1,5 @@
#pragma once
#include <deque>
#include <vector>
#include <vector>
#include "../defines.hpp"
@ -28,7 +28,7 @@ class CEventManager {
struct SClient {
int fd = -1;
std::deque<SP<std::string>> events;
std::vector<SP<std::string>> events;
wl_event_source* eventSource = nullptr;
};

View file

@ -1776,7 +1776,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
// apply
// we make a copy because changeWindowFloatingMode might invalidate the iterator
std::deque<PHLWINDOW> ptrs;
std::vector<PHLWINDOW> ptrs;
for (auto const& w : g_pCompositor->m_vWindows)
ptrs.push_back(w);

View file

@ -1,7 +1,7 @@
#pragma once
#include "../defines.hpp"
#include <deque>
#include <vector>
#include <set>
#include <unordered_map>
#include <functional>
@ -116,7 +116,7 @@ class CKeybindManager {
static SDispatchResult changeMouseBindMode(const eMouseBindMode mode);
private:
std::deque<SPressedKeyWithMods> m_dPressedKeys;
std::vector<SPressedKeyWithMods> m_dPressedKeys;
inline static std::string m_szCurrentSelectedSubmap = "";

View file

@ -163,7 +163,7 @@ class CInputManager {
std::list<SSwitchDevice> m_lSwitches;
// Exclusive layer surfaces
std::deque<PHLLSREF> m_dExclusiveLSes;
std::vector<PHLLSREF> m_dExclusiveLSes;
// constraints
std::vector<WP<CPointerConstraint>> m_vConstraints;

View file

@ -5,7 +5,6 @@
#include <array>
#include <chrono>
#include <concepts>
#include <deque>
#include <filesystem>
#include <fstream>
#include <functional>

View file

@ -2,7 +2,7 @@
#include "IHyprWindowDecoration.hpp"
#include "../../devices/IPointer.hpp"
#include <deque>
#include <vector>
#include "../Texture.hpp"
#include <string>
#include <memory>
@ -54,7 +54,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
PHLWINDOWREF m_pWindow;
std::deque<PHLWINDOWREF> m_dwGroupMembers;
std::vector<PHLWINDOWREF> m_dwGroupMembers;
float m_fBarWidth;
float m_fBarHeight;
@ -71,6 +71,6 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
struct STitleTexs {
// STitleTexs* overriden = nullptr; // TODO: make shit shared in-group to decrease VRAM usage.
std::deque<std::unique_ptr<CTitleTex>> titleTexs;
std::vector<std::unique_ptr<CTitleTex>> titleTexs;
} m_sTitleTexs;
};