From 8321d6be46ed2df7dfe7ec142716a7d1a50d2d5e Mon Sep 17 00:00:00 2001 From: dranull <150595692+dranull@users.noreply.github.com> Date: Thu, 28 Dec 2023 22:54:41 +0000 Subject: internal: Unify input handling on decorations (#4280) * Unify input handling on decorations * Make input methods private * Optional data --- src/Window.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/Window.cpp') diff --git a/src/Window.cpp b/src/Window.cpp index 9df8ef69..75a1dc2a 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -222,6 +222,24 @@ void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) { g_pLayoutManager->getCurrentLayout()->recalculateWindow(this); } +bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoords, std::any data) { + if (type != INPUT_TYPE_DRAG_END && hasPopupAt(mouseCoords)) + return false; + + for (auto& wd : m_dWindowDecorations) { + if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT)) + continue; + + if (!g_pDecorationPositioner->getWindowDecorationBox(wd.get()).containsPoint(mouseCoords)) + continue; + + if (wd->onInputOnDeco(type, mouseCoords, data)) + return true; + } + + return false; +} + pid_t CWindow::getPID() { pid_t PID = -1; if (!m_bIsX11) { -- cgit v1.2.3