Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: .qmake.conf Change-Id: Ic75157b11eee188608c3ac7ed6fb1a033bb72750
This commit is contained in:
commit
4192bc7a06
@ -116,6 +116,14 @@ static const char * const qt_normalizeup_xpm[] = {
|
|||||||
# define BUTTON_WIDTH 22
|
# define BUTTON_WIDTH 22
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum Button
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Close,
|
||||||
|
Maximize,
|
||||||
|
Minimize
|
||||||
|
};
|
||||||
|
|
||||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -130,6 +138,7 @@ private:
|
|||||||
void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
||||||
void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
||||||
void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
||||||
|
bool clickButton(Qt::MouseButtons b, Button btn);
|
||||||
|
|
||||||
QRectF closeButtonRect() const;
|
QRectF closeButtonRect() const;
|
||||||
QRectF maximizeButtonRect() const;
|
QRectF maximizeButtonRect() const;
|
||||||
@ -138,12 +147,14 @@ private:
|
|||||||
QColor m_foregroundColor;
|
QColor m_foregroundColor;
|
||||||
QColor m_backgroundColor;
|
QColor m_backgroundColor;
|
||||||
QStaticText m_windowTitle;
|
QStaticText m_windowTitle;
|
||||||
|
Button m_clicking;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QWaylandBradientDecoration::QWaylandBradientDecoration()
|
QWaylandBradientDecoration::QWaylandBradientDecoration()
|
||||||
: QWaylandAbstractDecoration()
|
: QWaylandAbstractDecoration()
|
||||||
|
, m_clicking(None)
|
||||||
{
|
{
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText);
|
m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText);
|
||||||
@ -315,17 +326,36 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QWaylandBradientDecoration::clickButton(Qt::MouseButtons b, Button btn)
|
||||||
|
{
|
||||||
|
if (isLeftClicked(b)) {
|
||||||
|
m_clicking = btn;
|
||||||
|
return false;
|
||||||
|
} else if (isLeftReleased(b)) {
|
||||||
|
if (m_clicking == btn) {
|
||||||
|
m_clicking = None;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
m_clicking = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
||||||
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(global);
|
Q_UNUSED(global);
|
||||||
|
|
||||||
// Figure out what area mouse is in
|
// Figure out what area mouse is in
|
||||||
if (closeButtonRect().contains(local) && isLeftClicked(b)) {
|
if (closeButtonRect().contains(local)) {
|
||||||
|
if (clickButton(b, Close))
|
||||||
QWindowSystemInterface::handleCloseEvent(window());
|
QWindowSystemInterface::handleCloseEvent(window());
|
||||||
} else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) {
|
} else if (maximizeButtonRect().contains(local)) {
|
||||||
|
if (clickButton(b, Maximize))
|
||||||
window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized);
|
window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized);
|
||||||
} else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) {
|
} else if (minimizeButtonRect().contains(local)) {
|
||||||
|
if (clickButton(b, Minimize))
|
||||||
window()->setWindowState(Qt::WindowMinimized);
|
window()->setWindowState(Qt::WindowMinimized);
|
||||||
} else if (local.y() <= margins().top()) {
|
} else if (local.y() <= margins().top()) {
|
||||||
processMouseTop(inputDevice,local,b,mods);
|
processMouseTop(inputDevice,local,b,mods);
|
||||||
|
@ -147,7 +147,7 @@ void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt:
|
|||||||
bool QWaylandAbstractDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState)
|
bool QWaylandAbstractDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState)
|
||||||
{
|
{
|
||||||
Q_D(QWaylandAbstractDecoration);
|
Q_D(QWaylandAbstractDecoration);
|
||||||
if ((!d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton))
|
if (!(d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -94,10 +94,10 @@ QWaylandDataSource *QWaylandDataDevice::selectionSource() const
|
|||||||
|
|
||||||
void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source)
|
void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source)
|
||||||
{
|
{
|
||||||
m_selectionSource.reset(source);
|
|
||||||
if (source)
|
if (source)
|
||||||
connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled);
|
connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled);
|
||||||
set_selection(source ? source->object() : Q_NULLPTR, m_inputDevice->serial());
|
set_selection(source ? source->object() : Q_NULLPTR, m_inputDevice->serial());
|
||||||
|
m_selectionSource.reset(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandDataOffer *QWaylandDataDevice::dragOffer() const
|
QWaylandDataOffer *QWaylandDataDevice::dragOffer() const
|
||||||
|
@ -136,7 +136,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_dataOffer->receive(mime, pipefd[1]);
|
m_dataOffer->receive(mime, pipefd[1]);
|
||||||
m_display->flushRequests();
|
wl_display_flush(m_display->wl_display());
|
||||||
|
|
||||||
close(pipefd[1]);
|
close(pipefd[1]);
|
||||||
|
|
||||||
|
@ -163,6 +163,9 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
|
|||||||
|
|
||||||
QWaylandDisplay::~QWaylandDisplay(void)
|
QWaylandDisplay::~QWaylandDisplay(void)
|
||||||
{
|
{
|
||||||
|
qDeleteAll(mInputDevices);
|
||||||
|
mInputDevices.clear();
|
||||||
|
|
||||||
foreach (QWaylandScreen *screen, mScreens) {
|
foreach (QWaylandScreen *screen, mScreens) {
|
||||||
mWaylandIntegration->destroyScreen(screen);
|
mWaylandIntegration->destroyScreen(screen);
|
||||||
}
|
}
|
||||||
|
@ -494,6 +494,15 @@ void QWaylandInputDevice::Pointer::pointer_button(uint32_t serial, uint32_t time
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WheelEvent : public QWaylandPointerEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WheelEvent(ulong t, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad)
|
||||||
|
: QWaylandPointerEvent(QWaylandPointerEvent::Wheel, t, l, g, pd, ad)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value)
|
void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, int32_t value)
|
||||||
{
|
{
|
||||||
QWaylandWindow *window = mFocus;
|
QWaylandWindow *window = mFocus;
|
||||||
@ -517,10 +526,8 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in
|
|||||||
angleDelta.setY(valueDelta);
|
angleDelta.setY(valueDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWindowSystemInterface::handleWheelEvent(window->window(),
|
WheelEvent e(time, mSurfacePos, mGlobalPos, pixelDelta, angleDelta);
|
||||||
time, mSurfacePos,
|
window->handleMouse(mParent, e);
|
||||||
mGlobalPos, pixelDelta,
|
|
||||||
angleDelta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_WAYLAND_XKB
|
#ifndef QT_NO_WAYLAND_XKB
|
||||||
|
@ -259,7 +259,8 @@ class QWaylandPointerEvent
|
|||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
Enter,
|
Enter,
|
||||||
Motion
|
Motion,
|
||||||
|
Wheel
|
||||||
};
|
};
|
||||||
inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m)
|
inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m)
|
||||||
: type(t)
|
: type(t)
|
||||||
@ -269,6 +270,14 @@ public:
|
|||||||
, buttons(b)
|
, buttons(b)
|
||||||
, modifiers(m)
|
, modifiers(m)
|
||||||
{}
|
{}
|
||||||
|
inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, const QPoint &pd, const QPoint &ad)
|
||||||
|
: type(t)
|
||||||
|
, timestamp(ts)
|
||||||
|
, local(l)
|
||||||
|
, global(g)
|
||||||
|
, pixelDelta(pd)
|
||||||
|
, angleDelta(ad)
|
||||||
|
{}
|
||||||
|
|
||||||
Type type;
|
Type type;
|
||||||
ulong timestamp;
|
ulong timestamp;
|
||||||
@ -276,6 +285,8 @@ public:
|
|||||||
QPointF global;
|
QPointF global;
|
||||||
Qt::MouseButtons buttons;
|
Qt::MouseButtons buttons;
|
||||||
Qt::KeyboardModifiers modifiers;
|
Qt::KeyboardModifiers modifiers;
|
||||||
|
QPoint pixelDelta;
|
||||||
|
QPoint angleDelta;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -625,6 +625,9 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan
|
|||||||
case QWaylandPointerEvent::Motion:
|
case QWaylandPointerEvent::Motion:
|
||||||
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers);
|
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers);
|
||||||
break;
|
break;
|
||||||
|
case QWaylandPointerEvent::Wheel:
|
||||||
|
QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, e.local, e.global, e.pixelDelta, e.angleDelta);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,6 +687,9 @@ void QWaylandWindow::handleMouseEventWithDecoration(QWaylandInputDevice *inputDe
|
|||||||
case QWaylandPointerEvent::Motion:
|
case QWaylandPointerEvent::Motion:
|
||||||
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers);
|
QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers);
|
||||||
break;
|
break;
|
||||||
|
case QWaylandPointerEvent::Wheel:
|
||||||
|
QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mMouseEventsInContentArea = true;
|
mMouseEventsInContentArea = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user