summaryrefslogtreecommitdiff
path: root/src/desktop/Window.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-09-21 19:27:56 +0200
committerGitHub <noreply@github.com>2025-09-21 19:27:56 +0200
commit26cbc67385d95ba621fe0a125a5b121ffdd09335 (patch)
tree2aa7c05ce78ab4ea55e8df81f1c99553509b37b1 /src/desktop/Window.cpp
parent41dad381770300fe1015ad8cdd1f370a8fd4e5d5 (diff)
renderer: fix uv calculations once and for all (#11770)
fixes synchronization of ackd sizes, fixes wrong xdg stuff
Diffstat (limited to 'src/desktop/Window.cpp')
-rw-r--r--src/desktop/Window.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index 71b78ded..ba0f09d5 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -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;
+}