summaryrefslogtreecommitdiff
path: root/src/xwayland
diff options
context:
space:
mode:
Diffstat (limited to 'src/xwayland')
-rw-r--r--src/xwayland/Dnd.cpp2
-rw-r--r--src/xwayland/XWM.cpp4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/xwayland/Dnd.cpp b/src/xwayland/Dnd.cpp
index 58fc6db3..d4ae3780 100644
--- a/src/xwayland/Dnd.cpp
+++ b/src/xwayland/Dnd.cpp
@@ -75,6 +75,8 @@ void CX11DataDevice::sendEnter(uint32_t serial, SP<CWLSurfaceResource> surf, con
data.data32[1] |= 1;
std::vector<xcb_atom_t> targets;
+ // reserve to avoid reallocations
+ targets.reserve(SOURCE->mimes().size());
for (auto& mime : SOURCE->mimes()) {
targets.emplace_back(g_pXWayland->pWM->mimeToAtom(mime));
diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp
index 44485381..ae8e0ccc 100644
--- a/src/xwayland/XWM.cpp
+++ b/src/xwayland/XWM.cpp
@@ -643,6 +643,8 @@ void CXWM::handleSelectionRequest(xcb_selection_request_event_t* e) {
Debug::log(WARN, "[xwm] WARNING: No mimes in TARGETS?");
std::vector<xcb_atom_t> atoms;
+ // reserve to avoid reallocations
+ atoms.reserve(mimes.size() + 2);
atoms.push_back(HYPRATOMS["TIMESTAMP"]);
atoms.push_back(HYPRATOMS["TARGETS"]);
@@ -989,6 +991,8 @@ void CXWM::sendState(SP<CXWaylandSurface> surf) {
}
std::vector<uint32_t> props;
+ // reserve to avoid reallocations
+ props.reserve(6); // props below
if (surf->modal)
props.push_back(HYPRATOMS["_NET_WM_STATE_MODAL"]);
if (surf->fullscreen)