Allow activating decoration buttons with touch
Task-number: QTBUG-41142 Change-Id: Ifad600d375d3b5ba197c384ece54a93db9aa0d2d Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
This commit is contained in:
parent
c1ed159653
commit
0fdbe40ad4
@ -340,12 +340,21 @@ bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPo
|
|||||||
Q_UNUSED(inputDevice);
|
Q_UNUSED(inputDevice);
|
||||||
Q_UNUSED(global);
|
Q_UNUSED(global);
|
||||||
Q_UNUSED(mods);
|
Q_UNUSED(mods);
|
||||||
|
bool handled = state == Qt::TouchPointPressed;
|
||||||
if (state == Qt::TouchPointPressed && local.y() <= m_margins.top()) {
|
if (handled) {
|
||||||
|
if (closeButtonRect().contains(local))
|
||||||
|
QWindowSystemInterface::handleCloseEvent(m_window);
|
||||||
|
else if (maximizeButtonRect().contains(local))
|
||||||
|
m_window->setWindowState(m_wayland_window->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized);
|
||||||
|
else if (minimizeButtonRect().contains(local))
|
||||||
|
m_window->setWindowState(Qt::WindowMinimized);
|
||||||
|
else if (local.y() <= m_margins.top())
|
||||||
m_wayland_window->shellSurface()->move(inputDevice);
|
m_wayland_window->shellSurface()->move(inputDevice);
|
||||||
return true;
|
else
|
||||||
|
handled = false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandDecoration::inMouseButtonPressedState() const
|
bool QWaylandDecoration::inMouseButtonPressedState() const
|
||||||
|
@ -973,7 +973,11 @@ void QWaylandInputDevice::Touch::touch_frame()
|
|||||||
|
|
||||||
if (mFocus) {
|
if (mFocus) {
|
||||||
const QWindowSystemInterface::TouchPoint &tp = mTouchPoints.last();
|
const QWindowSystemInterface::TouchPoint &tp = mTouchPoints.last();
|
||||||
QPointF localPos(window->mapFromGlobal(tp.area.center().toPoint()));
|
// When the touch event is received, the global pos is calculated with the margins
|
||||||
|
// in mind. Now we need to adjust again to get the correct local pos back.
|
||||||
|
QMargins margins = window->frameMargins();
|
||||||
|
QPoint p = tp.area.center().toPoint();
|
||||||
|
QPointF localPos(window->mapFromGlobal(QPoint(p.x() + margins.left(), p.y() + margins.top())));
|
||||||
if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers()))
|
if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user