Match Plasma panel edge areas for clicks and scrolling

This commit is contained in:
ajp_anton
2026-09-11 10:55:27 +00:00
parent 8719402d97
commit ccd0161398
8 changed files with 117 additions and 94 deletions
+5 -3
View File
@@ -50,12 +50,14 @@ PanelController::~PanelController()
}
}
QString PanelController::areaAt(const QPointF &position, bool scrolling)
QString PanelController::areaAt(const QPointF &position)
{
// Dragging outside the panel must not project back onto one of its widgets.
if (!m_panel || !QRectF(0, 0, m_panel->width(), m_panel->height()).contains(position)) return {};
if (!m_locateArea.isCallable()) {
return {};
}
const QJSValue result = m_locateArea.call({position.x(), position.y(), scrolling});
const QJSValue result = m_locateArea.call({position.x(), position.y()});
if (result.isError()) {
qWarning() << "Panel Actions: could not identify panel area:" << result.toString();
return {};
@@ -74,7 +76,7 @@ bool PanelController::eventFilter(QObject *object, QEvent *event)
}
if (event->type() == QEvent::Wheel) {
auto *wheel = static_cast<QWheelEvent *>(event);
const QString area = areaAt(wheel->position(), true);
const QString area = areaAt(wheel->position());
const QString action = m_scrollActions.value(area, QStringLiteral("normal")).toString();
if (action == QLatin1String("normal") || action.isEmpty()) {
m_remainder = 0;
+1 -1
View File
@@ -27,7 +27,7 @@ Q_SIGNALS:
protected:
bool eventFilter(QObject *object, QEvent *event) override;
private:
QString areaAt(const QPointF &position, bool scrolling = false);
QString areaAt(const QPointF &position);
QPointer<QQuickWindow> m_panel;
bool m_active = false;
QJSValue m_locateArea;