diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-06-29 20:14:23 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-06-29 20:14:23 +0200 |
commit | 85956a9149c578d7a750fad0dc66e89eaa337ef5 (patch) | |
tree | 1e174c75f6010503ce081760814e8659ec4415b6 | |
parent | 2d9cd132061562902a9b347b87fd3ba20f434532 (diff) | |
parent | 05ea6b992f32443df27e38bdc8b21cf970755b57 (diff) | |
download | qtwayland-85956a9149c578d7a750fad0dc66e89eaa337ef5.tar.gz qtwayland-85956a9149c578d7a750fad0dc66e89eaa337ef5.tar.bz2 qtwayland-85956a9149c578d7a750fad0dc66e89eaa337ef5.zip |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
.qmake.conf
Change-Id: Ic75157b11eee188608c3ac7ed6fb1a033bb72750
23 files changed, 160 insertions, 24 deletions
diff --git a/dist/changes-5.5.0 b/dist/changes-5.5.0 new file mode 100644 index 00000000..2d111b64 --- /dev/null +++ b/dist/changes-5.5.0 @@ -0,0 +1,33 @@ +Qt 5.5 introduces some new features and improvements as well as bugfixes +over the 5.4 series. Better conformance with the QPA interface has been +achieved, and there has been a focus on making QtQuick work reliably in +Wayland Clients + +**************************************************************************** +* Qt Wayland General * +**************************************************************************** + +- Update Wayland protocol version to 1.4 +- brcm integration fixed +- Added a class for converting shm formats + +**************************************************************************** +* Qt Wayland QPA Plugin * +**************************************************************************** + +- xdg-shell integration updated to work with weston 1.6 +- Improve popup handling +- Added support for Qt WebEngine +- Added support for setMask for input region +- Fix for using QtQuick with the threaded renderer +- Fixed fontrendering to be on par with the xcb plugin + + +**************************************************************************** +* Qt Compositor * +**************************************************************************** + +- Only use Q_SLOTS and Q_SIGNALS in header files +- Added a QWayland Output class +- Added support for multiple input devices +- Added public class for QWaylandClient diff --git a/src/client/qwaylandabstractdecoration.cpp b/src/client/qwaylandabstractdecoration.cpp index 7698ff75..54a990b2 100644 --- a/src/client/qwaylandabstractdecoration.cpp +++ b/src/client/qwaylandabstractdecoration.cpp @@ -147,7 +147,7 @@ void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt: bool QWaylandAbstractDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState) { Q_D(QWaylandAbstractDecoration); - if ((!d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) + if (!(d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton)) return true; return false; } diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp index 03a8c4b8..a3e084a0 100644 --- a/src/client/qwaylanddatadevice.cpp +++ b/src/client/qwaylanddatadevice.cpp @@ -94,10 +94,10 @@ QWaylandDataSource *QWaylandDataDevice::selectionSource() const void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source) { - m_selectionSource.reset(source); if (source) connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled); set_selection(source ? source->object() : Q_NULLPTR, m_inputDevice->serial()); + m_selectionSource.reset(source); } QWaylandDataOffer *QWaylandDataDevice::dragOffer() const diff --git a/src/client/qwaylanddataoffer.cpp b/src/client/qwaylanddataoffer.cpp index dd28f787..167b647d 100644 --- a/src/client/qwaylanddataoffer.cpp +++ b/src/client/qwaylanddataoffer.cpp @@ -136,7 +136,7 @@ QVariant QWaylandMimeData::retrieveData_sys(const QString &mimeType, QVariant::T } m_dataOffer->receive(mime, pipefd[1]); - m_display->flushRequests(); + wl_display_flush(m_display->wl_display()); close(pipefd[1]); diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index bda85c49..5b6f2cbf 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -163,6 +163,9 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration) QWaylandDisplay::~QWaylandDisplay(void) { + qDeleteAll(mInputDevices); + mInputDevices.clear(); + foreach (QWaylandScreen *screen, mScreens) { mWaylandIntegration->destroyScreen(screen); } diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 76ae2586..009ef670 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -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) { QWaylandWindow *window = mFocus; @@ -517,10 +526,8 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in angleDelta.setY(valueDelta); } - QWindowSystemInterface::handleWheelEvent(window->window(), - time, mSurfacePos, - mGlobalPos, pixelDelta, - angleDelta); + WheelEvent e(time, mSurfacePos, mGlobalPos, pixelDelta, angleDelta); + window->handleMouse(mParent, e); } #ifndef QT_NO_WAYLAND_XKB diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index 23172ad3..6f3b25c0 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -259,7 +259,8 @@ class QWaylandPointerEvent public: enum Type { Enter, - Motion + Motion, + Wheel }; inline QWaylandPointerEvent(Type t, ulong ts, const QPointF &l, const QPointF &g, Qt::MouseButtons b, Qt::KeyboardModifiers m) : type(t) @@ -269,6 +270,14 @@ public: , buttons(b) , 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; ulong timestamp; @@ -276,6 +285,8 @@ public: QPointF global; Qt::MouseButtons buttons; Qt::KeyboardModifiers modifiers; + QPoint pixelDelta; + QPoint angleDelta; }; } diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index a775080a..922b1ee0 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -625,6 +625,9 @@ void QWaylandWindow::handleMouse(QWaylandInputDevice *inputDevice, const QWaylan case QWaylandPointerEvent::Motion: QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, e.local, e.global, e.buttons, e.modifiers); 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: QWindowSystemInterface::handleMouseEvent(window(), e.timestamp, localTranslated, globalTranslated, e.buttons, e.modifiers); break; + case QWaylandPointerEvent::Wheel: + QWindowSystemInterface::handleWheelEvent(window(), e.timestamp, localTranslated, globalTranslated, e.pixelDelta, e.angleDelta); + break; } mMouseEventsInContentArea = true; diff --git a/src/compositor/compositor_api/qwaylandquicksurface.cpp b/src/compositor/compositor_api/qwaylandquicksurface.cpp index 44e0edf5..ef78c884 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.cpp +++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp @@ -103,9 +103,12 @@ public: void invalidateTexture() { + if (bufferRef) + bufferRef.destroyTexture(); delete texture; texture = 0; update = true; + bufferRef = QWaylandBufferRef(); } QWaylandQuickSurface *surface; @@ -209,6 +212,8 @@ bool QWaylandQuickSurface::event(QEvent *e) this, &QWaylandQuickSurface::updateTexture); disconnect(oldWindow, &QQuickWindow::sceneGraphInvalidated, this, &QWaylandQuickSurface::invalidateTexture); + disconnect(oldWindow, &QQuickWindow::sceneGraphAboutToStop, + this, &QWaylandQuickSurface::invalidateTexture); } return true; @@ -225,6 +230,9 @@ bool QWaylandQuickSurface::event(QEvent *e) connect(window, &QQuickWindow::sceneGraphInvalidated, this, &QWaylandQuickSurface::invalidateTexture, Qt::DirectConnection); + connect(window, &QQuickWindow::sceneGraphAboutToStop, + this, &QWaylandQuickSurface::invalidateTexture, + Qt::DirectConnection); } return true; @@ -236,10 +244,11 @@ bool QWaylandQuickSurface::event(QEvent *e) void QWaylandQuickSurface::updateTexture() { Q_D(QWaylandQuickSurface); + const bool update = d->buffer->update; if (d->buffer->update) d->buffer->createTexture(); foreach (QWaylandSurfaceView *view, views()) - static_cast<QWaylandSurfaceItem *>(view)->updateTexture(); + static_cast<QWaylandSurfaceItem *>(view)->updateTexture(update); } void QWaylandQuickSurface::invalidateTexture() @@ -247,7 +256,8 @@ void QWaylandQuickSurface::invalidateTexture() Q_D(QWaylandQuickSurface); d->buffer->invalidateTexture(); foreach (QWaylandSurfaceView *view, views()) - static_cast<QWaylandSurfaceItem *>(view)->updateTexture(); + static_cast<QWaylandSurfaceItem *>(view)->updateTexture(true); + emit redraw(); } bool QWaylandQuickSurface::clientRenderingEnabled() const diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp index 9fc7fd6a..35577737 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceinterface.cpp @@ -60,6 +60,7 @@ QWaylandSurfaceInterface::QWaylandSurfaceInterface(QWaylandSurface *surface) QWaylandSurfaceInterface::~QWaylandSurfaceInterface() { d->surface->removeInterface(this); + delete d; } QWaylandSurface *QWaylandSurfaceInterface::surface() const @@ -96,6 +97,11 @@ QWaylandSurfaceOp::QWaylandSurfaceOp(int t) d->type = t; } +QWaylandSurfaceOp::~QWaylandSurfaceOp() +{ + delete d; +} + int QWaylandSurfaceOp::type() const { return d->type; diff --git a/src/compositor/compositor_api/qwaylandsurfaceinterface.h b/src/compositor/compositor_api/qwaylandsurfaceinterface.h index 60d8ae5f..322037e6 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceinterface.h +++ b/src/compositor/compositor_api/qwaylandsurfaceinterface.h @@ -62,6 +62,8 @@ public: }; QWaylandSurfaceOp(int t); + virtual ~QWaylandSurfaceOp(); + int type() const; private: diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp index 90a68c4f..93cfaf00 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp @@ -356,6 +356,11 @@ void QWaylandSurfaceItem::updateBuffer(bool hasBuffer) void QWaylandSurfaceItem::updateTexture() { + updateTexture(false); +} + +void QWaylandSurfaceItem::updateTexture(bool changed) +{ if (!m_provider) m_provider = new QWaylandSurfaceTextureProvider(); @@ -363,7 +368,7 @@ void QWaylandSurfaceItem::updateTexture() if (mapped) m_provider->t = static_cast<QWaylandQuickSurface *>(surface())->texture(); m_provider->smooth = smooth(); - if (m_newTexture) + if (m_newTexture || changed) emit m_provider->textureChanged(); m_newTexture = false; } diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h index 91dc6879..cb51b6bf 100644 --- a/src/compositor/compositor_api/qwaylandsurfaceitem.h +++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h @@ -125,7 +125,9 @@ protected: private: friend class QWaylandSurfaceNode; + friend class QWaylandQuickSurface; void init(QWaylandQuickSurface *); + void updateTexture(bool changed); static QMutex *mutex; diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp index 7941db82..303b9601 100644 --- a/src/compositor/wayland_wrapper/qwlcompositor.cpp +++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp @@ -88,9 +88,11 @@ #include <wayland-server.h> +#if defined (QT_COMPOSITOR_WAYLAND_GL) #include "hardware_integration/qwlhwintegration_p.h" #include "hardware_integration/qwlclientbufferintegration_p.h" #include "hardware_integration/qwlserverbufferintegration_p.h" +#endif #include "windowmanagerprotocol/waylandwindowmanagerintegration_p.h" #include "hardware_integration/qwlclientbufferintegrationfactory_p.h" @@ -465,6 +467,7 @@ void Compositor::bindGlobal(wl_client *client, void *data, uint32_t version, uin void Compositor::loadClientBufferIntegration() { +#ifdef QT_COMPOSITOR_WAYLAND_GL QStringList keys = ClientBufferIntegrationFactory::keys(); QString targetKey; QByteArray clientBufferIntegration = qgetenv("QT_WAYLAND_HARDWARE_INTEGRATION"); @@ -486,11 +489,13 @@ void Compositor::loadClientBufferIntegration() m_hw_integration->setClientBufferIntegration(targetKey); } } - //BUG: if there is no client buffer integration, bad things will when opengl is used + //BUG: if there is no client buffer integration, bad things will happen when opengl is used +#endif } void Compositor::loadServerBufferIntegration() { +#ifdef QT_COMPOSITOR_WAYLAND_GL QStringList keys = ServerBufferIntegrationFactory::keys(); QString targetKey; QByteArray serverBufferIntegration = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); @@ -502,6 +507,7 @@ void Compositor::loadServerBufferIntegration() if (m_hw_integration) m_hw_integration->setServerBufferIntegration(targetKey); } +#endif } void Compositor::registerInputDevice(QWaylandInputDevice *device) diff --git a/src/compositor/wayland_wrapper/qwlinputdevice.cpp b/src/compositor/wayland_wrapper/qwlinputdevice.cpp index cb27ab4e..ea127ee7 100644 --- a/src/compositor/wayland_wrapper/qwlinputdevice.cpp +++ b/src/compositor/wayland_wrapper/qwlinputdevice.cpp @@ -352,7 +352,7 @@ QWaylandInputDevice *InputDevice::handle() const QWaylandDrag *InputDevice::dragHandle() const { - return m_dragHandle; + return m_dragHandle.data(); } const DataDevice *InputDevice::dataDevice() const diff --git a/src/compositor/wayland_wrapper/qwlinputdevice_p.h b/src/compositor/wayland_wrapper/qwlinputdevice_p.h index 785c6d7e..8444eaa5 100644 --- a/src/compositor/wayland_wrapper/qwlinputdevice_p.h +++ b/src/compositor/wayland_wrapper/qwlinputdevice_p.h @@ -128,7 +128,7 @@ public: private: QWaylandInputDevice *m_handle; - QWaylandDrag *m_dragHandle; + QScopedPointer<QWaylandDrag> m_dragHandle; Compositor *m_compositor; QWaylandInputDevice::CapabilityFlags m_capabilities; diff --git a/src/compositor/wayland_wrapper/qwlkeyboard.cpp b/src/compositor/wayland_wrapper/qwlkeyboard.cpp index 4f1c451b..5af3e8c2 100644 --- a/src/compositor/wayland_wrapper/qwlkeyboard.cpp +++ b/src/compositor/wayland_wrapper/qwlkeyboard.cpp @@ -375,6 +375,7 @@ void Keyboard::createXKBKeymap() } strcpy(m_keymap_area, keymap_str); + free(keymap_str); m_state = xkb_state_new(keymap); diff --git a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h index 8e07068b..580e71d0 100644 --- a/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h +++ b/src/compositor/wayland_wrapper/qwlsurfacebuffer_p.h @@ -95,7 +95,12 @@ public: bool isDestroyed() { return m_destroyed; } void createTexture(); +#ifdef QT_COMPOSITOR_WAYLAND_GL inline GLuint texture() const; +#else + inline uint texture() const; +#endif + void destroyTexture(); inline struct ::wl_resource *waylandBufferHandle() const { return m_buffer; } @@ -150,12 +155,19 @@ private: friend class ::QWaylandBufferRef; }; +#ifdef QT_COMPOSITOR_WAYLAND_GL GLuint SurfaceBuffer::texture() const { if (m_buffer) return m_texture; return 0; } +#else +uint SurfaceBuffer::texture() const +{ + return 0; +} +#endif } diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp index d8764409..7cead1dc 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp @@ -85,6 +85,7 @@ public: ~QWaylandBrcmBuffer() { wl_array_release(&m_array); + wl_buffer_destroy(mBuffer); } QSize size() const { return m_size; } @@ -242,6 +243,9 @@ void QWaylandBrcmEglWindow::swapBuffers() glFinish(); } + if (!m_count) + return; + m_buffers[m_current]->bind(); attach(m_buffers[m_current], 0, 0); damage(QRect(QPoint(), geometry().size())); diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h index 1e00c0a8..4573feb7 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.h @@ -83,8 +83,6 @@ private: int m_current; int m_count; - - QMutex m_mutex; }; } diff --git a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp index b96e3c85..86dd05fa 100644 --- a/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp +++ b/src/hardwareintegration/compositor/xcomposite-egl/xcompositeeglintegration.cpp @@ -80,7 +80,7 @@ void XCompositeEglClientBufferIntegration::initializeHardware(QtWayland::Display if (nativeInterface) { mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display")); if (!mDisplay) - qFatal("could not retireve Display from platform integration"); + qFatal("could not retrieve Display from platform integration"); mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForIntegration("EGLDisplay")); if (!mEglDisplay) qFatal("could not retrieve EGLDisplay from platform integration"); diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp index cedee6c5..6e0c1829 100644 --- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp +++ b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp @@ -91,7 +91,7 @@ void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display if (nativeInterface) { mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForIntegration("Display")); if (!mDisplay) - qFatal("could not retireve Display from platform integration"); + qFatal("could not retrieve Display from platform integration"); } else { qFatal("Platform integration doesn't have native interface"); } diff --git a/src/plugins/decorations/bradient/main.cpp b/src/plugins/decorations/bradient/main.cpp index 00a91e24..ea298699 100644 --- a/src/plugins/decorations/bradient/main.cpp +++ b/src/plugins/decorations/bradient/main.cpp @@ -116,6 +116,14 @@ static const char * const qt_normalizeup_xpm[] = { # define BUTTON_WIDTH 22 #endif +enum Button +{ + None, + Close, + Maximize, + Minimize +}; + class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration { public: @@ -130,6 +138,7 @@ private: 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 processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods); + bool clickButton(Qt::MouseButtons b, Button btn); QRectF closeButtonRect() const; QRectF maximizeButtonRect() const; @@ -138,12 +147,14 @@ private: QColor m_foregroundColor; QColor m_backgroundColor; QStaticText m_windowTitle; + Button m_clicking; }; QWaylandBradientDecoration::QWaylandBradientDecoration() : QWaylandAbstractDecoration() + , m_clicking(None) { QPalette palette; m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText); @@ -315,18 +326,37 @@ void QWaylandBradientDecoration::paint(QPaintDevice *device) #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) { Q_UNUSED(global); // Figure out what area mouse is in - if (closeButtonRect().contains(local) && isLeftClicked(b)) { - QWindowSystemInterface::handleCloseEvent(window()); - } else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) { - window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); - } else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) { - window()->setWindowState(Qt::WindowMinimized); + if (closeButtonRect().contains(local)) { + if (clickButton(b, Close)) + QWindowSystemInterface::handleCloseEvent(window()); + } else if (maximizeButtonRect().contains(local)) { + if (clickButton(b, Maximize)) + window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized); + } else if (minimizeButtonRect().contains(local)) { + if (clickButton(b, Minimize)) + window()->setWindowState(Qt::WindowMinimized); } else if (local.y() <= margins().top()) { processMouseTop(inputDevice,local,b,mods); } else if (local.y() > window()->height() - margins().bottom() + margins().top()) { |