core: Properly shutdown wl display (#7018)

* correctly destroy wayland globals

* properly shutdown and cleanup hyprland

* appease the nitpick gods and some comments
This commit is contained in:
Ikalco 2024-07-24 12:07:36 -05:00 committed by GitHub
parent 735e3c6c56
commit 3e543d2ce8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 161 additions and 60 deletions

View file

@ -1662,7 +1662,7 @@ void CKeybindManager::renameWorkspace(std::string args) {
}
void CKeybindManager::exitHyprland(std::string argz) {
g_pEventLoopManager->doLater([]() { g_pCompositor->cleanup(); });
g_pCompositor->stopCompositor();
}
void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) {

View file

@ -166,3 +166,57 @@ CProtocolManager::CProtocolManager() {
m_pGlobalShortcutsProtocolManager = std::make_unique<CGlobalShortcutsProtocolManager>();
m_pScreencopyProtocolManager = std::make_unique<CScreencopyProtocolManager>();
}
CProtocolManager::~CProtocolManager() {
// this is dumb but i don't want to replace all 600 PROTO with the right thing
// Output
PROTO::outputs.clear();
// Core
PROTO::seat.reset();
PROTO::data.reset();
PROTO::compositor.reset();
PROTO::subcompositor.reset();
PROTO::shm.reset();
// Extensions
PROTO::viewport.reset();
PROTO::tearing.reset();
PROTO::fractional.reset();
PROTO::xdgOutput.reset();
PROTO::cursorShape.reset();
PROTO::idleInhibit.reset();
PROTO::relativePointer.reset();
PROTO::xdgDecoration.reset();
PROTO::alphaModifier.reset();
PROTO::gamma.reset();
PROTO::foreignToplevel.reset();
PROTO::pointerGestures.reset();
PROTO::foreignToplevelWlr.reset();
PROTO::shortcutsInhibit.reset();
PROTO::textInputV3.reset();
PROTO::constraints.reset();
PROTO::outputPower.reset();
PROTO::activation.reset();
PROTO::idle.reset();
PROTO::sessionLock.reset();
PROTO::ime.reset();
PROTO::virtualKeyboard.reset();
PROTO::virtualPointer.reset();
PROTO::outputManagement.reset();
PROTO::serverDecorationKDE.reset();
PROTO::focusGrab.reset();
PROTO::tablet.reset();
PROTO::layerShell.reset();
PROTO::presentation.reset();
PROTO::xdgShell.reset();
PROTO::dataWlr.reset();
PROTO::primarySelection.reset();
PROTO::xwaylandShell.reset();
PROTO::lease.reset();
PROTO::sync.reset();
PROTO::mesaDRM.reset();
PROTO::linuxDma.reset();
}

View file

@ -12,6 +12,7 @@
class CProtocolManager {
public:
CProtocolManager();
~CProtocolManager();
// TODO: rewrite to use the new protocol framework
std::unique_ptr<CToplevelExportProtocolManager> m_pToplevelExportProtocolManager;

View file

@ -19,8 +19,14 @@ CEventLoopManager::CEventLoopManager(wl_display* display, wl_event_loop* wlEvent
}
CEventLoopManager::~CEventLoopManager() {
for (auto& eventSource : m_sWayland.aqEventSources) {
wl_event_source_remove(eventSource);
}
if (m_sWayland.eventSource)
wl_event_source_remove(m_sWayland.eventSource);
if (m_sIdle.eventSource)
wl_event_source_remove(m_sIdle.eventSource);
}
static int timerWrite(int fd, uint32_t mask, void* data) {