renderer: fix uv calculations once and for all (#11770)
fixes synchronization of ackd sizes, fixes wrong xdg stuff
This commit is contained in:
parent
41dad38177
commit
26cbc67385
8 changed files with 85 additions and 48 deletions
|
|
@ -62,9 +62,10 @@ bool CWLSurface::small() const {
|
|||
if (!m_resource->m_current.texture)
|
||||
return false;
|
||||
|
||||
const auto O = m_windowOwner.lock();
|
||||
const auto O = m_windowOwner.lock();
|
||||
const auto REPORTED_SIZE = O->getReportedSize();
|
||||
|
||||
return O->m_reportedSize.x > m_resource->m_current.size.x + 1 || O->m_reportedSize.y > m_resource->m_current.size.y + 1;
|
||||
return REPORTED_SIZE.x > m_resource->m_current.size.x + 1 || REPORTED_SIZE.y > m_resource->m_current.size.y + 1;
|
||||
}
|
||||
|
||||
Vector2D CWLSurface::correctSmallVec() const {
|
||||
|
|
@ -73,8 +74,9 @@ Vector2D CWLSurface::correctSmallVec() const {
|
|||
|
||||
const auto SIZE = getViewporterCorrectedSize();
|
||||
const auto O = m_windowOwner.lock();
|
||||
const auto REP = O->getReportedSize();
|
||||
|
||||
return Vector2D{(O->m_reportedSize.x - SIZE.x) / 2, (O->m_reportedSize.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_realSize->value() / O->m_reportedSize);
|
||||
return Vector2D{(REP.x - SIZE.x) / 2, (REP.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_realSize->value() / REP);
|
||||
}
|
||||
|
||||
Vector2D CWLSurface::correctSmallVecBuf() const {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -416,6 +416,7 @@ class CWindow {
|
|||
PHLWINDOW parent();
|
||||
bool priorityFocus();
|
||||
SP<CWLSurfaceResource> getSolitaryResource();
|
||||
Vector2D getReportedSize();
|
||||
|
||||
CBox getWindowMainSurfaceBox() const {
|
||||
return {m_realPosition->value().x, m_realPosition->value().y, m_realSize->value().x, m_realSize->value().y};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue