core: move all shared_ptrs from the STL to hyprutils (#9143)
This commit is contained in:
parent
ae403e6a05
commit
0a1ae48a9f
152 changed files with 297 additions and 349 deletions
|
|
@ -442,7 +442,7 @@ int CXWaylandServer::ready(int fd, uint32_t mask) {
|
|||
|
||||
// start the wm
|
||||
if (!g_pXWayland->pWM)
|
||||
g_pXWayland->pWM = std::make_unique<CXWM>();
|
||||
g_pXWayland->pWM = makeUnique<CXWM>();
|
||||
|
||||
g_pCursorManager->setXWaylandCursor();
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void CXDataSource::send(const std::string& mime, uint32_t fd) {
|
|||
|
||||
Debug::log(LOG, "[XDataSource] send with mime {} to fd {}", mime, fd);
|
||||
|
||||
selection.transfer = std::make_unique<SXTransfer>(selection);
|
||||
selection.transfer = makeUnique<SXTransfer>(selection);
|
||||
selection.transfer->incomingWindow = xcb_generate_id(g_pXWayland->pWM->connection);
|
||||
const uint32_t MASK = XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE;
|
||||
xcb_create_window(g_pXWayland->pWM->connection, XCB_COPY_FROM_PARENT, selection.transfer->incomingWindow, g_pXWayland->pWM->screen->root, 0, 0, 10, 10, 0,
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_
|
|||
}
|
||||
} else if (atom == HYPRATOMS["WM_HINTS"]) {
|
||||
if (reply->value_len != 0) {
|
||||
XSURF->hints = std::make_unique<xcb_icccm_wm_hints_t>();
|
||||
XSURF->hints = makeUnique<xcb_icccm_wm_hints_t>();
|
||||
xcb_icccm_get_wm_hints_from_reply(XSURF->hints.get(), reply);
|
||||
|
||||
if (!(XSURF->hints->flags & XCB_ICCCM_WM_HINT_INPUT))
|
||||
|
|
@ -254,7 +254,7 @@ void CXWM::readProp(SP<CXWaylandSurface> XSURF, uint32_t atom, xcb_get_property_
|
|||
}
|
||||
} else if (atom == HYPRATOMS["WM_NORMAL_HINTS"]) {
|
||||
if (reply->type == HYPRATOMS["WM_SIZE_HINTS"] && reply->value_len > 0) {
|
||||
XSURF->sizeHints = std::make_unique<xcb_size_hints_t>();
|
||||
XSURF->sizeHints = makeUnique<xcb_size_hints_t>();
|
||||
std::memset(XSURF->sizeHints.get(), 0, sizeof(xcb_size_hints_t));
|
||||
|
||||
xcb_icccm_get_wm_size_hints_from_reply(XSURF->sizeHints.get(), reply);
|
||||
|
|
@ -735,7 +735,7 @@ int CXWM::onEvent(int fd, uint32_t mask) {
|
|||
g_pXWayland->pWM.reset();
|
||||
g_pXWayland->pServer.reset();
|
||||
// Attempt to create fresh instance
|
||||
g_pEventLoopManager->doLater([]() { g_pXWayland = std::make_unique<CXWayland>(true); });
|
||||
g_pEventLoopManager->doLater([]() { g_pXWayland = makeUnique<CXWayland>(true); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1346,7 +1346,7 @@ bool SXSelection::sendData(xcb_selection_request_event_t* e, std::string mime) {
|
|||
mime = *MIMES.begin();
|
||||
}
|
||||
|
||||
transfer = std::make_unique<SXTransfer>(*this);
|
||||
transfer = makeUnique<SXTransfer>(*this);
|
||||
transfer->request = *e;
|
||||
|
||||
int p[2];
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ struct SXSelection {
|
|||
CHyprSignalListener keyboardFocusChange;
|
||||
} listeners;
|
||||
|
||||
std::unique_ptr<SXTransfer> transfer;
|
||||
UP<SXTransfer> transfer;
|
||||
};
|
||||
|
||||
class CXCBConnection {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ CXWayland::CXWayland(const bool wantsEnabled) {
|
|||
|
||||
Debug::log(LOG, "Starting up the XWayland server");
|
||||
|
||||
pServer = std::make_unique<CXWaylandServer>();
|
||||
pServer = makeUnique<CXWaylandServer>();
|
||||
|
||||
if (!pServer->create()) {
|
||||
Debug::log(ERR, "XWayland failed to start: it will not work.");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "../helpers/signal/Signal.hpp"
|
||||
#include "../helpers/memory/Memory.hpp"
|
||||
#include "../macros.hpp"
|
||||
|
|
@ -20,8 +19,8 @@ class CXWayland {
|
|||
CXWayland(const bool wantsEnabled);
|
||||
|
||||
#ifndef NO_XWAYLAND
|
||||
std::unique_ptr<CXWaylandServer> pServer;
|
||||
std::unique_ptr<CXWM> pWM;
|
||||
UP<CXWaylandServer> pServer;
|
||||
UP<CXWM> pWM;
|
||||
#endif
|
||||
bool enabled();
|
||||
|
||||
|
|
@ -35,7 +34,7 @@ class CXWayland {
|
|||
bool m_enabled = false;
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CXWayland> g_pXWayland;
|
||||
inline UP<CXWayland> g_pXWayland;
|
||||
|
||||
inline std::unordered_map<std::string, uint32_t> HYPRATOMS = {
|
||||
#ifndef NO_XWAYLAND
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue