core: handle fractionalScale in onclick and hover

This commit is contained in:
Maximilian Seidler 2025-04-11 12:08:25 +02:00
parent 1fdb3367cb
commit b392f713af

View file

@ -676,9 +676,10 @@ void CHyprlock::onClick(uint32_t button, bool down, const Vector2D& pos) {
if (!m_focusedOutput->m_sessionLockSurface) if (!m_focusedOutput->m_sessionLockSurface)
return; return;
const auto SCALEDPOS = pos * m_focusedOutput->m_sessionLockSurface->fractionalScale;
const auto widgets = g_pRenderer->getOrCreateWidgetsFor(*m_focusedOutput->m_sessionLockSurface); const auto widgets = g_pRenderer->getOrCreateWidgetsFor(*m_focusedOutput->m_sessionLockSurface);
for (const auto& widget : widgets) { for (const auto& widget : widgets) {
if (widget->containsPoint(pos)) if (widget->containsPoint(SCALEDPOS))
widget->onClick(button, down, pos); widget->onClick(button, down, pos);
} }
} }
@ -693,9 +694,10 @@ void CHyprlock::onHover(const Vector2D& pos) {
bool outputNeedsRedraw = false; bool outputNeedsRedraw = false;
bool cursorChanged = false; bool cursorChanged = false;
const auto SCALEDPOS = pos * m_focusedOutput->m_sessionLockSurface->fractionalScale;
const auto widgets = g_pRenderer->getOrCreateWidgetsFor(*m_focusedOutput->m_sessionLockSurface); const auto widgets = g_pRenderer->getOrCreateWidgetsFor(*m_focusedOutput->m_sessionLockSurface);
for (const auto& widget : widgets) { for (const auto& widget : widgets) {
const bool CONTAINSPOINT = widget->containsPoint(pos); const bool CONTAINSPOINT = widget->containsPoint(SCALEDPOS);
const bool HOVERED = widget->isHovered(); const bool HOVERED = widget->isHovered();
if (CONTAINSPOINT) { if (CONTAINSPOINT) {