mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 07:30:05 +01:00
input: cleanup sendMotionEventsToFocused()
This commit is contained in:
parent
c5beecb2c3
commit
beb1b578e8
1 changed files with 20 additions and 7 deletions
|
|
@ -7,8 +7,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "../../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
#include "../../config/ConfigManager.hpp"
|
#include "../../config/ConfigManager.hpp"
|
||||||
#include "../../desktop/view/Window.hpp"
|
#include "../../desktop/view/WLSurface.hpp"
|
||||||
#include "../../desktop/view/LayerSurface.hpp"
|
|
||||||
#include "../../desktop/state/FocusState.hpp"
|
#include "../../desktop/state/FocusState.hpp"
|
||||||
#include "../../protocols/CursorShape.hpp"
|
#include "../../protocols/CursorShape.hpp"
|
||||||
#include "../../protocols/IdleInhibit.hpp"
|
#include "../../protocols/IdleInhibit.hpp"
|
||||||
|
|
@ -172,15 +171,29 @@ void CInputManager::sendMotionEventsToFocused() {
|
||||||
if (!Desktop::focusState()->surface() || isConstrained())
|
if (!Desktop::focusState()->surface() || isConstrained())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// todo: this sucks ass
|
const auto SURF = Desktop::focusState()->surface();
|
||||||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(Desktop::focusState()->surface());
|
|
||||||
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(Desktop::focusState()->surface());
|
|
||||||
|
|
||||||
const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_realPosition->goal() : (PLS ? Vector2D{PLS->m_geometry.x, PLS->m_geometry.y} : Vector2D{}));
|
if (!SURF)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto HLSurf = Desktop::View::CWLSurface::fromResource(SURF);
|
||||||
|
|
||||||
|
if (!HLSurf || !HLSurf->view())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto VIEW = HLSurf->view();
|
||||||
|
|
||||||
|
if (!VIEW->aliveAndVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto BOX = HLSurf->getSurfaceBoxGlobal();
|
||||||
|
|
||||||
|
if (!BOX)
|
||||||
|
return;
|
||||||
|
|
||||||
m_emptyFocusCursorSet = false;
|
m_emptyFocusCursorSet = false;
|
||||||
|
|
||||||
g_pSeatManager->setPointerFocus(Desktop::focusState()->surface(), LOCAL);
|
g_pSeatManager->setPointerFocus(Desktop::focusState()->surface(), m_lastCursorPosFloored - BOX->pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, std::optional<Vector2D> overridePos) {
|
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, std::optional<Vector2D> overridePos) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue