Wayland: can drag a window by its titlebar using the touchscreen
It was already possible to drag it via the mouse but not via touch. Task-number: QTBUG-41085 Change-Id: Ia52c7124fb2f1aa0331897bd072fcf09fb78aa1a Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
parent
c15ee9f0e3
commit
76c98e7671
@ -335,6 +335,19 @@ bool QWaylandDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPo
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods)
|
||||
{
|
||||
Q_UNUSED(inputDevice);
|
||||
Q_UNUSED(global);
|
||||
Q_UNUSED(mods);
|
||||
|
||||
if (state == Qt::TouchPointPressed && local.y() <= m_margins.top()) {
|
||||
m_wayland_window->shellSurface()->move(inputDevice);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QWaylandDecoration::inMouseButtonPressedState() const
|
||||
{
|
||||
return m_mouseButtons & Qt::NoButton;
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
bool isDirty() const;
|
||||
|
||||
bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
||||
bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods);
|
||||
bool inMouseButtonPressedState() const;
|
||||
|
||||
void startResize(QWaylandInputDevice *inputDevice,enum wl_shell_surface_resize resize, Qt::MouseButtons buttons);
|
||||
|
@ -853,8 +853,8 @@ void QWaylandInputDevice::Touch::touch_down(uint32_t serial,
|
||||
wl_fixed_t x,
|
||||
wl_fixed_t y)
|
||||
{
|
||||
Q_UNUSED(serial);
|
||||
Q_UNUSED(time);
|
||||
mParent->mTime = time;
|
||||
mParent->mSerial = serial;
|
||||
mFocus = QWaylandWindow::fromWlSurface(surface);
|
||||
mParent->handleTouchPoint(id, wl_fixed_to_double(x), wl_fixed_to_double(y), Qt::TouchPointPressed);
|
||||
}
|
||||
@ -966,6 +966,12 @@ void QWaylandInputDevice::Touch::touch_frame()
|
||||
|
||||
QWindow *window = mFocus ? mFocus->window() : 0;
|
||||
|
||||
if (mFocus) {
|
||||
const QWindowSystemInterface::TouchPoint &tp = mTouchPoints.last();
|
||||
QPointF localPos(window->mapFromGlobal(tp.area.center().toPoint()));
|
||||
if (mFocus->touchDragDecoration(mParent, localPos, tp.area.center(), tp.state, mParent->modifiers()))
|
||||
return;
|
||||
}
|
||||
QWindowSystemInterface::handleTouchEvent(window, mParent->mTouchDevice, mTouchPoints);
|
||||
|
||||
const bool allReleased = allTouchPointsReleased();
|
||||
|
@ -583,6 +583,13 @@ void QWaylandWindow::handleMouseLeave(QWaylandInputDevice *inputDevice)
|
||||
restoreMouseCursor(inputDevice);
|
||||
}
|
||||
|
||||
bool QWaylandWindow::touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods)
|
||||
{
|
||||
if (!mWindowDecoration)
|
||||
return false;
|
||||
return mWindowDecoration->handleTouch(inputDevice, local, global, state, mods);
|
||||
}
|
||||
|
||||
void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
||||
{
|
||||
if (mWindowDecoration->handleMouse(inputDevice,local,global,b,mods))
|
||||
|
@ -156,6 +156,9 @@ public:
|
||||
void handleMouseEnter(QWaylandInputDevice *inputDevice);
|
||||
void handleMouseLeave(QWaylandInputDevice *inputDevice);
|
||||
|
||||
bool touchDragDecoration(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,
|
||||
Qt::TouchPointState state, Qt::KeyboardModifiers mods);
|
||||
|
||||
bool createDecoration();
|
||||
|
||||
inline bool isMaximized() const { return mState == Qt::WindowMaximized; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user