aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-02-01 00:55:17 +0000
committerVaxry <[email protected]>2024-02-01 00:55:29 +0000
commitcfd68af5b6c26f244838b628cf375b9cc0c5cfdf (patch)
tree7a8f1d5b3446af2a8321db52ee854e7ff4c0ba07
parent4f804d5f962070c531dea5025e61be8a0da8129e (diff)
downloadHyprland-cfd68af5b6c26f244838b628cf375b9cc0c5cfdf.tar.gz
Hyprland-cfd68af5b6c26f244838b628cf375b9cc0c5cfdf.zip
tearing-control: handle unmapped surfaces for hints
fixes #4570
-rw-r--r--src/Window.cpp8
-rw-r--r--src/events/Misc.cpp13
2 files changed, 11 insertions, 10 deletions
diff --git a/src/Window.cpp b/src/Window.cpp
index ceda1284..d821b1b9 100644
--- a/src/Window.cpp
+++ b/src/Window.cpp
@@ -518,6 +518,14 @@ void CWindow::onMap() {
"CWindow");
m_vReportedSize = m_vPendingReportedSize;
+
+ for (const auto& ctrl : g_pHyprRenderer->m_vTearingControllers) {
+ if (ctrl->pWlrHint->surface != m_pWLSurface.wlr())
+ continue;
+
+ m_bTearingHint = ctrl->pWlrHint->current;
+ break;
+ }
}
void CWindow::onBorderAngleAnimEnd(void* ptr) {
diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp
index d4f3a803..f2ff726b 100644
--- a/src/events/Misc.cpp
+++ b/src/events/Misc.cpp
@@ -233,14 +233,7 @@ void Events::listener_setCursorShape(wl_listener* listener, void* data) {
void Events::listener_newTearingHint(wl_listener* listener, void* data) {
const auto TCTL = (wlr_tearing_control_v1*)data;
- const auto PWINDOW = g_pCompositor->getWindowFromSurface(TCTL->surface);
-
- if (!PWINDOW) {
- Debug::log(ERR, "Tearing hint {} was attached to an unknown surface", (uintptr_t)data);
- return;
- }
-
- Debug::log(LOG, "New tearing hint for window {} at {}", PWINDOW, (uintptr_t)data);
+ Debug::log(LOG, "New tearing hint at {:x}", (uintptr_t)data);
const auto NEWCTRL = g_pHyprRenderer->m_vTearingControllers.emplace_back(std::make_unique<STearingController>()).get();
NEWCTRL->pWlrHint = (wlr_tearing_control_v1*)data;
@@ -248,7 +241,7 @@ void Events::listener_newTearingHint(wl_listener* listener, void* data) {
NEWCTRL->hyprListener_destroy.initCallback(
&NEWCTRL->pWlrHint->events.destroy,
[&](void* owner, void* data) {
- Debug::log(LOG, "Destroyed {} tearing hint", (uintptr_t)((STearingController*)owner)->pWlrHint);
+ Debug::log(LOG, "Destroyed {:x} tearing hint", (uintptr_t)((STearingController*)owner)->pWlrHint);
std::erase_if(g_pHyprRenderer->m_vTearingControllers, [&](const auto& other) { return other.get() == owner; });
},
@@ -264,7 +257,7 @@ void Events::listener_newTearingHint(wl_listener* listener, void* data) {
if (PWINDOW) {
PWINDOW->m_bTearingHint = (bool)TEARINGHINT->pWlrHint->current;
- Debug::log(LOG, "Hint {} (window {}) set tearing hint to {}", (uintptr_t)TEARINGHINT->pWlrHint, PWINDOW, (uint32_t)TEARINGHINT->pWlrHint->current);
+ Debug::log(LOG, "Hint {:x} (window {}) set tearing hint to {}", (uintptr_t)TEARINGHINT->pWlrHint, PWINDOW, (uint32_t)TEARINGHINT->pWlrHint->current);
}
},
NEWCTRL, "TearingController");