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
|
|
@ -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