MCPcopy Create free account
hub / github.com/KDE/kwin / motion

Method motion

src/input.cpp:2865–2907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2863 }
2864
2865 void motion(const QPointF &position, std::chrono::microseconds time)
2866 {
2867 SeatInterface *seat = waylandServer()->seat();
2868 seat->setTimestamp(time);
2869
2870 if (auto window = m_currentToplevelDragWindow) {
2871 window->updateInteractiveMoveResize(position, input()->keyboardModifiers());
2872 }
2873
2874 Window *dragTarget = pickDragTarget(position);
2875 if (dragTarget) {
2876 if (dragTarget != m_dragTarget) {
2877 workspace()->requestFocus(dragTarget);
2878 m_raiseTimer.start();
2879 }
2880 if (!m_lastPos || (position - *m_lastPos).manhattanLength() > 10) {
2881 m_lastPos = position;
2882 // reset timer to delay raising the window
2883 m_raiseTimer.start();
2884 }
2885 }
2886 m_dragTarget = dragTarget;
2887
2888 if (auto *xwl = kwinApp()->xwayland()) {
2889 if (xwl->dragMoveFilter(dragTarget, position)) {
2890 return;
2891 }
2892 }
2893
2894 if (dragTarget && dragTarget->surface()) {
2895 const auto [effectiveSurface, offset] = dragTarget->surface()->mapToInputSurface(dragTarget->mapToLocal(position));
2896 if (seat->dragSurface() != effectiveSurface) {
2897 QMatrix4x4 inputTransformation = dragTarget->inputTransformation();
2898 inputTransformation.translate(-QVector3D(effectiveSurface->mapToMainSurface(QPointF(0, 0))));
2899 seat->setDragTarget(dropHandler(dragTarget), effectiveSurface, position, inputTransformation);
2900 } else {
2901 seat->notifyDragMotion(position);
2902 }
2903 } else {
2904 // no window at that place, if we have a surface we need to reset
2905 seat->setDragTarget(nullptr, nullptr, QPointF(), QMatrix4x4());
2906 }
2907 }
2908
2909 std::optional<QPointF> m_lastPos = std::nullopt;
2910 QPointer<Window> m_dragTarget;

Callers

nothing calls this directly

Calls 15

waylandServerFunction · 0.85
inputFunction · 0.85
workspaceFunction · 0.85
kwinAppFunction · 0.85
QPointFClass · 0.85
dropHandlerFunction · 0.85
QMatrix4x4Class · 0.85
requestFocusMethod · 0.80
mapToInputSurfaceMethod · 0.80
mapToLocalMethod · 0.80
dragSurfaceMethod · 0.80

Tested by

no test coverage detected