mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-26 06:45:58 +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) {
|
CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
|
||||||
|
const auto PWINDOWINARR = g_pWindowManager->getWindowFromDrawable(windowID);
|
||||||
// Not const because we realloc the array later
|
|
||||||
auto PWINDOWINARR = g_pWindowManager->getWindowFromDrawable(windowID);
|
|
||||||
|
|
||||||
if (!PWINDOWINARR) {
|
if (!PWINDOWINARR) {
|
||||||
Debug::log(ERR, "remapWindow called with an invalid window!");
|
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());
|
PLASTWINDOW->setParentNodeID(newWindowSplitNode.getDrawable());
|
||||||
|
|
||||||
g_pWindowManager->addWindowToVectorSafe(newWindowSplitNode);
|
g_pWindowManager->addWindowToVectorSafe(newWindowSplitNode);
|
||||||
|
|
||||||
// The array got reallocated, let's update the pointer
|
|
||||||
PWINDOWINARR = g_pWindowManager->getWindowFromDrawable(windowID);
|
|
||||||
} else {
|
} else {
|
||||||
PWINDOWINARR->setParentNodeID(0);
|
PWINDOWINARR->setParentNodeID(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@ void CWindowManager::recieveEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindowManager::cleanupUnusedWorkspaces() {
|
void CWindowManager::cleanupUnusedWorkspaces() {
|
||||||
std::vector<CWorkspace> temp = workspaces;
|
std::deque<CWorkspace> temp = workspaces;
|
||||||
|
|
||||||
workspaces.clear();
|
workspaces.clear();
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ void CWindowManager::removeWindowFromVectorSafe(int64_t window) {
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector<CWindow> temp = windows;
|
std::deque<CWindow> temp = windows;
|
||||||
|
|
||||||
windows.clear();
|
windows.clear();
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
#include "KeybindManager.hpp"
|
#include "KeybindManager.hpp"
|
||||||
#include "utilities/Workspace.hpp"
|
#include "utilities/Workspace.hpp"
|
||||||
|
@ -40,12 +41,12 @@ public:
|
||||||
xcb_visualtype_t* VisualType;
|
xcb_visualtype_t* VisualType;
|
||||||
xcb_colormap_t Colormap;
|
xcb_colormap_t Colormap;
|
||||||
|
|
||||||
std::vector<CWindow> windows; // windows never left. It has always been hiding amongst us.
|
std::deque<CWindow> windows; // windows never left. It has always been hiding amongst us.
|
||||||
std::vector<CWindow> unmappedWindows;
|
std::deque<CWindow> unmappedWindows;
|
||||||
xcb_drawable_t LastWindow = -1;
|
xcb_drawable_t LastWindow = -1;
|
||||||
|
|
||||||
std::vector<CWorkspace> workspaces;
|
std::deque<CWorkspace> workspaces;
|
||||||
std::vector<int> activeWorkspaces;
|
std::deque<int> activeWorkspaces;
|
||||||
|
|
||||||
// Pipes
|
// Pipes
|
||||||
SIPCPipe m_sIPCBarPipeIn = {ISDEBUG ? "/tmp/hypr/hyprbarind" : "/tmp/hypr/hyprbarin", 0};
|
SIPCPipe m_sIPCBarPipeIn = {ISDEBUG ? "/tmp/hypr/hyprbarind" : "/tmp/hypr/hyprbarin", 0};
|
||||||
|
@ -55,7 +56,7 @@ public:
|
||||||
uint64_t barWindowID = 0;
|
uint64_t barWindowID = 0;
|
||||||
GThread* barThread; /* Well right now anything but the bar but lol */
|
GThread* barThread; /* Well right now anything but the bar but lol */
|
||||||
|
|
||||||
std::vector<CTrayClient> trayclients;
|
std::deque<CTrayClient> trayclients;
|
||||||
|
|
||||||
bool mainThreadBusy = false;
|
bool mainThreadBusy = false;
|
||||||
bool animationUtilBusy = false;
|
bool animationUtilBusy = false;
|
||||||
|
|
Loading…
Reference in a new issue