Deliver wheel events to internal windows using QWindowSystemInterface api

wilder/Plasma/6.3
Vlad Zahorodnii 2 years ago
parent 37d9af370b
commit dab45b94c2
  1. 21
      src/input.cpp

@ -1233,15 +1233,18 @@ public:
return false;
}
QWindow *internal = static_cast<InternalWindow *>(input()->pointer()->focus())->handle();
const QPointF localPos = event->globalPosition() - internal->position();
QWheelEvent wheelEvent(localPos, event->globalPosition(), QPoint(),
event->angleDelta() * -1,
event->buttons(),
event->modifiers(),
Qt::NoScrollPhase,
false);
QCoreApplication::sendEvent(internal, &wheelEvent);
return wheelEvent.isAccepted();
const auto timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(event->timestamp());
const bool isAccepted = QWindowSystemInterface::handleWheelEvent(internal,
timestamp.count(),
event->globalPosition() - internal->position(),
event->globalPosition(),
QPoint(),
event->angleDelta() * -1,
event->modifiers(),
Qt::NoScrollPhase,
Qt::MouseEventNotSynthesized,
event->inverted());
return isAccepted;
}
bool keyEvent(KeyEvent *event) override
{

Loading…
Cancel
Save