mirror of
https://github.com/hyprwm/hyprlock.git
synced 2025-05-20 00:57:48 +01:00
core: handle fractionalScale in onclick and hover
This commit is contained in:
parent
1fdb3367cb
commit
b392f713af
1 changed files with 6 additions and 4 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue