popup: imorove logging, use fadeAlpha for opacity

This commit is contained in:
Vaxry
2025-08-03 16:39:54 +02:00
parent 61826dc7ac
commit f6d8e86439
2 changed files with 12 additions and 2 deletions

View File

@@ -90,7 +90,7 @@ void CPopup::initAllSignals() {
void CPopup::onNewPopup(SP<CXDGPopupResource> popup) {
const auto& POPUP = m_children.emplace_back(CPopup::create(popup, m_self));
POPUP->m_self = POPUP;
Debug::log(LOG, "New popup at {:x}", (uintptr_t)POPUP);
Debug::log(LOG, "New popup at {:x}", (uintptr_t)this);
}
void CPopup::onDestroy() {
@@ -148,6 +148,8 @@ void CPopup::onMap() {
m_alpha->setValueAndWarp(0.F);
*m_alpha = 1.F;
Debug::log(LOG, "popup {:x}: mapped", (uintptr_t)this);
}
void CPopup::onUnmap() {
@@ -160,6 +162,8 @@ void CPopup::onUnmap() {
return;
}
Debug::log(LOG, "popup {:x}: unmapped", (uintptr_t)this);
// if the popup committed a different size right now, we also need to damage the old size.
const Vector2D MAX_DAMAGE_SIZE = {std::max(m_lastSize.x, m_resource->m_surface->m_surface->m_current.size.x),
std::max(m_lastSize.y, m_resource->m_surface->m_surface->m_current.size.y)};

View File

@@ -664,7 +664,7 @@ void CHyprRenderer::renderWindow(PHLWINDOW pWindow, PHLMONITOR pMonitor, const T
const auto pos = popup->coordsRelativeToParent();
const Vector2D oldPos = renderdata.pos;
renderdata.pos += pos;
renderdata.alpha = popup->m_alpha->value();
renderdata.fadeAlpha = popup->m_alpha->value();
popup->m_wlSurface->resource()->breadthfirst(
[this, &renderdata](SP<CWLSurfaceResource> s, const Vector2D& offset, void* data) {
@@ -2416,6 +2416,8 @@ void CHyprRenderer::makeSnapshot(PHLWINDOW pWindow) {
if (!shouldRenderWindow(pWindow))
return; // ignore, window is not being rendered
Debug::log(LOG, "renderer: making a snapshot of {:x}", (uintptr_t)pWindow.get());
// we need to "damage" the entire monitor
// so that we render the entire window
// this is temporary, doesn't mess with the actual damage
@@ -2449,6 +2451,8 @@ void CHyprRenderer::makeSnapshot(PHLLS pLayer) {
if (!PMONITOR || !PMONITOR->m_output || PMONITOR->m_pixelSize.x <= 0 || PMONITOR->m_pixelSize.y <= 0)
return;
Debug::log(LOG, "renderer: making a snapshot of {:x}", (uintptr_t)pLayer.get());
// we need to "damage" the entire monitor
// so that we render the entire window
// this is temporary, doesn't mess with the actual damage
@@ -2484,6 +2488,8 @@ void CHyprRenderer::makeSnapshot(WP<CPopup> popup) {
if (!popup->m_wlSurface || !popup->m_wlSurface->resource() || !popup->m_mapped)
return;
Debug::log(LOG, "renderer: making a snapshot of {:x}", (uintptr_t)popup.get());
CRegion fakeDamage{0, 0, PMONITOR->m_transformedSize.x, PMONITOR->m_transformedSize.y};
makeEGLCurrent();