wrapped wl_listener fixes

This commit is contained in:
vaxerski 2022-07-22 13:34:19 +02:00
parent d9b0edb786
commit 616ec22735
2 changed files with 4 additions and 4 deletions

View file

@ -44,9 +44,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
layerSurface->hyprListener_destroyLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.destroy, &Events::listener_destroyLayerSurface, layerSurface, "layerSurface"); layerSurface->hyprListener_destroyLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.destroy, &Events::listener_destroyLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_mapLayerSurface.initCallback(&WLRLAYERSURFACE->events.map, &Events::listener_mapLayerSurface, layerSurface, "layerSurface"); layerSurface->hyprListener_mapLayerSurface.initCallback(&WLRLAYERSURFACE->events.map, &Events::listener_mapLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_unmapLayerSurface.initCallback(&WLRLAYERSURFACE->events.unmap, &Events::listener_unmapLayerSurface, layerSurface, "layerSurface"); layerSurface->hyprListener_unmapLayerSurface.initCallback(&WLRLAYERSURFACE->events.unmap, &Events::listener_unmapLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_newPopup.initCallback(&WLRLAYERSURFACE->events.new_popup, &Events::listener_newPopup, layerSurface, "layerSurface");
// TODO: fix this, this has memory issues. Somehow. https://github.com/hyprwm/Hyprland/issues/375
//layerSurface->hyprListener_newPopup.initCallback(&WLRLAYERSURFACE->events.new_popup, &Events::listener_newPopup, layerSurface, "layerSurface");
layerSurface->layerSurface = WLRLAYERSURFACE; layerSurface->layerSurface = WLRLAYERSURFACE;
layerSurface->layer = WLRLAYERSURFACE->current.layer; layerSurface->layer = WLRLAYERSURFACE->current.layer;
@ -80,7 +78,7 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
layersurface->hyprListener_destroyLayerSurface.removeCallback(); layersurface->hyprListener_destroyLayerSurface.removeCallback();
layersurface->hyprListener_mapLayerSurface.removeCallback(); layersurface->hyprListener_mapLayerSurface.removeCallback();
layersurface->hyprListener_unmapLayerSurface.removeCallback(); layersurface->hyprListener_unmapLayerSurface.removeCallback();
//layersurface->hyprListener_newPopup.removeCallback(); layersurface->hyprListener_newPopup.removeCallback();
// rearrange to fix the reserved areas // rearrange to fix the reserved areas
if (PMONITOR) { if (PMONITOR) {

View file

@ -25,6 +25,7 @@ void CHyprWLListener::removeCallback() {
if (m_bIsConnected) { if (m_bIsConnected) {
Debug::log(LOG, "Callback %x -> %x, %s removed.", &m_pCallback, &m_pOwner, m_szAuthor.c_str()); Debug::log(LOG, "Callback %x -> %x, %s removed.", &m_pCallback, &m_pOwner, m_szAuthor.c_str());
wl_list_remove(&m_sListener.link); wl_list_remove(&m_sListener.link);
wl_list_init(&m_sListener.link);
} }
m_bIsConnected = false; m_bIsConnected = false;
@ -46,6 +47,7 @@ void CHyprWLListener::initCallback(wl_signal* pSignal, std::function<void(void*,
m_bIsConnected = true; m_bIsConnected = true;
wl_list_init(&m_sListener.link);
addWLSignal(pSignal, &m_sListener, pOwner, m_szAuthor); addWLSignal(pSignal, &m_sListener, pOwner, m_szAuthor);
} }