diff options
| author | vaxerski <vaxry@vaxry.net> | 2024-01-11 13:15:20 +0100 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2024-01-11 14:07:28 +0100 |
| commit | 6b92144f15117f9f7d93fe9867d6ec849d9abce1 (patch) | |
| tree | 7513d63d76669a5cd84ea4b4a84470732c73560e /src/Compositor.cpp | |
| parent | 8d31c84483be7cc6f909d73c6ecd4c0b4bdc3360 (diff) | |
surface: avoid spam of window surfaces with scale and transform events
fixes #4408
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 62903cf9..cbdcd6b8 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -2797,10 +2797,27 @@ void CCompositor::leaveUnsafeState() { void CCompositor::setPreferredScaleForSurface(wlr_surface* pSurface, double scale) { g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(pSurface, scale); wlr_surface_set_preferred_buffer_scale(pSurface, static_cast<int32_t>(std::ceil(scale))); + + const auto PSURFACE = CWLSurface::surfaceFromWlr(pSurface); + if (!PSURFACE) { + Debug::log(WARN, "Orphaned wlr_surface {:x} in setPreferredScaleForSurface", (uintptr_t)pSurface); + return; + } + + PSURFACE->m_fLastScale = scale; + PSURFACE->m_iLastScale = static_cast<int32_t>(std::ceil(scale)); } void CCompositor::setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform) { wlr_surface_set_preferred_buffer_transform(pSurface, transform); + + const auto PSURFACE = CWLSurface::surfaceFromWlr(pSurface); + if (!PSURFACE) { + Debug::log(WARN, "Orphaned wlr_surface {:x} in setPreferredTransformForSurface", (uintptr_t)pSurface); + return; + } + + PSURFACE->m_eLastTransform = transform; } void CCompositor::updateSuspendedStates() { |
