layer-shell: allow for popup creation before map

ref https://github.com/jjsullivan5196/wvkbd/issues/65
This commit is contained in:
Vaxry 2024-03-09 15:32:36 +00:00
parent 3e930a568a
commit c9ea600baa

View file

@ -51,6 +51,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
layerSurface->layer = WLRLAYERSURFACE->current.layer;
WLRLAYERSURFACE->data = layerSurface;
layerSurface->monitorID = PMONITOR->ID;
layerSurface->popupHead = std::make_unique<CPopup>(layerSurface);
layerSurface->forceBlur = g_pConfigManager->shouldBlurLS(layerSurface->szNamespace);
@ -65,6 +66,8 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
layersurface->popupHead.reset();
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID))
Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)");
@ -111,8 +114,6 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive;
layersurface->surface = layersurface->layerSurface->surface;
layersurface->popupHead = std::make_unique<CPopup>(layersurface);
// fix if it changed its mon
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
@ -184,8 +185,6 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
std::erase(g_pInputManager->m_dExclusiveLSes, layersurface);
layersurface->popupHead.reset();
if (!g_pInputManager->m_dExclusiveLSes.empty())
g_pCompositor->focusSurface(g_pInputManager->m_dExclusiveLSes[0]->layerSurface->surface);