internal: wrap wlr surfaces (#1822)
This commit is contained in:
parent
d23bbd1687
commit
788a8f7c13
16 changed files with 179 additions and 45 deletions
|
|
@ -112,6 +112,8 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
|
|||
layersurface->layerSurface->mapped = true;
|
||||
layersurface->mapped = true;
|
||||
|
||||
layersurface->surface = layersurface->layerSurface->surface;
|
||||
|
||||
// anim
|
||||
layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
|
||||
|
||||
|
|
@ -207,12 +209,15 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
|||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
|
||||
|
||||
const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == layersurface->layerSurface->surface;
|
||||
|
||||
layersurface->surface = nullptr;
|
||||
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
// refocus if needed
|
||||
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus) {
|
||||
|
||||
if (WASLASTFOCUS) {
|
||||
Vector2D surfaceCoords;
|
||||
SLayerSurface* pFoundLayerSurface = nullptr;
|
||||
wlr_surface* foundSurface = nullptr;
|
||||
|
|
|
|||
|
|
@ -86,10 +86,11 @@ void Events::listener_newPopup(void* owner, void* data) {
|
|||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
|
||||
|
||||
PNEWPOPUP->popup = WLRPOPUP;
|
||||
PNEWPOPUP->lx = layersurface->position.x;
|
||||
PNEWPOPUP->ly = layersurface->position.y;
|
||||
PNEWPOPUP->monitor = PMONITOR;
|
||||
PNEWPOPUP->popup = WLRPOPUP;
|
||||
PNEWPOPUP->lx = layersurface->position.x;
|
||||
PNEWPOPUP->ly = layersurface->position.y;
|
||||
PNEWPOPUP->monitor = PMONITOR;
|
||||
PNEWPOPUP->parentLS = layersurface;
|
||||
createNewPopup(WLRPOPUP, PNEWPOPUP);
|
||||
}
|
||||
|
||||
|
|
@ -148,6 +149,11 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
|
|||
|
||||
Debug::log(LOG, "New XDG Popup mapped at %d %d", (int)PPOPUP->lx, (int)PPOPUP->ly);
|
||||
|
||||
if (PPOPUP->parentWindow)
|
||||
PPOPUP->parentWindow->m_lPopupSurfaces.emplace_back(PPOPUP->popup->base->surface);
|
||||
else if (PPOPUP->parentLS)
|
||||
PPOPUP->parentLS->popupSurfaces.emplace_back(PPOPUP->popup->base->surface);
|
||||
|
||||
PPOPUP->pSurfaceTree = SubsurfaceTree::createTreeRoot(PPOPUP->popup->base->surface, addPopupGlobalCoords, PPOPUP, PPOPUP->parentWindow);
|
||||
|
||||
int lx = 0, ly = 0;
|
||||
|
|
@ -167,6 +173,11 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
|
|||
|
||||
ASSERT(PPOPUP);
|
||||
|
||||
if (PPOPUP->parentWindow)
|
||||
std::erase(PPOPUP->parentWindow->m_lPopupSurfaces, PPOPUP->popup->base->surface);
|
||||
else if (PPOPUP->parentLS)
|
||||
std::erase(PPOPUP->parentLS->popupSurfaces, PPOPUP->popup->base->surface);
|
||||
|
||||
SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree);
|
||||
|
||||
int lx = 0, ly = 0;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
// registers the animated vars and stuff
|
||||
PWINDOW->onMap();
|
||||
|
||||
const auto PWINDOWSURFACE = g_pXWaylandManager->getWindowSurface(PWINDOW);
|
||||
const auto PWINDOWSURFACE = PWINDOW->m_pWLSurface.wlr();
|
||||
|
||||
if (!PWINDOWSURFACE) {
|
||||
g_pCompositor->removeWindowFromVectorSafe(PWINDOW);
|
||||
|
|
@ -492,7 +492,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
// recheck idle inhibitors
|
||||
g_pInputManager->recheckIdleInhibitorStatus();
|
||||
|
||||
PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW, PWINDOW);
|
||||
PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(PWINDOW->m_pWLSurface.wlr(), addViewCoords, PWINDOW, PWINDOW);
|
||||
|
||||
PWINDOW->updateToplevel();
|
||||
|
||||
|
|
@ -575,7 +575,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||
// recalc the values for this window
|
||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
||||
|
||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PMONITOR->scale);
|
||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(PWINDOW->m_pWLSurface.wlr(), PMONITOR->scale);
|
||||
}
|
||||
|
||||
void Events::listener_unmapWindow(void* owner, void* data) {
|
||||
|
|
@ -708,7 +708,7 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
|||
|
||||
PWINDOW->updateSurfaceOutputs();
|
||||
|
||||
g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
|
||||
g_pHyprRenderer->damageSurface(PWINDOW->m_pWLSurface.wlr(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
|
||||
|
||||
// Debug::log(LOG, "Window %x committed", PWINDOW); // SPAM!
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue