diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-01-23 21:55:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-23 21:55:41 +0100 |
| commit | 0a1ae48a9fd6eb76baad27de98c00f653a55e4ac (patch) | |
| tree | 007cd36eb83d343d2aba49cf0741028c5f554895 /src/managers | |
| parent | ae403e6a05452336abd97e61be2706f6a930d827 (diff) | |
core: move all shared_ptrs from the STL to hyprutils (#9143)
Diffstat (limited to 'src/managers')
23 files changed, 101 insertions, 102 deletions
diff --git a/src/managers/AnimationManager.hpp b/src/managers/AnimationManager.hpp index 10eeef05..067fa676 100644 --- a/src/managers/AnimationManager.hpp +++ b/src/managers/AnimationManager.hpp @@ -61,4 +61,4 @@ class CHyprAnimationManager : public Hyprutils::Animation::CAnimationManager { void animationSlide(PHLWINDOW, std::string force = "", bool close = false); }; -inline std::unique_ptr<CHyprAnimationManager> g_pAnimationManager; +inline UP<CHyprAnimationManager> g_pAnimationManager; diff --git a/src/managers/CursorManager.cpp b/src/managers/CursorManager.cpp index d6584f35..160ef2eb 100644 --- a/src/managers/CursorManager.cpp +++ b/src/managers/CursorManager.cpp @@ -64,8 +64,8 @@ void CCursorBuffer::endDataPtr() { } CCursorManager::CCursorManager() { - m_pHyprcursor = std::make_unique<Hyprcursor::CHyprcursorManager>(m_szTheme.empty() ? nullptr : m_szTheme.c_str(), hcLogger); - m_pXcursor = std::make_unique<CXCursorManager>(); + m_pHyprcursor = makeUnique<Hyprcursor::CHyprcursorManager>(m_szTheme.empty() ? nullptr : m_szTheme.c_str(), hcLogger); + m_pXcursor = makeUnique<CXCursorManager>(); static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor"); if (m_pHyprcursor->valid() && *PUSEHYPRCURSOR) { @@ -323,7 +323,7 @@ bool CCursorManager::changeTheme(const std::string& name, const int size) { m_szTheme = name.empty() ? "" : name; m_iSize = size; - m_pHyprcursor = std::make_unique<Hyprcursor::CHyprcursorManager>(m_szTheme.empty() ? nullptr : m_szTheme.c_str(), options); + m_pHyprcursor = makeUnique<Hyprcursor::CHyprcursorManager>(m_szTheme.empty() ? nullptr : m_szTheme.c_str(), options); if (!m_pHyprcursor->valid()) { Debug::log(ERR, "Hyprcursor failed loading theme \"{}\", falling back to XCursor.", m_szTheme); m_pXcursor->loadTheme(m_szTheme.empty() ? xcursor_theme : m_szTheme, m_iSize, m_fCursorScale); diff --git a/src/managers/CursorManager.hpp b/src/managers/CursorManager.hpp index 796ab10e..c5ded5da 100644 --- a/src/managers/CursorManager.hpp +++ b/src/managers/CursorManager.hpp @@ -2,7 +2,6 @@ #include <string> #include <hyprcursor/hyprcursor.hpp> -#include <memory> #include "../includes.hpp" #include "../helpers/math/Math.hpp" #include "../helpers/memory/Memory.hpp" @@ -58,22 +57,22 @@ class CCursorManager { void tickAnimatedCursor(); private: - bool m_bOurBufferConnected = false; - std::vector<SP<CCursorBuffer>> m_vCursorBuffers; + bool m_bOurBufferConnected = false; + std::vector<SP<CCursorBuffer>> m_vCursorBuffers; - std::unique_ptr<Hyprcursor::CHyprcursorManager> m_pHyprcursor; - std::unique_ptr<CXCursorManager> m_pXcursor; - SP<SXCursors> m_currentXcursor; + UP<Hyprcursor::CHyprcursorManager> m_pHyprcursor; + UP<CXCursorManager> m_pXcursor; + SP<SXCursors> m_currentXcursor; - std::string m_szTheme = ""; - int m_iSize = 0; - float m_fCursorScale = 1.0; + std::string m_szTheme = ""; + int m_iSize = 0; + float m_fCursorScale = 1.0; - Hyprcursor::SCursorStyleInfo m_sCurrentStyleInfo; + Hyprcursor::SCursorStyleInfo m_sCurrentStyleInfo; - SP<CEventLoopTimer> m_pAnimationTimer; - int m_iCurrentAnimationFrame = 0; - Hyprcursor::SCursorShapeData m_sCurrentCursorShapeData; + SP<CEventLoopTimer> m_pAnimationTimer; + int m_iCurrentAnimationFrame = 0; + Hyprcursor::SCursorShapeData m_sCurrentCursorShapeData; }; -inline std::unique_ptr<CCursorManager> g_pCursorManager; +inline UP<CCursorManager> g_pCursorManager; diff --git a/src/managers/DonationNagManager.hpp b/src/managers/DonationNagManager.hpp index e296d815..357f979f 100644 --- a/src/managers/DonationNagManager.hpp +++ b/src/managers/DonationNagManager.hpp @@ -1,6 +1,6 @@ #pragma once -#include <memory> +#include "../helpers/memory/Memory.hpp" class CDonationNagManager { public: @@ -13,4 +13,4 @@ class CDonationNagManager { bool m_bFired = false; }; -inline std::unique_ptr<CDonationNagManager> g_pDonationNagManager;
\ No newline at end of file +inline UP<CDonationNagManager> g_pDonationNagManager;
\ No newline at end of file diff --git a/src/managers/EventManager.hpp b/src/managers/EventManager.hpp index 37716e63..5a88963e 100644 --- a/src/managers/EventManager.hpp +++ b/src/managers/EventManager.hpp @@ -42,4 +42,4 @@ class CEventManager { std::vector<SClient> m_vClients; }; -inline std::unique_ptr<CEventManager> g_pEventManager; +inline UP<CEventManager> g_pEventManager; diff --git a/src/managers/HookSystemManager.hpp b/src/managers/HookSystemManager.hpp index 5a9d0c00..6d72a02d 100644 --- a/src/managers/HookSystemManager.hpp +++ b/src/managers/HookSystemManager.hpp @@ -57,4 +57,4 @@ class CHookSystemManager { std::unordered_map<std::string, std::vector<SCallbackFNPtr>> m_mRegisteredHooks; }; -inline std::unique_ptr<CHookSystemManager> g_pHookSystem; +inline UP<CHookSystemManager> g_pHookSystem; diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 0816de2a..f4a55a73 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -2840,7 +2840,7 @@ void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowIn pWindow->warpCursor(); if (!pWindow->getDecorationByType(DECORATION_GROUPBAR)) - pWindow->addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(pWindow)); + pWindow->addWindowDeco(makeUnique<CHyprGroupBarDecoration>(pWindow)); g_pEventManager->postEvent(SHyprIPCEvent{"moveintogroup", std::format("{:x}", (uintptr_t)pWindow.get())}); } diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index d01ec75b..1848ca78 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -229,4 +229,4 @@ class CKeybindManager { friend class CPointerManager; }; -inline std::unique_ptr<CKeybindManager> g_pKeybindManager; +inline UP<CKeybindManager> g_pKeybindManager; diff --git a/src/managers/LayoutManager.hpp b/src/managers/LayoutManager.hpp index 6042b3b2..63e54baa 100644 --- a/src/managers/LayoutManager.hpp +++ b/src/managers/LayoutManager.hpp @@ -28,4 +28,4 @@ class CLayoutManager { std::vector<std::pair<std::string, IHyprLayout*>> m_vLayouts; }; -inline std::unique_ptr<CLayoutManager> g_pLayoutManager; +inline UP<CLayoutManager> g_pLayoutManager; diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp index 8e32bdec..f73a6d3c 100644 --- a/src/managers/ProtocolManager.cpp +++ b/src/managers/ProtocolManager.cpp @@ -119,75 +119,75 @@ CProtocolManager::CProtocolManager() { }); // Core - PROTO::seat = std::make_unique<CWLSeatProtocol>(&wl_seat_interface, 9, "WLSeat"); - PROTO::data = std::make_unique<CWLDataDeviceProtocol>(&wl_data_device_manager_interface, 3, "WLDataDevice"); - PROTO::compositor = std::make_unique<CWLCompositorProtocol>(&wl_compositor_interface, 6, "WLCompositor"); - PROTO::subcompositor = std::make_unique<CWLSubcompositorProtocol>(&wl_subcompositor_interface, 1, "WLSubcompositor"); - PROTO::shm = std::make_unique<CWLSHMProtocol>(&wl_shm_interface, 1, "WLSHM"); + PROTO::seat = makeUnique<CWLSeatProtocol>(&wl_seat_interface, 9, "WLSeat"); + PROTO::data = makeUnique<CWLDataDeviceProtocol>(&wl_data_device_manager_interface, 3, "WLDataDevice"); + PROTO::compositor = makeUnique<CWLCompositorProtocol>(&wl_compositor_interface, 6, "WLCompositor"); + PROTO::subcompositor = makeUnique<CWLSubcompositorProtocol>(&wl_subcompositor_interface, 1, "WLSubcompositor"); + PROTO::shm = makeUnique<CWLSHMProtocol>(&wl_shm_interface, 1, "WLSHM"); // Extensions - PROTO::viewport = std::make_unique<CViewporterProtocol>(&wp_viewporter_interface, 1, "Viewporter"); - PROTO::tearing = std::make_unique<CTearingControlProtocol>(&wp_tearing_control_manager_v1_interface, 1, "TearingControl"); - PROTO::fractional = std::make_unique<CFractionalScaleProtocol>(&wp_fractional_scale_manager_v1_interface, 1, "FractionalScale"); - PROTO::xdgOutput = std::make_unique<CXDGOutputProtocol>(&zxdg_output_manager_v1_interface, 3, "XDGOutput"); - PROTO::cursorShape = std::make_unique<CCursorShapeProtocol>(&wp_cursor_shape_manager_v1_interface, 1, "CursorShape"); - PROTO::idleInhibit = std::make_unique<CIdleInhibitProtocol>(&zwp_idle_inhibit_manager_v1_interface, 1, "IdleInhibit"); - PROTO::relativePointer = std::make_unique<CRelativePointerProtocol>(&zwp_relative_pointer_manager_v1_interface, 1, "RelativePointer"); - PROTO::xdgDecoration = std::make_unique<CXDGDecorationProtocol>(&zxdg_decoration_manager_v1_interface, 1, "XDGDecoration"); - PROTO::alphaModifier = std::make_unique<CAlphaModifierProtocol>(&wp_alpha_modifier_v1_interface, 1, "AlphaModifier"); - PROTO::gamma = std::make_unique<CGammaControlProtocol>(&zwlr_gamma_control_manager_v1_interface, 1, "GammaControl"); - PROTO::foreignToplevel = std::make_unique<CForeignToplevelProtocol>(&ext_foreign_toplevel_list_v1_interface, 1, "ForeignToplevel"); - PROTO::pointerGestures = std::make_unique<CPointerGesturesProtocol>(&zwp_pointer_gestures_v1_interface, 3, "PointerGestures"); - PROTO::foreignToplevelWlr = std::make_unique<CForeignToplevelWlrProtocol>(&zwlr_foreign_toplevel_manager_v1_interface, 3, "ForeignToplevelWlr"); - PROTO::shortcutsInhibit = std::make_unique<CKeyboardShortcutsInhibitProtocol>(&zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1, "ShortcutsInhibit"); - PROTO::textInputV1 = std::make_unique<CTextInputV1Protocol>(&zwp_text_input_manager_v1_interface, 1, "TextInputV1"); - PROTO::textInputV3 = std::make_unique<CTextInputV3Protocol>(&zwp_text_input_manager_v3_interface, 1, "TextInputV3"); - PROTO::constraints = std::make_unique<CPointerConstraintsProtocol>(&zwp_pointer_constraints_v1_interface, 1, "PointerConstraints"); - PROTO::outputPower = std::make_unique<COutputPowerProtocol>(&zwlr_output_power_manager_v1_interface, 1, "OutputPower"); - PROTO::activation = std::make_unique<CXDGActivationProtocol>(&xdg_activation_v1_interface, 1, "XDGActivation"); - PROTO::idle = std::make_unique<CIdleNotifyProtocol>(&ext_idle_notifier_v1_interface, 1, "IdleNotify"); - PROTO::lockNotify = std::make_unique<CLockNotifyProtocol>(&hyprland_lock_notifier_v1_interface, 1, "IdleNotify"); - PROTO::sessionLock = std::make_unique<CSessionLockProtocol>(&ext_session_lock_manager_v1_interface, 1, "SessionLock"); - PROTO::ime = std::make_unique<CInputMethodV2Protocol>(&zwp_input_method_manager_v2_interface, 1, "IMEv2"); - PROTO::virtualKeyboard = std::make_unique<CVirtualKeyboardProtocol>(&zwp_virtual_keyboard_manager_v1_interface, 1, "VirtualKeyboard"); - PROTO::virtualPointer = std::make_unique<CVirtualPointerProtocol>(&zwlr_virtual_pointer_manager_v1_interface, 2, "VirtualPointer"); - PROTO::outputManagement = std::make_unique<COutputManagementProtocol>(&zwlr_output_manager_v1_interface, 4, "OutputManagement"); - PROTO::serverDecorationKDE = std::make_unique<CServerDecorationKDEProtocol>(&org_kde_kwin_server_decoration_manager_interface, 1, "ServerDecorationKDE"); - PROTO::focusGrab = std::make_unique<CFocusGrabProtocol>(&hyprland_focus_grab_manager_v1_interface, 1, "FocusGrab"); - PROTO::tablet = std::make_unique<CTabletV2Protocol>(&zwp_tablet_manager_v2_interface, 1, "TabletV2"); - PROTO::layerShell = std::make_unique<CLayerShellProtocol>(&zwlr_layer_shell_v1_interface, 5, "LayerShell"); - PROTO::presentation = std::make_unique<CPresentationProtocol>(&wp_presentation_interface, 1, "Presentation"); - PROTO::xdgShell = std::make_unique<CXDGShellProtocol>(&xdg_wm_base_interface, 6, "XDGShell"); - PROTO::dataWlr = std::make_unique<CDataDeviceWLRProtocol>(&zwlr_data_control_manager_v1_interface, 2, "DataDeviceWlr"); - PROTO::primarySelection = std::make_unique<CPrimarySelectionProtocol>(&zwp_primary_selection_device_manager_v1_interface, 1, "PrimarySelection"); - PROTO::xwaylandShell = std::make_unique<CXWaylandShellProtocol>(&xwayland_shell_v1_interface, 1, "XWaylandShell"); - PROTO::screencopy = std::make_unique<CScreencopyProtocol>(&zwlr_screencopy_manager_v1_interface, 3, "Screencopy"); - PROTO::toplevelExport = std::make_unique<CToplevelExportProtocol>(&hyprland_toplevel_export_manager_v1_interface, 2, "ToplevelExport"); - PROTO::globalShortcuts = std::make_unique<CGlobalShortcutsProtocol>(&hyprland_global_shortcuts_manager_v1_interface, 1, "GlobalShortcuts"); - PROTO::xdgDialog = std::make_unique<CXDGDialogProtocol>(&xdg_dialog_v1_interface, 1, "XDGDialog"); - PROTO::singlePixel = std::make_unique<CSinglePixelProtocol>(&wp_single_pixel_buffer_manager_v1_interface, 1, "SinglePixel"); - PROTO::securityContext = std::make_unique<CSecurityContextProtocol>(&wp_security_context_manager_v1_interface, 1, "SecurityContext"); - PROTO::ctm = std::make_unique<CHyprlandCTMControlProtocol>(&hyprland_ctm_control_manager_v1_interface, 1, "CTMControl"); - PROTO::hyprlandSurface = std::make_unique<CHyprlandSurfaceProtocol>(&hyprland_surface_manager_v1_interface, 1, "HyprlandSurface"); + PROTO::viewport = makeUnique<CViewporterProtocol>(&wp_viewporter_interface, 1, "Viewporter"); + PROTO::tearing = makeUnique<CTearingControlProtocol>(&wp_tearing_control_manager_v1_interface, 1, "TearingControl"); + PROTO::fractional = makeUnique<CFractionalScaleProtocol>(&wp_fractional_scale_manager_v1_interface, 1, "FractionalScale"); + PROTO::xdgOutput = makeUnique<CXDGOutputProtocol>(&zxdg_output_manager_v1_interface, 3, "XDGOutput"); + PROTO::cursorShape = makeUnique<CCursorShapeProtocol>(&wp_cursor_shape_manager_v1_interface, 1, "CursorShape"); + PROTO::idleInhibit = makeUnique<CIdleInhibitProtocol>(&zwp_idle_inhibit_manager_v1_interface, 1, "IdleInhibit"); + PROTO::relativePointer = makeUnique<CRelativePointerProtocol>(&zwp_relative_pointer_manager_v1_interface, 1, "RelativePointer"); + PROTO::xdgDecoration = makeUnique<CXDGDecorationProtocol>(&zxdg_decoration_manager_v1_interface, 1, "XDGDecoration"); + PROTO::alphaModifier = makeUnique<CAlphaModifierProtocol>(&wp_alpha_modifier_v1_interface, 1, "AlphaModifier"); + PROTO::gamma = makeUnique<CGammaControlProtocol>(&zwlr_gamma_control_manager_v1_interface, 1, "GammaControl"); + PROTO::foreignToplevel = makeUnique<CForeignToplevelProtocol>(&ext_foreign_toplevel_list_v1_interface, 1, "ForeignToplevel"); + PROTO::pointerGestures = makeUnique<CPointerGesturesProtocol>(&zwp_pointer_gestures_v1_interface, 3, "PointerGestures"); + PROTO::foreignToplevelWlr = makeUnique<CForeignToplevelWlrProtocol>(&zwlr_foreign_toplevel_manager_v1_interface, 3, "ForeignToplevelWlr"); + PROTO::shortcutsInhibit = makeUnique<CKeyboardShortcutsInhibitProtocol>(&zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1, "ShortcutsInhibit"); + PROTO::textInputV1 = makeUnique<CTextInputV1Protocol>(&zwp_text_input_manager_v1_interface, 1, "TextInputV1"); + PROTO::textInputV3 = makeUnique<CTextInputV3Protocol>(&zwp_text_input_manager_v3_interface, 1, "TextInputV3"); + PROTO::constraints = makeUnique<CPointerConstraintsProtocol>(&zwp_pointer_constraints_v1_interface, 1, "PointerConstraints"); + PROTO::outputPower = makeUnique<COutputPowerProtocol>(&zwlr_output_power_manager_v1_interface, 1, "OutputPower"); + PROTO::activation = makeUnique<CXDGActivationProtocol>(&xdg_activation_v1_interface, 1, "XDGActivation"); + PROTO::idle = makeUnique<CIdleNotifyProtocol>(&ext_idle_notifier_v1_interface, 1, "IdleNotify"); + PROTO::lockNotify = makeUnique<CLockNotifyProtocol>(&hyprland_lock_notifier_v1_interface, 1, "IdleNotify"); + PROTO::sessionLock = makeUnique<CSessionLockProtocol>(&ext_session_lock_manager_v1_interface, 1, "SessionLock"); + PROTO::ime = makeUnique<CInputMethodV2Protocol>(&zwp_input_method_manager_v2_interface, 1, "IMEv2"); + PROTO::virtualKeyboard = makeUnique<CVirtualKeyboardProtocol>(&zwp_virtual_keyboard_manager_v1_interface, 1, "VirtualKeyboard"); + PROTO::virtualPointer = makeUnique<CVirtualPointerProtocol>(&zwlr_virtual_pointer_manager_v1_interface, 2, "VirtualPointer"); + PROTO::outputManagement = makeUnique<COutputManagementProtocol>(&zwlr_output_manager_v1_interface, 4, "OutputManagement"); + PROTO::serverDecorationKDE = makeUnique<CServerDecorationKDEProtocol>(&org_kde_kwin_server_decoration_manager_interface, 1, "ServerDecorationKDE"); + PROTO::focusGrab = makeUnique<CFocusGrabProtocol>(&hyprland_focus_grab_manager_v1_interface, 1, "FocusGrab"); + PROTO::tablet = makeUnique<CTabletV2Protocol>(&zwp_tablet_manager_v2_interface, 1, "TabletV2"); + PROTO::layerShell = makeUnique<CLayerShellProtocol>(&zwlr_layer_shell_v1_interface, 5, "LayerShell"); + PROTO::presentation = makeUnique<CPresentationProtocol>(&wp_presentation_interface, 1, "Presentation"); + PROTO::xdgShell = makeUnique<CXDGShellProtocol>(&xdg_wm_base_interface, 6, "XDGShell"); + PROTO::dataWlr = makeUnique<CDataDeviceWLRProtocol>(&zwlr_data_control_manager_v1_interface, 2, "DataDeviceWlr"); + PROTO::primarySelection = makeUnique<CPrimarySelectionProtocol>(&zwp_primary_selection_device_manager_v1_interface, 1, "PrimarySelection"); + PROTO::xwaylandShell = makeUnique<CXWaylandShellProtocol>(&xwayland_shell_v1_interface, 1, "XWaylandShell"); + PROTO::screencopy = makeUnique<CScreencopyProtocol>(&zwlr_screencopy_manager_v1_interface, 3, "Screencopy"); + PROTO::toplevelExport = makeUnique<CToplevelExportProtocol>(&hyprland_toplevel_export_manager_v1_interface, 2, "ToplevelExport"); + PROTO::globalShortcuts = makeUnique<CGlobalShortcutsProtocol>(&hyprland_global_shortcuts_manager_v1_interface, 1, "GlobalShortcuts"); + PROTO::xdgDialog = makeUnique<CXDGDialogProtocol>(&xdg_dialog_v1_interface, 1, "XDGDialog"); + PROTO::singlePixel = makeUnique<CSinglePixelProtocol>(&wp_single_pixel_buffer_manager_v1_interface, 1, "SinglePixel"); + PROTO::securityContext = makeUnique<CSecurityContextProtocol>(&wp_security_context_manager_v1_interface, 1, "SecurityContext"); + PROTO::ctm = makeUnique<CHyprlandCTMControlProtocol>(&hyprland_ctm_control_manager_v1_interface, 1, "CTMControl"); + PROTO::hyprlandSurface = makeUnique<CHyprlandSurfaceProtocol>(&hyprland_surface_manager_v1_interface, 1, "HyprlandSurface"); if (*PENABLEXXCM) { - PROTO::colorManagement = std::make_unique<CColorManagementProtocol>(&xx_color_manager_v4_interface, 1, "ColorManagement"); - PROTO::frogColorManagement = std::make_unique<CFrogColorManagementProtocol>(&frog_color_management_factory_v1_interface, 1, "FrogColorManagement"); + PROTO::colorManagement = makeUnique<CColorManagementProtocol>(&xx_color_manager_v4_interface, 1, "ColorManagement"); + PROTO::frogColorManagement = makeUnique<CFrogColorManagementProtocol>(&frog_color_management_factory_v1_interface, 1, "FrogColorManagement"); } for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) { if (b->type() != Aquamarine::AQ_BACKEND_DRM) continue; - PROTO::lease = std::make_unique<CDRMLeaseProtocol>(&wp_drm_lease_device_v1_interface, 1, "DRMLease"); + PROTO::lease = makeUnique<CDRMLeaseProtocol>(&wp_drm_lease_device_v1_interface, 1, "DRMLease"); if (*PENABLEEXPLICIT) - PROTO::sync = std::make_unique<CDRMSyncobjProtocol>(&wp_linux_drm_syncobj_manager_v1_interface, 1, "DRMSyncobj"); + PROTO::sync = makeUnique<CDRMSyncobjProtocol>(&wp_linux_drm_syncobj_manager_v1_interface, 1, "DRMSyncobj"); break; } if (g_pHyprOpenGL->getDRMFormats().size() > 0) { - PROTO::mesaDRM = std::make_unique<CMesaDRMProtocol>(&wl_drm_interface, 2, "MesaDRM"); - PROTO::linuxDma = std::make_unique<CLinuxDMABufV1Protocol>(&zwp_linux_dmabuf_v1_interface, 5, "LinuxDMABUF"); + PROTO::mesaDRM = makeUnique<CMesaDRMProtocol>(&wl_drm_interface, 2, "MesaDRM"); + PROTO::linuxDma = makeUnique<CLinuxDMABufV1Protocol>(&zwp_linux_dmabuf_v1_interface, 5, "LinuxDMABUF"); } else Debug::log(WARN, "ProtocolManager: Not binding linux-dmabuf and MesaDRM: DMABUF not available"); } diff --git a/src/managers/ProtocolManager.hpp b/src/managers/ProtocolManager.hpp index 6ceff9ad..1ec8db4a 100644 --- a/src/managers/ProtocolManager.hpp +++ b/src/managers/ProtocolManager.hpp @@ -18,4 +18,4 @@ class CProtocolManager { void onMonitorModeChange(PHLMONITOR pMonitor); }; -inline std::unique_ptr<CProtocolManager> g_pProtocolManager; +inline UP<CProtocolManager> g_pProtocolManager; diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index 3d77f05a..ea0d8dfc 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -57,7 +57,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { Debug::log(LOG, "Session got locked by {:x}", (uintptr_t)pLock.get()); - m_pSessionLock = std::make_unique<SSessionLock>(); + m_pSessionLock = makeUnique<SSessionLock>(); m_pSessionLock->lock = pLock; m_pSessionLock->mLockTimer.reset(); @@ -66,7 +66,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { const auto PMONITOR = SURFACE->monitor(); - const auto NEWSURFACE = m_pSessionLock->vSessionLockSurfaces.emplace_back(std::make_unique<SSessionLockSurface>(SURFACE)).get(); + const auto NEWSURFACE = m_pSessionLock->vSessionLockSurfaces.emplace_back(makeUnique<SSessionLockSurface>(SURFACE)).get(); NEWSURFACE->iMonitorID = PMONITOR->ID; PROTO::fractional->sendScale(SURFACE->surface(), PMONITOR->scale); }); diff --git a/src/managers/SessionLockManager.hpp b/src/managers/SessionLockManager.hpp index 59090605..aaf78819 100644 --- a/src/managers/SessionLockManager.hpp +++ b/src/managers/SessionLockManager.hpp @@ -28,11 +28,11 @@ struct SSessionLockSurface { }; struct SSessionLock { - WP<CSessionLock> lock; - CTimer mLockTimer; + WP<CSessionLock> lock; + CTimer mLockTimer; - std::vector<std::unique_ptr<SSessionLockSurface>> vSessionLockSurfaces; - std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers; + std::vector<UP<SSessionLockSurface>> vSessionLockSurfaces; + std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers; struct { CHyprSignalListener newSurface; @@ -74,4 +74,4 @@ class CSessionLockManager { void onNewSessionLock(SP<CSessionLock> pWlrLock); }; -inline std::unique_ptr<CSessionLockManager> g_pSessionLockManager; +inline UP<CSessionLockManager> g_pSessionLockManager; diff --git a/src/managers/TokenManager.hpp b/src/managers/TokenManager.hpp index 92638e9b..aaf068bc 100644 --- a/src/managers/TokenManager.hpp +++ b/src/managers/TokenManager.hpp @@ -35,4 +35,4 @@ class CTokenManager { std::unordered_map<std::string, SP<CUUIDToken>> m_mTokens; }; -inline std::unique_ptr<CTokenManager> g_pTokenManager;
\ No newline at end of file +inline UP<CTokenManager> g_pTokenManager;
\ No newline at end of file diff --git a/src/managers/VersionKeeperManager.hpp b/src/managers/VersionKeeperManager.hpp index eb404d88..250a36b8 100644 --- a/src/managers/VersionKeeperManager.hpp +++ b/src/managers/VersionKeeperManager.hpp @@ -1,6 +1,6 @@ #pragma once -#include <memory> +#include "../helpers/memory/Memory.hpp" class CVersionKeeperManager { public: @@ -15,4 +15,4 @@ class CVersionKeeperManager { bool m_bFired = false; }; -inline std::unique_ptr<CVersionKeeperManager> g_pVersionKeeperMgr;
\ No newline at end of file +inline UP<CVersionKeeperManager> g_pVersionKeeperMgr;
\ No newline at end of file diff --git a/src/managers/XCursorManager.cpp b/src/managers/XCursorManager.cpp index 42c5e427..3473df44 100644 --- a/src/managers/XCursorManager.cpp +++ b/src/managers/XCursorManager.cpp @@ -9,6 +9,7 @@ #include "../managers/CursorManager.hpp" #include "debug/Log.hpp" #include "XCursorManager.hpp" +#include <memory> // clang-format off static std::vector<uint32_t> HYPR_XCURSOR_PIXELS = { diff --git a/src/managers/XWaylandManager.hpp b/src/managers/XWaylandManager.hpp index 18627a78..8ce239f6 100644 --- a/src/managers/XWaylandManager.hpp +++ b/src/managers/XWaylandManager.hpp @@ -25,4 +25,4 @@ class CHyprXWaylandManager { Vector2D waylandToXWaylandCoords(const Vector2D&); }; -inline std::unique_ptr<CHyprXWaylandManager> g_pXWaylandManager;
\ No newline at end of file +inline UP<CHyprXWaylandManager> g_pXWaylandManager;
\ No newline at end of file diff --git a/src/managers/eventLoop/EventLoopManager.hpp b/src/managers/eventLoop/EventLoopManager.hpp index e1c243d3..95cc6109 100644 --- a/src/managers/eventLoop/EventLoopManager.hpp +++ b/src/managers/eventLoop/EventLoopManager.hpp @@ -69,4 +69,4 @@ class CEventLoopManager { friend class CSyncTimeline; }; -inline std::unique_ptr<CEventLoopManager> g_pEventLoopManager; +inline UP<CEventLoopManager> g_pEventLoopManager; diff --git a/src/managers/input/IdleInhibitor.cpp b/src/managers/input/IdleInhibitor.cpp index 74760c0a..67837c17 100644 --- a/src/managers/input/IdleInhibitor.cpp +++ b/src/managers/input/IdleInhibitor.cpp @@ -5,7 +5,7 @@ #include "../../protocols/core/Compositor.hpp" void CInputManager::newIdleInhibitor(std::any inhibitor) { - const auto PINHIBIT = m_vIdleInhibitors.emplace_back(std::make_unique<SIdleInhibitor>()).get(); + const auto PINHIBIT = m_vIdleInhibitors.emplace_back(makeUnique<SIdleInhibitor>()).get(); PINHIBIT->inhibitor = std::any_cast<SP<CIdleInhibitor>>(inhibitor); Debug::log(LOG, "New idle inhibitor registered for surface {:x}", (uintptr_t)PINHIBIT->inhibitor->surface.get()); diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index 36c8144d..c0f1939e 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -268,7 +268,7 @@ class CInputManager { bool nonDesktop = false; CHyprSignalListener surfaceDestroyListener; }; - std::vector<std::unique_ptr<SIdleInhibitor>> m_vIdleInhibitors; + std::vector<UP<SIdleInhibitor>> m_vIdleInhibitors; // swipe void beginWorkspaceSwipe(); @@ -304,4 +304,4 @@ class CInputManager { friend class CWLSurface; }; -inline std::unique_ptr<CInputManager> g_pInputManager; +inline UP<CInputManager> g_pInputManager; diff --git a/src/managers/input/InputMethodRelay.cpp b/src/managers/input/InputMethodRelay.cpp index 58cff043..5f6c4354 100644 --- a/src/managers/input/InputMethodRelay.cpp +++ b/src/managers/input/InputMethodRelay.cpp @@ -50,7 +50,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) { }); listeners.newPopup = pIME->events.newPopup.registerListener([this](std::any d) { - m_vIMEPopups.emplace_back(std::make_unique<CInputPopup>(std::any_cast<SP<CInputMethodPopupV2>>(d))); + m_vIMEPopups.emplace_back(makeUnique<CInputPopup>(std::any_cast<SP<CInputMethodPopupV2>>(d))); Debug::log(LOG, "New input popup"); }); @@ -86,11 +86,11 @@ CTextInput* CInputMethodRelay::getFocusedTextInput() { } void CInputMethodRelay::onNewTextInput(WP<CTextInputV3> tiv3) { - m_vTextInputs.emplace_back(std::make_unique<CTextInput>(tiv3)); + m_vTextInputs.emplace_back(makeUnique<CTextInput>(tiv3)); } void CInputMethodRelay::onNewTextInput(WP<CTextInputV1> pTIV1) { - m_vTextInputs.emplace_back(std::make_unique<CTextInput>(pTIV1)); + m_vTextInputs.emplace_back(makeUnique<CTextInput>(pTIV1)); } void CInputMethodRelay::removeTextInput(CTextInput* pInput) { diff --git a/src/managers/input/InputMethodRelay.hpp b/src/managers/input/InputMethodRelay.hpp index 998e1fc6..602a939a 100644 --- a/src/managers/input/InputMethodRelay.hpp +++ b/src/managers/input/InputMethodRelay.hpp @@ -40,10 +40,10 @@ class CInputMethodRelay { WP<CInputMethodV2> m_pIME; private: - std::vector<std::unique_ptr<CTextInput>> m_vTextInputs; - std::vector<std::unique_ptr<CInputPopup>> m_vIMEPopups; + std::vector<UP<CTextInput>> m_vTextInputs; + std::vector<UP<CInputPopup>> m_vIMEPopups; - WP<CWLSurfaceResource> m_pLastKbFocus; + WP<CWLSurfaceResource> m_pLastKbFocus; struct { CHyprSignalListener newTIV3; diff --git a/src/managers/input/TextInput.hpp b/src/managers/input/TextInput.hpp index c0b590ac..37b471af 100644 --- a/src/managers/input/TextInput.hpp +++ b/src/managers/input/TextInput.hpp @@ -3,7 +3,6 @@ #include "../../helpers/math/Math.hpp" #include "../../helpers/signal/Signal.hpp" #include "../../helpers/memory/Memory.hpp" -#include <memory> struct wl_client; |
