More checks in popups

This commit is contained in:
vaxerski 2022-03-31 21:58:33 +02:00
parent 51dfc0f9c9
commit 7ec2aed55f

View file

@ -58,6 +58,8 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
void Events::listener_newPopup(void* owner, void* data) { void Events::listener_newPopup(void* owner, void* data) {
SLayerSurface* layersurface = (SLayerSurface*)owner; SLayerSurface* layersurface = (SLayerSurface*)owner;
ASSERT(layersurface);
Debug::log(LOG, "New layer popup created from surface %x", layersurface); Debug::log(LOG, "New layer popup created from surface %x", layersurface);
const auto WLRPOPUP = (wlr_xdg_popup*)data; const auto WLRPOPUP = (wlr_xdg_popup*)data;
@ -74,6 +76,8 @@ void Events::listener_newPopup(void* owner, void* data) {
void Events::listener_newPopupXDG(void* owner, void* data) { void Events::listener_newPopupXDG(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner; CWindow* PWINDOW = (CWindow*)owner;
ASSERT(PWINDOW);
Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str()); Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str());
const auto WLRPOPUP = (wlr_xdg_popup*)data; const auto WLRPOPUP = (wlr_xdg_popup*)data;
@ -91,7 +95,12 @@ void Events::listener_newPopupXDG(void* owner, void* data) {
void Events::listener_newPopupFromPopupXDG(void* owner, void* data) { void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner; SXDGPopup* PPOPUP = (SXDGPopup*)owner;
Debug::log(LOG, "New layer popup created from XDG popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str()); ASSERT(PPOPUP);
if (PPOPUP->parentWindow)
Debug::log(LOG, "New popup created from XDG Window popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str());
else
Debug::log(LOG, "New popup created from Non-Window popup %x", PPOPUP);
const auto WLRPOPUP = (wlr_xdg_popup*)data; const auto WLRPOPUP = (wlr_xdg_popup*)data;
@ -102,6 +111,7 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
PNEWPOPUP->parentPopup = PPOPUP; PNEWPOPUP->parentPopup = PPOPUP;
PNEWPOPUP->lx = PPOPUP->lx; PNEWPOPUP->lx = PPOPUP->lx;
PNEWPOPUP->ly = PPOPUP->ly; PNEWPOPUP->ly = PPOPUP->ly;
PNEWPOPUP->parentWindow = PPOPUP->parentWindow;
createNewPopup(WLRPOPUP, PNEWPOPUP); createNewPopup(WLRPOPUP, PNEWPOPUP);
} }
@ -109,6 +119,8 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
void Events::listener_mapPopupXDG(void* owner, void* data) { void Events::listener_mapPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner; SXDGPopup* PPOPUP = (SXDGPopup*)owner;
ASSERT(PPOPUP);
Debug::log(LOG, "New XDG Popup mapped"); Debug::log(LOG, "New XDG Popup mapped");
PPOPUP->pSurfaceTree = SubsurfaceTree::createTreeRoot(PPOPUP->popup->base->surface, addPopupGlobalCoords, PPOPUP); PPOPUP->pSurfaceTree = SubsurfaceTree::createTreeRoot(PPOPUP->popup->base->surface, addPopupGlobalCoords, PPOPUP);
@ -120,6 +132,8 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner; SXDGPopup* PPOPUP = (SXDGPopup*)owner;
Debug::log(LOG, "XDG Popup unmapped"); Debug::log(LOG, "XDG Popup unmapped");
ASSERT(PPOPUP);
SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree); SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree);
PPOPUP->pSurfaceTree = nullptr; PPOPUP->pSurfaceTree = nullptr;
@ -128,6 +142,8 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
void Events::listener_destroyPopupXDG(void* owner, void* data) { void Events::listener_destroyPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner; SXDGPopup* PPOPUP = (SXDGPopup*)owner;
ASSERT(PPOPUP);
Debug::log(LOG, "Destroyed popup XDG %x", PPOPUP); Debug::log(LOG, "Destroyed popup XDG %x", PPOPUP);
if (PPOPUP->pSurfaceTree) { if (PPOPUP->pSurfaceTree) {