desktop: cleanup, unify desktop elements as views (#12563)
This commit is contained in:
parent
834f019bab
commit
920353370b
105 changed files with 2636 additions and 2337 deletions
|
|
@ -128,7 +128,7 @@ SP<Aquamarine::IBuffer> CCursorManager::getCursorBuffer() {
|
|||
return !m_cursorBuffers.empty() ? m_cursorBuffers.back() : nullptr;
|
||||
}
|
||||
|
||||
void CCursorManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot) {
|
||||
void CCursorManager::setCursorSurface(SP<Desktop::View::CWLSurface> surf, const Vector2D& hotspot) {
|
||||
if (!surf || !surf->resource())
|
||||
g_pPointerManager->resetCursorImage();
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <string>
|
||||
#include <hyprcursor/hyprcursor.hpp>
|
||||
#include "../includes.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../helpers/math/Math.hpp"
|
||||
#include "../helpers/memory/Memory.hpp"
|
||||
#include "../macros.hpp"
|
||||
|
|
@ -10,8 +11,6 @@
|
|||
#include "managers/XCursorManager.hpp"
|
||||
#include <aquamarine/buffer/Buffer.hpp>
|
||||
|
||||
class CWLSurface;
|
||||
|
||||
AQUAMARINE_FORWARD(IBuffer);
|
||||
|
||||
class CCursorBuffer : public Aquamarine::IBuffer {
|
||||
|
|
@ -43,7 +42,7 @@ class CCursorManager {
|
|||
SP<Aquamarine::IBuffer> getCursorBuffer();
|
||||
|
||||
void setCursorFromName(const std::string& name);
|
||||
void setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot);
|
||||
void setCursorSurface(SP<Desktop::View::CWLSurface> surf, const Vector2D& hotspot);
|
||||
void setCursorBuffer(SP<CCursorBuffer> buf, const Vector2D& hotspot, const float& scale);
|
||||
void setAnimationTimer(const int& frame, const int& delay);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv(PHL
|
|||
}
|
||||
|
||||
result.push_back(std::make_pair<>("HL_INITIAL_WORKSPACE_TOKEN",
|
||||
g_pTokenManager->registerNewToken(SInitialWorkspaceToken{{}, pInitialWorkspace->getConfigName()}, std::chrono::months(1337))));
|
||||
g_pTokenManager->registerNewToken(Desktop::View::SInitialWorkspaceToken{{}, pInitialWorkspace->getConfigName()}, std::chrono::months(1337))));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1294,9 +1294,9 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
|
|||
|
||||
if (*PWARPONWORKSPACECHANGE > 0) {
|
||||
auto PLAST = pWorkspaceToChangeTo->getLastFocusedWindow();
|
||||
auto HLSurface = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||
|
||||
if (PLAST && (!HLSurface || HLSurface->getWindow()))
|
||||
if (PLAST && (!HLSurface || HLSurface->view()->type() == Desktop::View::VIEW_TYPE_WINDOW))
|
||||
PLAST->warpCursor(*PWARPONWORKSPACECHANGE == 2);
|
||||
}
|
||||
|
||||
|
|
@ -1344,16 +1344,17 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) {
|
|||
clientMode = std::stoi(ARGS[1]);
|
||||
} catch (std::exception& e) { clientMode = -1; }
|
||||
|
||||
const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? sc<eFullscreenMode>(internalMode) : PWINDOW->m_fullscreenState.internal),
|
||||
.client = (clientMode != -1 ? sc<eFullscreenMode>(clientMode) : PWINDOW->m_fullscreenState.client)};
|
||||
const Desktop::View::SFullscreenState STATE =
|
||||
Desktop::View::SFullscreenState{.internal = (internalMode != -1 ? sc<eFullscreenMode>(internalMode) : PWINDOW->m_fullscreenState.internal),
|
||||
.client = (clientMode != -1 ? sc<eFullscreenMode>(clientMode) : PWINDOW->m_fullscreenState.client)};
|
||||
|
||||
if (ARGS.size() <= 2 || ARGS[2] == "toggle") {
|
||||
if (internalMode != -1 && clientMode != -1 && PWINDOW->m_fullscreenState.internal == STATE.internal && PWINDOW->m_fullscreenState.client == STATE.client)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
|
||||
else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_fullscreenState.internal == STATE.internal)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_fullscreenState.client});
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_fullscreenState.client});
|
||||
else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_fullscreenState.client == STATE.client)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = FSMODE_NONE});
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, Desktop::View::SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = FSMODE_NONE});
|
||||
else
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, STATE);
|
||||
} else if (ARGS[2] == "set") {
|
||||
|
|
@ -1463,7 +1464,9 @@ SDispatchResult CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
|||
}
|
||||
|
||||
if (PWINDOW == Desktop::focusState()->window()) {
|
||||
if (const auto PATCOORDS = g_pCompositor->vectorToWindowUnified(OLDMIDDLE, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, PWINDOW); PATCOORDS)
|
||||
if (const auto PATCOORDS =
|
||||
g_pCompositor->vectorToWindowUnified(OLDMIDDLE, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING, PWINDOW);
|
||||
PATCOORDS)
|
||||
Desktop::focusState()->fullWindowFocus(PATCOORDS);
|
||||
else
|
||||
g_pInputManager->refocus();
|
||||
|
|
@ -2135,9 +2138,9 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
|||
|
||||
if (*PWARPONTOGGLESPECIAL > 0) {
|
||||
auto PLAST = focusedWorkspace->getLastFocusedWindow();
|
||||
auto HLSurface = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||
|
||||
if (PLAST && (!HLSurface || HLSurface->getWindow()))
|
||||
if (PLAST && (!HLSurface || HLSurface->view()->type() == Desktop::View::VIEW_TYPE_WINDOW))
|
||||
PLAST->warpCursor(*PWARPONTOGGLESPECIAL == 2);
|
||||
}
|
||||
|
||||
|
|
@ -2398,9 +2401,9 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
|||
// pass all mf shit
|
||||
if (!XWTOXW) {
|
||||
if (g_pKeybindManager->m_lastCode != 0)
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->wlSurface()->resource());
|
||||
else
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->wlSurface()->resource(), {1, 1});
|
||||
}
|
||||
|
||||
g_pSeatManager->sendKeyboardMods(g_pInputManager->getModsFromAllKBs(), 0, 0, 0);
|
||||
|
|
@ -2546,15 +2549,15 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
}
|
||||
|
||||
if (!isMouse)
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->wlSurface()->resource());
|
||||
else
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->wlSurface()->resource(), {1, 1});
|
||||
}
|
||||
|
||||
//copied the rest from pass and modified it
|
||||
// if wl -> xwl, activate destination
|
||||
if (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && !Desktop::focusState()->window()->m_isX11)
|
||||
g_pXWaylandManager->activateSurface(PWINDOW->m_wlSurface->resource(), true);
|
||||
g_pXWaylandManager->activateSurface(PWINDOW->wlSurface()->resource(), true);
|
||||
// if xwl -> xwl, send to current. Timing issues make this not work.
|
||||
if (PWINDOW && PWINDOW->m_isX11 && Desktop::focusState()->window() && Desktop::focusState()->window()->m_isX11)
|
||||
PWINDOW = nullptr;
|
||||
|
|
@ -2723,7 +2726,8 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
|
|||
|
||||
const auto PWORKSPACE = PWINDOW->m_workspace;
|
||||
|
||||
PWORKSPACE->m_lastFocusedWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS);
|
||||
PWORKSPACE->m_lastFocusedWindow =
|
||||
g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", rc<uintptr_t>(PWINDOW.get()), sc<int>(PWINDOW->m_pinned))});
|
||||
EMIT_HOOK_EVENT("pin", PWINDOW);
|
||||
|
|
@ -2758,7 +2762,7 @@ SDispatchResult CKeybindManager::changeMouseBindMode(const eMouseBindMode MODE)
|
|||
return {};
|
||||
|
||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||
const PHLWINDOW PWINDOW = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
const PHLWINDOW PWINDOW = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||
|
||||
if (!PWINDOW)
|
||||
return SDispatchResult{.passEvent = true};
|
||||
|
|
@ -3014,7 +3018,7 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) {
|
|||
} else
|
||||
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
|
||||
} else if (PWINDOWINDIR) { // target is regular window
|
||||
if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_groupRules & GROUP_SET_ALWAYS)) {
|
||||
if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_groupRules & Desktop::View::GROUP_SET_ALWAYS)) {
|
||||
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
|
||||
PWINDOW->warpCursor();
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ void CPointerManager::setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2
|
|||
damageIfSoftware();
|
||||
}
|
||||
|
||||
void CPointerManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot) {
|
||||
void CPointerManager::setCursorSurface(SP<Desktop::View::CWLSurface> surf, const Vector2D& hotspot) {
|
||||
damageIfSoftware();
|
||||
|
||||
if (surf == m_currentCursorImage.surface) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "../devices/ITouch.hpp"
|
||||
#include "../devices/Tablet.hpp"
|
||||
#include "../helpers/math/Math.hpp"
|
||||
#include "../desktop/WLSurface.hpp"
|
||||
#include "../desktop/view/WLSurface.hpp"
|
||||
#include "../helpers/sync/SyncTimeline.hpp"
|
||||
#include "../helpers/time/Time.hpp"
|
||||
#include <tuple>
|
||||
|
|
@ -40,7 +40,7 @@ class CPointerManager {
|
|||
void warpAbsolute(Vector2D abs, SP<IHID> dev);
|
||||
|
||||
void setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2D& hotspot, const float& scale);
|
||||
void setCursorSurface(SP<CWLSurface> buf, const Vector2D& hotspot);
|
||||
void setCursorSurface(SP<Desktop::View::CWLSurface> buf, const Vector2D& hotspot);
|
||||
void resetCursorImage(bool apply = true);
|
||||
|
||||
void lockSoftwareForMonitor(PHLMONITOR pMonitor);
|
||||
|
|
@ -140,16 +140,16 @@ class CPointerManager {
|
|||
} m_currentMonitorLayout;
|
||||
|
||||
struct {
|
||||
SP<Aquamarine::IBuffer> pBuffer;
|
||||
SP<CTexture> bufferTex;
|
||||
WP<CWLSurface> surface;
|
||||
SP<Aquamarine::IBuffer> pBuffer;
|
||||
SP<CTexture> bufferTex;
|
||||
WP<Desktop::View::CWLSurface> surface;
|
||||
|
||||
Vector2D hotspot;
|
||||
Vector2D size;
|
||||
float scale = 1.F;
|
||||
Vector2D hotspot;
|
||||
Vector2D size;
|
||||
float scale = 1.F;
|
||||
|
||||
CHyprSignalListener destroySurface;
|
||||
CHyprSignalListener commitSurface;
|
||||
CHyprSignalListener destroySurface;
|
||||
CHyprSignalListener commitSurface;
|
||||
} m_currentCursorImage; // TODO: support various sizes per-output so we can have pixel-perfect cursors
|
||||
|
||||
Vector2D m_pointerPos = {0, 0};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "../Compositor.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../devices/IKeyboard.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
#include "../desktop/view/LayerSurface.hpp"
|
||||
#include "../managers/input/InputManager.hpp"
|
||||
#include "../managers/HookSystemManager.hpp"
|
||||
#include "wlr-layer-shell-unstable-v1.hpp"
|
||||
|
|
@ -517,7 +517,7 @@ void CSeatManager::refocusGrab() {
|
|||
// try to find a surf in focus first
|
||||
const auto MOUSE = g_pInputManager->getMouseCoordsInternal();
|
||||
for (auto const& s : m_seatGrab->m_surfs) {
|
||||
auto hlSurf = CWLSurface::fromResource(s.lock());
|
||||
auto hlSurf = Desktop::View::CWLSurface::fromResource(s.lock());
|
||||
if (!hlSurf)
|
||||
continue;
|
||||
|
||||
|
|
@ -640,13 +640,13 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
|
|||
focusedSurf = oldGrab->m_surfs.front().lock();
|
||||
|
||||
if (focusedSurf) {
|
||||
auto hlSurface = CWLSurface::fromResource(focusedSurf);
|
||||
auto hlSurface = Desktop::View::CWLSurface::fromResource(focusedSurf);
|
||||
if (hlSurface) {
|
||||
auto popup = hlSurface->getPopup();
|
||||
auto popup = Desktop::View::CPopup::fromView(hlSurface->view());
|
||||
if (popup) {
|
||||
auto t1Owner = popup->getT1Owner();
|
||||
if (t1Owner)
|
||||
parentWindow = t1Owner->getWindow();
|
||||
parentWindow = Desktop::View::CWindow::fromView(t1Owner->view());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -667,22 +667,22 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
|
|||
} else
|
||||
g_pInputManager->refocus();
|
||||
|
||||
auto currentFocus = m_state.keyboardFocus.lock();
|
||||
auto refocus = !currentFocus;
|
||||
auto currentFocus = m_state.keyboardFocus.lock();
|
||||
auto refocus = !currentFocus;
|
||||
|
||||
SP<CWLSurface> surf;
|
||||
PHLLS layer;
|
||||
SP<Desktop::View::CWLSurface> surf;
|
||||
PHLLS layer;
|
||||
|
||||
if (!refocus) {
|
||||
surf = CWLSurface::fromResource(currentFocus);
|
||||
layer = surf ? surf->getLayer() : nullptr;
|
||||
surf = Desktop::View::CWLSurface::fromResource(currentFocus);
|
||||
layer = surf ? Desktop::View::CLayerSurface::fromView(surf->view()) : nullptr;
|
||||
}
|
||||
|
||||
if (!refocus && !layer) {
|
||||
auto popup = surf ? surf->getPopup() : nullptr;
|
||||
auto popup = surf ? Desktop::View::CPopup::fromView(surf->view()) : nullptr;
|
||||
if (popup) {
|
||||
auto parent = popup->getT1Owner();
|
||||
layer = parent->getLayer();
|
||||
layer = Desktop::View::CLayerSurface::fromView(parent->view());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "../protocols/SessionLock.hpp"
|
||||
#include "../render/Renderer.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../desktop/view/SessionLock.hpp"
|
||||
#include "./managers/SeatManager.hpp"
|
||||
#include "./managers/input/InputManager.hpp"
|
||||
#include "./managers/eventLoop/EventLoopManager.hpp"
|
||||
|
|
@ -68,9 +69,11 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
|
|||
m_sessionLock->listeners.newSurface = pLock->m_events.newLockSurface.listen([this](const SP<CSessionLockSurface>& surface) {
|
||||
const auto PMONITOR = surface->monitor();
|
||||
|
||||
const auto NEWSURFACE = m_sessionLock->vSessionLockSurfaces.emplace_back(makeUnique<SSessionLockSurface>(surface)).get();
|
||||
const auto NEWSURFACE = m_sessionLock->vSessionLockSurfaces.emplace_back(makeShared<SSessionLockSurface>(surface));
|
||||
NEWSURFACE->iMonitorID = PMONITOR->m_id;
|
||||
PROTO::fractional->sendScale(surface->surface(), PMONITOR->m_scale);
|
||||
|
||||
g_pCompositor->m_otherViews.emplace_back(Desktop::View::CSessionLock::create(surface));
|
||||
});
|
||||
|
||||
m_sessionLock->listeners.unlock = pLock->m_events.unlockAndDestroy.listen([this] {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ struct SSessionLock {
|
|||
CTimer lockTimer;
|
||||
SP<CEventLoopTimer> sendDeniedTimer;
|
||||
|
||||
std::vector<UP<SSessionLockSurface>> vSessionLockSurfaces;
|
||||
std::vector<SP<SSessionLockSurface>> vSessionLockSurfaces;
|
||||
|
||||
struct {
|
||||
CHyprSignalListener newSurface;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "XWaylandManager.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../desktop/state/FocusState.hpp"
|
||||
#include "../events/Events.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../protocols/XDGShell.hpp"
|
||||
|
|
@ -22,20 +21,20 @@ CHyprXWaylandManager::~CHyprXWaylandManager() {
|
|||
}
|
||||
|
||||
SP<CWLSurfaceResource> CHyprXWaylandManager::getWindowSurface(PHLWINDOW pWindow) {
|
||||
return pWindow ? pWindow->m_wlSurface->resource() : nullptr;
|
||||
return pWindow ? pWindow->wlSurface()->resource() : nullptr;
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::activateSurface(SP<CWLSurfaceResource> pSurface, bool activate) {
|
||||
if (!pSurface)
|
||||
return;
|
||||
|
||||
auto HLSurface = CWLSurface::fromResource(pSurface);
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(pSurface);
|
||||
if (!HLSurface) {
|
||||
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-desktop surface, ignoring");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto PWINDOW = HLSurface->getWindow();
|
||||
const auto PWINDOW = Desktop::View::CWindow::fromView(HLSurface->view());
|
||||
if (!PWINDOW) {
|
||||
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-window surface, ignoring");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include "../desktop/DesktopTypes.hpp"
|
||||
#include <optional>
|
||||
|
||||
class CWindow; // because clangd
|
||||
using PHLWINDOW = SP<CWindow>;
|
||||
class CWLSurfaceResource;
|
||||
|
||||
class CHyprXWaylandManager {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
#include "../../helpers/AnimatedVariable.hpp"
|
||||
#include "../../macros.hpp"
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/view/Window.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../eventLoop/EventLoopManager.hpp"
|
||||
#include "../../helpers/varlist/VarList.hpp"
|
||||
#include "../../render/Renderer.hpp"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "DesktopAnimationManager.hpp"
|
||||
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../../desktop/view/Window.hpp"
|
||||
#include "../../desktop/Workspace.hpp"
|
||||
|
||||
#include "../../config/ConfigManager.hpp"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
|||
recheckIdleInhibitorStatus();
|
||||
});
|
||||
|
||||
auto WLSurface = CWLSurface::fromResource(PINHIBIT->inhibitor->m_surface.lock());
|
||||
auto WLSurface = Desktop::View::CWLSurface::fromResource(PINHIBIT->inhibitor->m_surface.lock());
|
||||
|
||||
if (!WLSurface) {
|
||||
Debug::log(LOG, "Inhibitor has no HL Surface attached to it, likely meaning it's a non-desktop element. Assuming it's visible.");
|
||||
|
|
@ -38,7 +38,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
|
|||
return;
|
||||
}
|
||||
|
||||
auto WLSurface = CWLSurface::fromResource(ii->inhibitor->m_surface.lock());
|
||||
auto WLSurface = Desktop::View::CWLSurface::fromResource(ii->inhibitor->m_surface.lock());
|
||||
|
||||
if (!WLSurface)
|
||||
continue;
|
||||
|
|
@ -78,12 +78,12 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
|
|||
continue;
|
||||
|
||||
bool isInhibiting = false;
|
||||
w->m_wlSurface->resource()->breadthfirst(
|
||||
w->wlSurface()->resource()->breadthfirst(
|
||||
[&ii](SP<CWLSurfaceResource> surf, const Vector2D& pos, void* data) {
|
||||
if (ii->inhibitor->m_surface != surf)
|
||||
return;
|
||||
|
||||
auto WLSurface = CWLSurface::fromResource(surf);
|
||||
auto WLSurface = Desktop::View::CWLSurface::fromResource(surf);
|
||||
|
||||
if (!WLSurface)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
#include <algorithm>
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../config/ConfigManager.hpp"
|
||||
#include "../../desktop/Window.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/view/Window.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../protocols/CursorShape.hpp"
|
||||
#include "../../protocols/IdleInhibit.hpp"
|
||||
|
|
@ -95,7 +95,7 @@ CInputManager::CInputManager() {
|
|||
g_pHyprRenderer->setCursorFromName(shape);
|
||||
});
|
||||
|
||||
m_cursorSurfaceInfo.wlSurface = CWLSurface::create();
|
||||
m_cursorSurfaceInfo.wlSurface = Desktop::View::CWLSurface::create();
|
||||
}
|
||||
|
||||
CInputManager::~CInputManager() {
|
||||
|
|
@ -240,7 +240,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
// constraints
|
||||
if (!g_pSeatManager->m_mouse.expired() && isConstrained()) {
|
||||
const auto SURF = CWLSurface::fromResource(Desktop::focusState()->surface());
|
||||
const auto SURF = Desktop::View::CWLSurface::fromResource(Desktop::focusState()->surface());
|
||||
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
|
||||
|
||||
if (CONSTRAINT) {
|
||||
|
|
@ -251,7 +251,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
const auto RG = CONSTRAINT->logicConstraintRegion();
|
||||
const auto CLOSEST = RG.closestPoint(mouseCoords);
|
||||
const auto BOX = SURF->getSurfaceBoxGlobal();
|
||||
const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (SURF->getWindow() ? SURF->getWindow()->m_X11SurfaceScaledBy : 1.0);
|
||||
const auto WINDOW = Desktop::View::CWindow::fromView(SURF->view());
|
||||
const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (WINDOW ? WINDOW->m_X11SurfaceScaledBy : 1.0);
|
||||
|
||||
g_pCompositor->warpCursorTo(CLOSEST, true);
|
||||
g_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL);
|
||||
|
|
@ -268,7 +269,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
Desktop::focusState()->rawMonitorFocus(PMONITOR);
|
||||
|
||||
// check for windows that have focus priority like our permission popups
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, FOCUS_PRIORITY);
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::FOCUS_PRIORITY);
|
||||
if (pFoundWindow)
|
||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
|
||||
|
|
@ -313,7 +314,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
if (forcedFocus && !foundSurface) {
|
||||
pFoundWindow = forcedFocus;
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
}
|
||||
|
||||
// if we are holding a pointer button,
|
||||
|
|
@ -330,15 +331,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
m_focusHeldByButtons = true;
|
||||
m_refocusHeldByButtons = refocus;
|
||||
} else {
|
||||
auto HLSurface = CWLSurface::fromResource(foundSurface);
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(foundSurface);
|
||||
|
||||
if (HLSurface) {
|
||||
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
||||
|
||||
if (BOX) {
|
||||
const auto PWINDOW = HLSurface->getWindow();
|
||||
const auto PWINDOW = HLSurface->view()->type() == Desktop::View::VIEW_TYPE_WINDOW ? dynamicPointerCast<Desktop::View::CWindow>(HLSurface->view()) : nullptr;
|
||||
surfacePos = BOX->pos();
|
||||
pFoundLayerSurface = HLSurface->getLayer();
|
||||
pFoundLayerSurface =
|
||||
HLSurface->view()->type() == Desktop::View::VIEW_TYPE_LAYER_SURFACE ? dynamicPointerCast<Desktop::View::CLayerSurface>(HLSurface->view()) : nullptr;
|
||||
if (!pFoundLayerSurface)
|
||||
pFoundWindow = !PWINDOW || PWINDOW->isHidden() ? Desktop::focusState()->window() : PWINDOW;
|
||||
} else // reset foundSurface, find one normally
|
||||
|
|
@ -356,7 +358,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &g_pInputManager->m_exclusiveLSes, &surfaceCoords, &pFoundLayerSurface);
|
||||
|
||||
if (!foundSurface) {
|
||||
foundSurface = (*g_pInputManager->m_exclusiveLSes.begin())->m_surface->resource();
|
||||
foundSurface = (*g_pInputManager->m_exclusiveLSes.begin())->wlSurface()->resource();
|
||||
surfacePos = (*g_pInputManager->m_exclusiveLSes.begin())->m_realPosition->goal();
|
||||
}
|
||||
}
|
||||
|
|
@ -383,7 +385,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
// then, we check if the workspace doesn't have a fullscreen window
|
||||
const auto PWORKSPACE = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
|
||||
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||
if (PWORKSPACE->m_hasFullscreenWindow && !foundSurface && PWORKSPACE->m_fullscreenMode == FSMODE_FULLSCREEN) {
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
|
||||
|
|
@ -402,7 +404,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
surfacePos = Vector2D(-1337, -1337);
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
}
|
||||
|
|
@ -413,7 +415,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
if (!foundSurface) {
|
||||
if (PMONITOR->m_activeSpecialWorkspace) {
|
||||
if (pFoundWindow != PWINDOWIDEAL)
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
pFoundWindow =
|
||||
g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||
|
||||
if (pFoundWindow && !pFoundWindow->onSpecialWorkspace()) {
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
|
|
@ -427,7 +430,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
if (!foundSurface) {
|
||||
if (pFoundWindow != PWINDOWIDEAL)
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
pFoundWindow =
|
||||
g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||
|
||||
if (!(pFoundWindow && (pFoundWindow->m_isFloating && (pFoundWindow->m_createdOverFullscreen || pFoundWindow->m_pinned))))
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
|
|
@ -437,18 +441,18 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
|
||||
} else {
|
||||
if (pFoundWindow != PWINDOWIDEAL)
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||
}
|
||||
|
||||
if (pFoundWindow) {
|
||||
if (!pFoundWindow->m_isX11) {
|
||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
if (!foundSurface) {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
foundSurface = pFoundWindow->wlSurface()->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
}
|
||||
|
|
@ -474,7 +478,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
// we need to grab the last surface.
|
||||
foundSurface = g_pSeatManager->m_state.pointerFocus.lock();
|
||||
|
||||
auto HLSurface = CWLSurface::fromResource(foundSurface);
|
||||
auto HLSurface = Desktop::View::CWLSurface::fromResource(foundSurface);
|
||||
|
||||
if (HLSurface) {
|
||||
const auto BOX = HLSurface->getSurfaceBoxGlobal();
|
||||
|
|
@ -534,7 +538,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st
|
|||
return;
|
||||
}
|
||||
|
||||
if (pFoundWindow && foundSurface == pFoundWindow->m_wlSurface->resource() && !m_cursorImageOverridden) {
|
||||
if (pFoundWindow && foundSurface == pFoundWindow->wlSurface()->resource() && !m_cursorImageOverridden) {
|
||||
const auto BOX = pFoundWindow->getWindowMainSurfaceBox();
|
||||
if (VECNOTINRECT(mouseCoords, BOX.x, BOX.y, BOX.x + BOX.width, BOX.y + BOX.height))
|
||||
g_pHyprRenderer->setCursorFromName("left_ptr");
|
||||
|
|
@ -738,7 +742,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
return;
|
||||
|
||||
const auto mouseCoords = g_pInputManager->getMouseCoordsInternal();
|
||||
const auto w = g_pCompositor->vectorToWindowUnified(mouseCoords, ALLOW_FLOATING | RESERVED_EXTENTS | INPUT_EXTENTS);
|
||||
const auto w = g_pCompositor->vectorToWindowUnified(mouseCoords, Desktop::View::ALLOW_FLOATING | Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
|
||||
|
||||
if (w && !m_lastFocusOnLS && !g_pSessionLockManager->isSessionLocked() && w->checkInputOnDecos(INPUT_TYPE_BUTTON, mouseCoords, e))
|
||||
return;
|
||||
|
|
@ -779,10 +783,10 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
if (!g_pSeatManager->m_state.pointerFocus)
|
||||
break;
|
||||
|
||||
auto HLSurf = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||
auto HLSurf = Desktop::View::CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
|
||||
|
||||
if (HLSurf && HLSurf->getWindow())
|
||||
g_pCompositor->changeWindowZOrder(HLSurf->getWindow(), true);
|
||||
if (HLSurf && HLSurf->view()->type() == Desktop::View::VIEW_TYPE_WINDOW)
|
||||
g_pCompositor->changeWindowZOrder(dynamicPointerCast<Desktop::View::CWindow>(HLSurf->view()), true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -805,7 +809,8 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
void CInputManager::processMouseDownKill(const IPointer::SButtonEvent& e) {
|
||||
switch (e.state) {
|
||||
case WL_POINTER_BUTTON_STATE_PRESSED: {
|
||||
const auto PWINDOW = g_pCompositor->vectorToWindowUnified(getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
const auto PWINDOW =
|
||||
g_pCompositor->vectorToWindowUnified(getMouseCoordsInternal(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||
|
||||
if (!PWINDOW) {
|
||||
Debug::log(ERR, "Cannot kill invalid window!");
|
||||
|
|
@ -851,7 +856,7 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e, SP<IPointer> pointer) {
|
|||
|
||||
if (!m_lastFocusOnLS) {
|
||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||
const auto PWINDOW = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
const auto PWINDOW = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
|
||||
|
||||
if (PWINDOW) {
|
||||
if (PWINDOW->checkInputOnDecos(INPUT_TYPE_AXIS, MOUSECOORDS, e))
|
||||
|
|
@ -1624,7 +1629,7 @@ bool CInputManager::isLocked() {
|
|||
if (!isConstrained())
|
||||
return false;
|
||||
|
||||
const auto SURF = CWLSurface::fromResource(Desktop::focusState()->surface());
|
||||
const auto SURF = Desktop::View::CWLSurface::fromResource(Desktop::focusState()->surface());
|
||||
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
|
||||
|
||||
return CONSTRAINT && CONSTRAINT->isLocked();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "../../helpers/time/Timer.hpp"
|
||||
#include "InputMethodRelay.hpp"
|
||||
#include "../../helpers/signal/Signal.hpp"
|
||||
#include "../../desktop/view/WLSurface.hpp"
|
||||
#include "../../devices/IPointer.hpp"
|
||||
#include "../../devices/ITouch.hpp"
|
||||
#include "../../devices/IKeyboard.hpp"
|
||||
|
|
@ -15,7 +16,6 @@
|
|||
#include "../SeatManager.hpp"
|
||||
|
||||
class CPointerConstraint;
|
||||
class CWindow;
|
||||
class CIdleInhibitor;
|
||||
class CVirtualKeyboardV1Resource;
|
||||
class CVirtualPointerV1Resource;
|
||||
|
|
@ -281,10 +281,10 @@ class CInputManager {
|
|||
|
||||
// cursor surface
|
||||
struct {
|
||||
bool hidden = false; // null surface = hidden
|
||||
SP<CWLSurface> wlSurface;
|
||||
Vector2D vHotspot;
|
||||
std::string name; // if not empty, means set by name.
|
||||
bool hidden = false; // null surface = hidden
|
||||
SP<Desktop::View::CWLSurface> wlSurface;
|
||||
Vector2D vHotspot;
|
||||
std::string name; // if not empty, means set by name.
|
||||
} m_cursorSurfaceInfo;
|
||||
|
||||
void restoreCursorIconToApp(); // no-op if restored
|
||||
|
|
@ -303,7 +303,7 @@ class CInputManager {
|
|||
uint32_t m_lastMods = 0;
|
||||
|
||||
friend class CKeybindManager;
|
||||
friend class CWLSurface;
|
||||
friend class Desktop::View::CWLSurface;
|
||||
friend class CWorkspaceSwipeGesture;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@ CInputPopup::CInputPopup(SP<CInputMethodPopupV2> popup_) : m_popup(popup_) {
|
|||
m_listeners.map = popup_->m_events.map.listen([this] { onMap(); });
|
||||
m_listeners.unmap = popup_->m_events.unmap.listen([this] { onUnmap(); });
|
||||
m_listeners.destroy = popup_->m_events.destroy.listen([this] { onDestroy(); });
|
||||
m_surface = CWLSurface::create();
|
||||
m_surface = Desktop::View::CWLSurface::create();
|
||||
m_surface->assign(popup_->surface());
|
||||
}
|
||||
|
||||
SP<CWLSurface> CInputPopup::queryOwner() {
|
||||
SP<Desktop::View::CWLSurface> CInputPopup::queryOwner() {
|
||||
const auto FOCUSED = g_pInputManager->m_relay.getFocusedTextInput();
|
||||
|
||||
if (!FOCUSED)
|
||||
return nullptr;
|
||||
|
||||
return CWLSurface::fromResource(FOCUSED->focusedSurface());
|
||||
return Desktop::View::CWLSurface::fromResource(FOCUSED->focusedSurface());
|
||||
}
|
||||
|
||||
void CInputPopup::onDestroy() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../desktop/WLSurface.hpp"
|
||||
#include "../../desktop/view/WLSurface.hpp"
|
||||
#include "../../macros.hpp"
|
||||
#include "../../helpers/math/Math.hpp"
|
||||
#include "../../helpers/signal/Signal.hpp"
|
||||
|
|
@ -22,17 +22,17 @@ class CInputPopup {
|
|||
void onCommit();
|
||||
|
||||
private:
|
||||
SP<CWLSurface> queryOwner();
|
||||
void updateBox();
|
||||
SP<Desktop::View::CWLSurface> queryOwner();
|
||||
void updateBox();
|
||||
|
||||
void onDestroy();
|
||||
void onMap();
|
||||
void onUnmap();
|
||||
void onDestroy();
|
||||
void onMap();
|
||||
void onUnmap();
|
||||
|
||||
WP<CInputMethodPopupV2> m_popup;
|
||||
SP<CWLSurface> m_surface;
|
||||
CBox m_lastBoxLocal;
|
||||
MONITORID m_lastMonitor = MONITOR_INVALID;
|
||||
WP<CInputMethodPopupV2> m_popup;
|
||||
SP<Desktop::View::CWLSurface> m_surface;
|
||||
CBox m_lastBoxLocal;
|
||||
MONITORID m_lastMonitor = MONITOR_INVALID;
|
||||
|
||||
struct {
|
||||
CHyprSignalListener map;
|
||||
|
|
|
|||
|
|
@ -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<CTabletTool> tool, SP<CTablet> tablet, SP<CWLSurfaceRes
|
|||
}
|
||||
|
||||
static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> 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<CTablet> tab, SP<CTabletTool> 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<CTablet> tab, SP<CTabletTool> 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<CTablet> tab, SP<CTabletTool> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "../SessionLockManager.hpp"
|
||||
#include "../../protocols/SessionLock.hpp"
|
||||
#include "../../Compositor.hpp"
|
||||
#include "../../desktop/LayerSurface.hpp"
|
||||
#include "../../desktop/view/LayerSurface.hpp"
|
||||
#include "../../desktop/state/FocusState.hpp"
|
||||
#include "../../config/ConfigValue.hpp"
|
||||
#include "../../helpers/Monitor.hpp"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
#include "../../../../desktop/view/Window.hpp"
|
||||
|
||||
constexpr const float MAX_DISTANCE = 250.F;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "MoveGesture.hpp"
|
||||
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
#include "../../../../desktop/view/Window.hpp"
|
||||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "ResizeGesture.hpp"
|
||||
|
||||
#include "../../../../desktop/state/FocusState.hpp"
|
||||
#include "../../../../desktop/Window.hpp"
|
||||
#include "../../../../desktop/view/Window.hpp"
|
||||
#include "../../../../managers/LayoutManager.hpp"
|
||||
#include "../../../../render/Renderer.hpp"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue