From a5234f26e4b7146ae7c2df25950f0177534cd643 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 16 Dec 2024 15:58:19 +0000 Subject: core: drop using deques in favor of vectors No point in most of these. --- src/managers/AnimationManager.cpp | 2 +- src/managers/EventManager.cpp | 2 +- src/managers/EventManager.hpp | 8 +++--- src/managers/KeybindManager.cpp | 2 +- src/managers/KeybindManager.hpp | 56 ++++++++++++++++++------------------- src/managers/input/InputManager.hpp | 2 +- 6 files changed, 36 insertions(+), 36 deletions(-) (limited to 'src/managers') diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 5ebbea8a..a61c20a1 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -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(); } diff --git a/src/managers/EventManager.cpp b/src/managers/EventManager.cpp index 786468f2..fc55b472 100644 --- a/src/managers/EventManager.cpp +++ b/src/managers/EventManager.cpp @@ -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 diff --git a/src/managers/EventManager.hpp b/src/managers/EventManager.hpp index 383d3246..37716e63 100644 --- a/src/managers/EventManager.hpp +++ b/src/managers/EventManager.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include "../defines.hpp" @@ -27,9 +27,9 @@ class CEventManager { int onClientEvent(int fd, uint32_t mask); struct SClient { - int fd = -1; - std::deque> events; - wl_event_source* eventSource = nullptr; + int fd = -1; + std::vector> events; + wl_event_source* eventSource = nullptr; }; std::vector::iterator findClientByFD(int fd); diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 8afa330b..f23f5dc7 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1776,7 +1776,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) { // apply // we make a copy because changeWindowFloatingMode might invalidate the iterator - std::deque ptrs; + std::vector ptrs; for (auto const& w : g_pCompositor->m_vWindows) ptrs.push_back(w); diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index f524f86f..6486ac3b 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -1,7 +1,7 @@ #pragma once #include "../defines.hpp" -#include +#include #include #include #include @@ -116,45 +116,45 @@ class CKeybindManager { static SDispatchResult changeMouseBindMode(const eMouseBindMode mode); private: - std::deque m_dPressedKeys; + std::vector m_dPressedKeys; - inline static std::string m_szCurrentSelectedSubmap = ""; + inline static std::string m_szCurrentSelectedSubmap = ""; - std::vector> m_vActiveKeybinds; - WP m_pLastLongPressKeybind; - SP m_pLongPressTimer, m_pRepeatKeyTimer; + std::vector> m_vActiveKeybinds; + WP m_pLastLongPressKeybind; + SP m_pLongPressTimer, m_pRepeatKeyTimer; - uint32_t m_uTimeLastMs = 0; - uint32_t m_uLastCode = 0; - uint32_t m_uLastMouseCode = 0; + uint32_t m_uTimeLastMs = 0; + uint32_t m_uLastCode = 0; + uint32_t m_uLastMouseCode = 0; - std::vector> m_vPressedSpecialBinds; + std::vector> m_vPressedSpecialBinds; - int m_iPassPressed = -1; // used for pass + int m_iPassPressed = -1; // used for pass - CTimer m_tScrollTimer; + CTimer m_tScrollTimer; - SDispatchResult handleKeybinds(const uint32_t, const SPressedKeyWithMods&, bool); + SDispatchResult handleKeybinds(const uint32_t, const SPressedKeyWithMods&, bool); - std::set m_sMkKeys = {}; - std::set m_sMkMods = {}; - eMultiKeyCase mkBindMatches(const SP); - eMultiKeyCase mkKeysymSetMatches(const std::set, const std::set); + std::set m_sMkKeys = {}; + std::set m_sMkMods = {}; + eMultiKeyCase mkBindMatches(const SP); + eMultiKeyCase mkKeysymSetMatches(const std::set, const std::set); - bool handleInternalKeybinds(xkb_keysym_t); - bool handleVT(xkb_keysym_t); + bool handleInternalKeybinds(xkb_keysym_t); + bool handleVT(xkb_keysym_t); - xkb_state* m_pXKBTranslationState = nullptr; + xkb_state* m_pXKBTranslationState = nullptr; - void updateXKBTranslationState(); - bool ensureMouseBindState(); + void updateXKBTranslationState(); + bool ensureMouseBindState(); - static bool tryMoveFocusToMonitor(PHLMONITOR monitor); - static void moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string& dir = ""); - static void moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowInDirection); - static void switchToWindow(PHLWINDOW PWINDOWTOCHANGETO); - static uint64_t spawnRawProc(std::string, PHLWORKSPACE pInitialWorkspace); - static uint64_t spawnWithRules(std::string, PHLWORKSPACE pInitialWorkspace); + static bool tryMoveFocusToMonitor(PHLMONITOR monitor); + static void moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string& dir = ""); + static void moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowInDirection); + static void switchToWindow(PHLWINDOW PWINDOWTOCHANGETO); + static uint64_t spawnRawProc(std::string, PHLWORKSPACE pInitialWorkspace); + static uint64_t spawnWithRules(std::string, PHLWORKSPACE pInitialWorkspace); // -------------- Dispatchers -------------- // static SDispatchResult killActive(std::string); diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index bc73d2cc..36c8144d 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -163,7 +163,7 @@ class CInputManager { std::list m_lSwitches; // Exclusive layer surfaces - std::deque m_dExclusiveLSes; + std::vector m_dExclusiveLSes; // constraints std::vector> m_vConstraints; -- cgit v1.2.3