mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-22 13:35:57 +01:00
use deques for volatile arrays for no reallocs on pushes
This commit is contained in:
parent
05670e34f7
commit
1932214bdb
3 changed files with 9 additions and 13 deletions
|
@ -381,9 +381,7 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
|
|||
}
|
||||
|
||||
CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
|
||||
|
||||
// Not const because we realloc the array later
|
||||
auto PWINDOWINARR = g_pWindowManager->getWindowFromDrawable(windowID);
|
||||
const auto PWINDOWINARR = g_pWindowManager->getWindowFromDrawable(windowID);
|
||||
|
||||
if (!PWINDOWINARR) {
|
||||
Debug::log(ERR, "remapWindow called with an invalid window!");
|
||||
|
@ -496,9 +494,6 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
|
|||
PLASTWINDOW->setParentNodeID(newWindowSplitNode.getDrawable());
|
||||
|
||||
g_pWindowManager->addWindowToVectorSafe(newWindowSplitNode);
|
||||
|
||||
// The array got reallocated, let's update the pointer
|
||||
PWINDOWINARR = g_pWindowManager->getWindowFromDrawable(windowID);
|
||||
} else {
|
||||
PWINDOWINARR->setParentNodeID(0);
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ void CWindowManager::recieveEvent() {
|
|||
}
|
||||
|
||||
void CWindowManager::cleanupUnusedWorkspaces() {
|
||||
std::vector<CWorkspace> temp = workspaces;
|
||||
std::deque<CWorkspace> temp = workspaces;
|
||||
|
||||
workspaces.clear();
|
||||
|
||||
|
@ -608,7 +608,7 @@ void CWindowManager::removeWindowFromVectorSafe(int64_t window) {
|
|||
if (!window)
|
||||
return;
|
||||
|
||||
std::vector<CWindow> temp = windows;
|
||||
std::deque<CWindow> temp = windows;
|
||||
|
||||
windows.clear();
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <vector>
|
||||
#include <thread>
|
||||
#include <xcb/xcb.h>
|
||||
#include <deque>
|
||||
|
||||
#include "KeybindManager.hpp"
|
||||
#include "utilities/Workspace.hpp"
|
||||
|
@ -40,12 +41,12 @@ public:
|
|||
xcb_visualtype_t* VisualType;
|
||||
xcb_colormap_t Colormap;
|
||||
|
||||
std::vector<CWindow> windows; // windows never left. It has always been hiding amongst us.
|
||||
std::vector<CWindow> unmappedWindows;
|
||||
std::deque<CWindow> windows; // windows never left. It has always been hiding amongst us.
|
||||
std::deque<CWindow> unmappedWindows;
|
||||
xcb_drawable_t LastWindow = -1;
|
||||
|
||||
std::vector<CWorkspace> workspaces;
|
||||
std::vector<int> activeWorkspaces;
|
||||
std::deque<CWorkspace> workspaces;
|
||||
std::deque<int> activeWorkspaces;
|
||||
|
||||
// Pipes
|
||||
SIPCPipe m_sIPCBarPipeIn = {ISDEBUG ? "/tmp/hypr/hyprbarind" : "/tmp/hypr/hyprbarin", 0};
|
||||
|
@ -55,7 +56,7 @@ public:
|
|||
uint64_t barWindowID = 0;
|
||||
GThread* barThread; /* Well right now anything but the bar but lol */
|
||||
|
||||
std::vector<CTrayClient> trayclients;
|
||||
std::deque<CTrayClient> trayclients;
|
||||
|
||||
bool mainThreadBusy = false;
|
||||
bool animationUtilBusy = false;
|
||||
|
|
Loading…
Reference in a new issue