renderer: fix uv calculations once and for all (#11770)

fixes synchronization of ackd sizes, fixes wrong xdg stuff
This commit is contained in:
Vaxry 2025-09-21 19:27:56 +02:00 committed by GitHub
parent 41dad38177
commit 26cbc67385
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 85 additions and 48 deletions

View file

@ -16,6 +16,7 @@
#include "../managers/TokenManager.hpp"
#include "../managers/animation/AnimationManager.hpp"
#include "../managers/ANRManager.hpp"
#include "../managers/eventLoop/EventLoopManager.hpp"
#include "../protocols/XDGShell.hpp"
#include "../protocols/core/Compositor.hpp"
#include "../protocols/core/Subcompositor.hpp"
@ -576,7 +577,12 @@ void CWindow::onMap() {
if (!m_isMapped || isX11OverrideRedirect())
return;
sendWindowSize();
g_pEventLoopManager->doLater([this, self = m_self] {
if (!self)
return;
sendWindowSize();
});
},
false);
@ -1549,13 +1555,20 @@ std::string CWindow::fetchClass() {
}
void CWindow::onAck(uint32_t serial) {
const auto SERIAL = std::ranges::find_if(m_pendingSizeAcks | std::views::reverse, [serial](const auto& e) { return e.first == serial; });
const auto SERIAL = std::ranges::find_if(m_pendingSizeAcks | std::views::reverse, [serial](const auto& e) { return e.first <= serial; });
if (SERIAL == m_pendingSizeAcks.rend())
return;
m_pendingSizeAck = *SERIAL;
std::erase_if(m_pendingSizeAcks, [&](const auto& el) { return el.first <= SERIAL->first; });
if (m_isX11)
return;
m_wlSurface->resource()->m_pending.ackedSize = m_pendingSizeAck->second; // apply pending size. We pinged, the window ponged.
m_wlSurface->resource()->m_pending.updated.bits.acked = true;
m_pendingSizeAck.reset();
}
void CWindow::onResourceChangeX11() {
@ -1805,7 +1818,7 @@ void CWindow::sendWindowSize(bool force) {
if (m_isX11 && m_xwaylandSurface)
m_xwaylandSurface->configure({REPORTPOS, REPORTSIZE});
else if (m_xdgSurface && m_xdgSurface->m_toplevel)
m_pendingSizeAcks.emplace_back(m_xdgSurface->m_toplevel->setSize(REPORTSIZE), REPORTPOS.floor());
m_pendingSizeAcks.emplace_back(m_xdgSurface->m_toplevel->setSize(REPORTSIZE), REPORTSIZE.floor());
}
NContentType::eContentType CWindow::getContentType() {
@ -1910,3 +1923,11 @@ SP<CWLSurfaceResource> CWindow::getSolitaryResource() {
return nullptr;
}
Vector2D CWindow::getReportedSize() {
if (m_isX11)
return m_reportedSize;
if (m_wlSurface && m_wlSurface->resource())
return m_wlSurface->resource()->m_current.ackedSize;
return m_reportedSize;
}