From 920353370bba555010506a1c0b204675c60362fe Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Mon, 8 Dec 2025 15:04:40 +0000 Subject: desktop: cleanup, unify desktop elements as views (#12563) --- src/managers/input/Tablets.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/managers/input/Tablets.cpp') diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index 7a9c359a..058d6ac1 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -1,5 +1,5 @@ #include "InputManager.hpp" -#include "../../desktop/Window.hpp" +#include "../../desktop/view/Window.hpp" #include "../../protocols/Tablet.hpp" #include "../../devices/Tablet.hpp" #include "../../managers/HookSystemManager.hpp" @@ -38,7 +38,7 @@ static void focusTool(SP tool, SP tablet, SP tab, SP tool, bool motion = false) { - const auto LASTHLSURFACE = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock()); + const auto LASTHLSURFACE = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock()); if (!LASTHLSURFACE || !tool->m_active) { if (tool->getSurface()) @@ -63,6 +63,8 @@ static void refocusTablet(SP tab, SP tool, bool motion = f if (!motion) return; + const auto WINDOW = Desktop::View::CWindow::fromView(LASTHLSURFACE->view()); + if (LASTHLSURFACE->constraint() && tool->aq()->type != Aquamarine::ITabletTool::AQ_TABLET_TOOL_TYPE_MOUSE) { // cursor logic will completely break here as the cursor will be locked. // let's just "map" the desired position to the constraint area. @@ -70,13 +72,13 @@ static void refocusTablet(SP tab, SP tool, bool motion = f Vector2D local; // yes, this technically ignores any regions set by the app. Too bad! - if (LASTHLSURFACE->getWindow()) - local = tool->m_absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal(); + if (WINDOW) + local = tool->m_absolutePos * WINDOW->m_realSize->goal(); else local = tool->m_absolutePos * BOX->size(); - if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11) - local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy; + if (WINDOW && WINDOW->m_isX11) + local = local * WINDOW->m_X11SurfaceScaledBy; PROTO::tablet->motion(tool, local); return; @@ -84,8 +86,8 @@ static void refocusTablet(SP tab, SP tool, bool motion = f auto local = CURSORPOS - BOX->pos(); - if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11) - local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy; + if (WINDOW && WINDOW->m_isX11) + local = local * WINDOW->m_X11SurfaceScaledBy; PROTO::tablet->motion(tool, local); } -- cgit v1.2.3