diff options
Diffstat (limited to 'src/compositor')
55 files changed, 276 insertions, 199 deletions
diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri index 1e9284c62..35f57f808 100644 --- a/src/compositor/compositor_api/compositor_api.pri +++ b/src/compositor/compositor_api/compositor_api.pri @@ -19,7 +19,6 @@ HEADERS += \ compositor_api/qwaylandoutput.h \ compositor_api/qwaylandoutputmode.h \ compositor_api/qwaylandoutputmode_p.h \ - compositor_api/qwaylanddrag.h \ compositor_api/qwaylandbufferref.h \ compositor_api/qwaylanddestroylistener.h \ compositor_api/qwaylanddestroylistener_p.h \ @@ -27,8 +26,6 @@ HEADERS += \ compositor_api/qwaylandview_p.h \ compositor_api/qwaylandresource.h \ compositor_api/qwaylandsurfacegrabber.h \ - compositor_api/qwaylandinputmethodcontrol.h \ - compositor_api/qwaylandinputmethodcontrol_p.h \ compositor_api/qwaylandoutputmode_p.h SOURCES += \ @@ -42,16 +39,29 @@ SOURCES += \ compositor_api/qwaylandtouch.cpp \ compositor_api/qwaylandoutput.cpp \ compositor_api/qwaylandoutputmode.cpp \ - compositor_api/qwaylanddrag.cpp \ compositor_api/qwaylandbufferref.cpp \ compositor_api/qwaylanddestroylistener.cpp \ compositor_api/qwaylandview.cpp \ compositor_api/qwaylandresource.cpp \ - compositor_api/qwaylandsurfacegrabber.cpp \ - compositor_api/qwaylandinputmethodcontrol.cpp + compositor_api/qwaylandsurfacegrabber.cpp + +qtConfig(im) { + HEADERS += \ + compositor_api/qwaylandinputmethodcontrol.h \ + compositor_api/qwaylandinputmethodcontrol_p.h + SOURCES += \ + compositor_api/qwaylandinputmethodcontrol.cpp +} QT += core-private +qtConfig(draganddrop) { + HEADERS += \ + compositor_api/qwaylanddrag.h + SOURCES += \ + compositor_api/qwaylanddrag.cpp +} + qtHaveModule(quick):qtConfig(opengl) { DEFINES += QT_WAYLAND_COMPOSITOR_QUICK diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index 29397f64f..499d81b3f 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -99,7 +99,7 @@ class WindowSystemEventHandler : public QWindowSystemEventHandler { public: WindowSystemEventHandler(QWaylandCompositor *c) : compositor(c) {} - bool sendEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) Q_DECL_OVERRIDE + bool sendEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) override { if (e->type == QWindowSystemInterfacePrivate::Key) { QWindowSystemInterfacePrivate::KeyEvent *ke = static_cast<QWindowSystemInterfacePrivate::KeyEvent *>(e); diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h index e59fdcbb5..f85fd8cc5 100644 --- a/src/compositor/compositor_api/qwaylandcompositor_p.h +++ b/src/compositor/compositor_api/qwaylandcompositor_p.h @@ -108,10 +108,10 @@ public: inline void addOutput(QWaylandOutput *output); inline void removeOutput(QWaylandOutput *output); protected: - void compositor_create_surface(wl_compositor::Resource *resource, uint32_t id) Q_DECL_OVERRIDE; - void compositor_create_region(wl_compositor::Resource *resource, uint32_t id) Q_DECL_OVERRIDE; + void compositor_create_surface(wl_compositor::Resource *resource, uint32_t id) override; + void compositor_create_region(wl_compositor::Resource *resource, uint32_t id) override; - void subcompositor_get_subsurface(wl_subcompositor::Resource *resource, uint32_t id, struct ::wl_resource *surface, struct ::wl_resource *parent) Q_DECL_OVERRIDE; + void subcompositor_get_subsurface(wl_subcompositor::Resource *resource, uint32_t id, struct ::wl_resource *surface, struct ::wl_resource *parent) override; virtual QWaylandSurface *createDefaultSurface(); protected: diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp index 539fc1b7d..d61aabb12 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp @@ -54,9 +54,7 @@ QWaylandInputMethodControl::QWaylandInputMethodControl(QWaylandSurface *surface) if (textInput) { connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); connect(textInput, &QWaylandTextInput::surfaceDisabled, this, &QWaylandInputMethodControl::surfaceDisabled); -#if QT_CONFIG(im) connect(textInput, &QWaylandTextInput::updateInputMethod, this, &QWaylandInputMethodControl::updateInputMethod); -#endif } } @@ -101,9 +99,7 @@ void QWaylandInputMethodControl::setEnabled(bool enabled) d->enabled = enabled; emit enabledChanged(enabled); -#if QT_CONFIG(im) emit updateInputMethod(Qt::ImQueryInput); -#endif } void QWaylandInputMethodControl::surfaceEnabled(QWaylandSurface *surface) diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h index af02e1ae5..58d0eaff8 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h @@ -57,9 +57,7 @@ class QWaylandInputMethodControl : public QObject public: explicit QWaylandInputMethodControl(QWaylandSurface *surface); -#if QT_CONFIG(im) QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; -#endif void inputMethodEvent(QInputMethodEvent *event); @@ -70,9 +68,7 @@ public: Q_SIGNALS: void enabledChanged(bool enabled); -#if QT_CONFIG(im) void updateInputMethod(Qt::InputMethodQueries queries); -#endif private: void defaultSeatChanged(); diff --git a/src/compositor/compositor_api/qwaylandkeyboard_p.h b/src/compositor/compositor_api/qwaylandkeyboard_p.h index b65dab440..47cd11d07 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard_p.h +++ b/src/compositor/compositor_api/qwaylandkeyboard_p.h @@ -97,9 +97,9 @@ public: void sendEnter(QWaylandSurface *surface, Resource *resource); protected: - void keyboard_bind_resource(Resource *resource) Q_DECL_OVERRIDE; - void keyboard_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; - void keyboard_release(Resource *resource) Q_DECL_OVERRIDE; + void keyboard_bind_resource(Resource *resource) override; + void keyboard_destroy_resource(Resource *resource) override; + void keyboard_release(Resource *resource) override; private: #if QT_CONFIG(xkbcommon_evdev) diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp index 0129bd33b..48d743f1b 100644 --- a/src/compositor/compositor_api/qwaylandoutput.cpp +++ b/src/compositor/compositor_api/qwaylandoutput.cpp @@ -276,7 +276,7 @@ void QWaylandOutput::initialize() // Replace modes with one that follows the window size and refresh rate, // but only if window size is valid if (d->window && d->sizeFollowsWindow) { - QWaylandOutputMode mode(d->window->size(), + QWaylandOutputMode mode(d->window->size() * d->window->devicePixelRatio(), qFloor(d->window->screen()->refreshRate() * 1000)); if (mode.isValid()) { d->modes.clear(); @@ -933,13 +933,13 @@ void QWaylandOutput::handleSetWidth(int newWidth) if (d->currentMode <= d->modes.size() - 1) { if (d->currentMode >= 0) { QWaylandOutputMode mode = d->modes.at(d->currentMode); - mode.setWidth(newWidth); + mode.setWidth(newWidth * d->window->devicePixelRatio()); d->modes.replace(d->currentMode, mode); d->sendModesInfo(); } else { // We didn't add a mode during the initialization because the window // size was invalid, let's add it now - QWaylandOutputMode mode(d->window->size(), + QWaylandOutputMode mode(d->window->size() * d->window->devicePixelRatio(), qFloor(d->window->screen()->refreshRate() * 1000)); if (mode.isValid()) { d->modes.clear(); @@ -963,13 +963,13 @@ void QWaylandOutput::handleSetHeight(int newHeight) if (d->currentMode <= d->modes.size() - 1) { if (d->currentMode >= 0) { QWaylandOutputMode mode = d->modes.at(d->currentMode); - mode.setHeight(newHeight); + mode.setHeight(newHeight * d->window->devicePixelRatio()); d->modes.replace(d->currentMode, mode); d->sendModesInfo(); } else { // We didn't add a mode during the initialization because the window // size was invalid, let's add it now - QWaylandOutputMode mode(d->window->size(), + QWaylandOutputMode mode(d->window->size() * d->window->devicePixelRatio(), qFloor(d->window->screen()->refreshRate() * 1000)); if (mode.isValid()) { d->modes.clear(); diff --git a/src/compositor/compositor_api/qwaylandoutput.h b/src/compositor/compositor_api/qwaylandoutput.h index 190231c12..9200ad2c4 100644 --- a/src/compositor/compositor_api/qwaylandoutput.h +++ b/src/compositor/compositor_api/qwaylandoutput.h @@ -183,7 +183,7 @@ private Q_SLOTS: void handleWindowDestroyed(); protected: - bool event(QEvent *event) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; virtual void initialize(); }; diff --git a/src/compositor/compositor_api/qwaylandoutput_p.h b/src/compositor/compositor_api/qwaylandoutput_p.h index dffde7f98..3a95f40cc 100644 --- a/src/compositor/compositor_api/qwaylandoutput_p.h +++ b/src/compositor/compositor_api/qwaylandoutput_p.h @@ -110,7 +110,7 @@ public: void sendModesInfo(); protected: - void output_bind_resource(Resource *resource) Q_DECL_OVERRIDE; + void output_bind_resource(Resource *resource) override; private: QWaylandCompositor *compositor; diff --git a/src/compositor/compositor_api/qwaylandpointer_p.h b/src/compositor/compositor_api/qwaylandpointer_p.h index c02f831b7..123f6b87b 100644 --- a/src/compositor/compositor_api/qwaylandpointer_p.h +++ b/src/compositor/compositor_api/qwaylandpointer_p.h @@ -79,9 +79,9 @@ public: QWaylandCompositor *compositor() const { return seat->compositor(); } protected: - void pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) Q_DECL_OVERRIDE; - void pointer_release(Resource *resource) Q_DECL_OVERRIDE; - void pointer_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) override; + void pointer_release(Resource *resource) override; + void pointer_destroy_resource(Resource *resource) override; private: void focusDestroyed(void *data); diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp index b69e20791..a024ae39a 100644 --- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp @@ -62,7 +62,7 @@ public: { } protected: - QWaylandSurface *createDefaultSurface() Q_DECL_OVERRIDE + QWaylandSurface *createDefaultSurface() override { return new QWaylandQuickSurface(); } @@ -135,7 +135,7 @@ void QWaylandQuickCompositor::grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandSurfaceGrabber *grabber; QWaylandBufferRef buffer; - void run() Q_DECL_OVERRIDE + void run() override { QOpenGLFramebufferObject fbo(buffer.size()); fbo.bind(); diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.h b/src/compositor/compositor_api/qwaylandquickcompositor.h index f6fb118a0..5c4562f0c 100644 --- a/src/compositor/compositor_api/qwaylandquickcompositor.h +++ b/src/compositor/compositor_api/qwaylandquickcompositor.h @@ -52,13 +52,13 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickCompositor : public QWaylandCompo Q_OBJECT public: QWaylandQuickCompositor(QObject *parent = nullptr); - void create() Q_DECL_OVERRIDE; + void create() override; - void grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer) Q_DECL_OVERRIDE; + void grabSurface(QWaylandSurfaceGrabber *grabber, const QWaylandBufferRef &buffer) override; protected: - void classBegin() Q_DECL_OVERRIDE; - void componentComplete() Q_DECL_OVERRIDE; + void classBegin() override; + void componentComplete() override; }; QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 7e44dfae7..ee9fa5427 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -297,7 +297,7 @@ public: emit textureChanged(); } - QSGTexture *texture() const Q_DECL_OVERRIDE + QSGTexture *texture() const override { if (m_sgTex) m_sgTex->setFiltering(m_smooth ? QSGTexture::Linear : QSGTexture::Nearest); @@ -588,6 +588,7 @@ void QWaylandQuickItem::hoverLeaveEvent(QHoverEvent *event) } } +#if QT_CONFIG(wheelevent) /*! * \internal */ @@ -606,6 +607,7 @@ void QWaylandQuickItem::wheelEvent(QWheelEvent *event) event->ignore(); } } +#endif /*! * \internal @@ -660,6 +662,12 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event) } seat->sendFullTouchEvent(surface(), event); + if (event->type() == QEvent::TouchBegin) { + d->touchingSeats.append(seat); + } else if (event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchCancel) { + d->touchingSeats.removeOne(seat); + } + if (event->type() == QEvent::TouchBegin && d->focusOnClick) takeFocus(seat); } else { @@ -667,6 +675,14 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event) } } +void QWaylandQuickItem::touchUngrabEvent() +{ + Q_D(QWaylandQuickItem); + for (auto seat : d->touchingSeats) + seat->sendTouchCancelEvent(surface()->client()); + d->touchingSeats.clear(); +} + #if QT_CONFIG(im) /*! * \internal @@ -1266,5 +1282,10 @@ void QWaylandQuickItem::handleDragStarted(QWaylandDrag *drag) d->isDragging = true; } -QT_END_NAMESPACE +qreal QWaylandQuickItemPrivate::scaleFactor() const +{ + return (view->output() ? view->output()->scaleFactor() : 1) + / (window ? window->devicePixelRatio() : 1); +} +QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h index 87d10b024..eb014a20c 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.h +++ b/src/compositor/compositor_api/qwaylandquickitem.h @@ -82,8 +82,8 @@ public: QWaylandSurface::Origin origin() const; - bool isTextureProvider() const Q_DECL_OVERRIDE; - QSGTextureProvider *textureProvider() const Q_DECL_OVERRIDE; + bool isTextureProvider() const override; + QSGTextureProvider *textureProvider() const override; bool paintEnabled() const; bool touchEventsEnabled() const; @@ -103,7 +103,7 @@ public: void setSizeFollowsSurface(bool sizeFollowsSurface); #if QT_CONFIG(im) - QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE; + QVariant inputMethodQuery(Qt::InputMethodQuery query) const override; Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; #endif @@ -122,21 +122,24 @@ public: Q_INVOKABLE void setPrimary(); protected: - void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE; - void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; - void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE; - void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void hoverEnterEvent(QHoverEvent *event) override; + void hoverMoveEvent(QHoverEvent *event) override; + void hoverLeaveEvent(QHoverEvent *event) override; +#if QT_CONFIG(wheelevent) + void wheelEvent(QWheelEvent *event) override; +#endif - void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; - void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *event) override; + void keyReleaseEvent(QKeyEvent *event) override; - void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE; + void touchEvent(QTouchEvent *event) override; + void touchUngrabEvent() override; #if QT_CONFIG(im) - void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE; + void inputMethodEvent(QInputMethodEvent *event) override; #endif virtual void surfaceChangedEvent(QWaylandSurface *newSurface, QWaylandSurface *oldSurface); @@ -176,7 +179,7 @@ Q_SIGNALS: void bufferLockedChanged(); void allowDiscardFrontBufferChanged(); protected: - QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE; + QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; QWaylandQuickItem(QWaylandQuickItemPrivate &dd, QQuickItem *parent = nullptr); }; diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h index fc69fe09c..fe8fbfd12 100644 --- a/src/compositor/compositor_api/qwaylandquickitem_p.h +++ b/src/compositor/compositor_api/qwaylandquickitem_p.h @@ -66,11 +66,11 @@ class QWaylandBufferMaterialShader : public QSGMaterialShader public: QWaylandBufferMaterialShader(QWaylandBufferRef::BufferFormatEgl format); - void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) Q_DECL_OVERRIDE; - char const *const *attributeNames() const Q_DECL_OVERRIDE; + void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; + char const *const *attributeNames() const override; protected: - void initialize() Q_DECL_OVERRIDE; + void initialize() override; private: const QWaylandBufferRef::BufferFormatEgl m_format; @@ -89,8 +89,8 @@ public: void bind(); - QSGMaterialType *type() const Q_DECL_OVERRIDE; - QSGMaterialShader *createShader() const Q_DECL_OVERRIDE; + QSGMaterialType *type() const override; + QSGMaterialShader *createShader() const override; private: void setTextureParameters(GLenum target); @@ -159,7 +159,7 @@ public: } bool shouldSendInputEvents() const { return view->surface() && inputEventsEnabled; } - int scaleFactor() const { return view->output() ? view->output()->scaleFactor() : 1; } + qreal scaleFactor() const; static QMutex *mutex; @@ -178,6 +178,7 @@ public: QQuickWindow *connectedWindow; QWaylandSurface::Origin origin; QPointer<QObject> subsurfaceHandler; + QVector<QWaylandSeat *> touchingSeats; }; QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquickoutput.h b/src/compositor/compositor_api/qwaylandquickoutput.h index 37a47b844..446215af1 100644 --- a/src/compositor/compositor_api/qwaylandquickoutput.h +++ b/src/compositor/compositor_api/qwaylandquickoutput.h @@ -55,7 +55,7 @@ public: QWaylandQuickOutput(); QWaylandQuickOutput(QWaylandCompositor *compositor, QWindow *window); - void update() Q_DECL_OVERRIDE; + void update() override; bool automaticFrameCallback() const; void setAutomaticFrameCallback(bool automatic); @@ -69,7 +69,7 @@ Q_SIGNALS: void automaticFrameCallbackChanged(); protected: - void initialize() Q_DECL_OVERRIDE; + void initialize() override; void classBegin() override; void componentComplete() override; diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp index f6a5276d4..7e4c83192 100644 --- a/src/compositor/compositor_api/qwaylandseat.cpp +++ b/src/compositor/compositor_api/qwaylandseat.cpp @@ -317,6 +317,7 @@ void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event) return; } +#if QT_CONFIG(im) if (keyboardFocus()->inputMethodControl()->enabled() && event->nativeScanCode() == 0) { QWaylandTextInput *textInput = QWaylandTextInput::findIn(this); @@ -325,6 +326,7 @@ void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event) return; } } +#endif QtWayland::QtKeyExtensionGlobal *ext = QtWayland::QtKeyExtensionGlobal::findIn(d->compositor); if (ext && ext->postQtKeyEvent(event, keyboardFocus())) diff --git a/src/compositor/compositor_api/qwaylandseat_p.h b/src/compositor/compositor_api/qwaylandseat_p.h index 1d6870802..4e0b61ba5 100644 --- a/src/compositor/compositor_api/qwaylandseat_p.h +++ b/src/compositor/compositor_api/qwaylandseat_p.h @@ -97,16 +97,16 @@ public: QtWayland::DataDevice *dataDevice() const { return data_device.data(); } protected: - void seat_bind_resource(wl_seat::Resource *resource) Q_DECL_OVERRIDE; + void seat_bind_resource(wl_seat::Resource *resource) override; void seat_get_pointer(wl_seat::Resource *resource, - uint32_t id) Q_DECL_OVERRIDE; + uint32_t id) override; void seat_get_keyboard(wl_seat::Resource *resource, - uint32_t id) Q_DECL_OVERRIDE; + uint32_t id) override; void seat_get_touch(wl_seat::Resource *resource, - uint32_t id) Q_DECL_OVERRIDE; + uint32_t id) override; - void seat_destroy_resource(wl_seat::Resource *resource) Q_DECL_OVERRIDE; + void seat_destroy_resource(wl_seat::Resource *resource) override; private: bool isInitialized; diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index f79fd57ef..a576e0d6c 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -132,7 +132,9 @@ QWaylandSurfacePrivate::QWaylandSurfacePrivate() , hasContent(false) , isInitialized(false) , contentOrientation(Qt::PrimaryOrientation) +#if QT_CONFIG(im) , inputMethodControl(Q_NULLPTR) +#endif , subsurface(0) { pending.buffer = QWaylandBufferRef(); @@ -419,7 +421,9 @@ void QWaylandSurface::initialize(QWaylandCompositor *compositor, QWaylandClient d->client = client; d->init(client->client(), id, version); d->isInitialized = true; +#if QT_CONFIG(im) d->inputMethodControl = new QWaylandInputMethodControl(this); +#endif #ifndef QT_NO_DEBUG QWaylandSurfacePrivate::removeUninitializedSurface(d); #endif @@ -665,11 +669,13 @@ bool QWaylandSurface::isCursorSurface() const return d->isCursorSurface; } +#if QT_CONFIG(im) QWaylandInputMethodControl *QWaylandSurface::inputMethodControl() const { Q_D(const QWaylandSurface); return d->inputMethodControl; } +#endif /*! * Updates the surface with the compositor's retained clipboard selection. Although diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h index 380436956..e6a16ffe1 100644 --- a/src/compositor/compositor_api/qwaylandsurface.h +++ b/src/compositor/compositor_api/qwaylandsurface.h @@ -135,7 +135,9 @@ public: void markAsCursorSurface(bool cursorSurface); bool isCursorSurface() const; +#if QT_CONFIG(im) QWaylandInputMethodControl *inputMethodControl() const; +#endif public Q_SLOTS: void updateSelection(); diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h index 232631077..aea6eda98 100644 --- a/src/compositor/compositor_api/qwaylandsurface_p.h +++ b/src/compositor/compositor_api/qwaylandsurface_p.h @@ -117,22 +117,22 @@ public: QWaylandSurfacePrivate *parentSurface() const { return subsurface ? subsurface->parentSurface : nullptr; } protected: - void surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void surface_destroy_resource(Resource *resource) override; - void surface_destroy(Resource *resource) Q_DECL_OVERRIDE; + void surface_destroy(Resource *resource) override; void surface_attach(Resource *resource, - struct wl_resource *buffer, int x, int y) Q_DECL_OVERRIDE; + struct wl_resource *buffer, int x, int y) override; void surface_damage(Resource *resource, - int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE; + int32_t x, int32_t y, int32_t width, int32_t height) override; void surface_frame(Resource *resource, - uint32_t callback) Q_DECL_OVERRIDE; + uint32_t callback) override; void surface_set_opaque_region(Resource *resource, - struct wl_resource *region) Q_DECL_OVERRIDE; + struct wl_resource *region) override; void surface_set_input_region(Resource *resource, - struct wl_resource *region) Q_DECL_OVERRIDE; - void surface_commit(Resource *resource) Q_DECL_OVERRIDE; - void surface_set_buffer_transform(Resource *resource, int32_t transform) Q_DECL_OVERRIDE; - void surface_set_buffer_scale(Resource *resource, int32_t bufferScale) Q_DECL_OVERRIDE; + struct wl_resource *region) override; + void surface_commit(Resource *resource) override; + void surface_set_buffer_transform(Resource *resource, int32_t transform) override; + void surface_set_buffer_scale(Resource *resource, int32_t bufferScale) override; QtWayland::ClientBuffer *getBuffer(struct ::wl_resource *buffer); @@ -171,7 +171,9 @@ public: //member variables bool isInitialized; Qt::ScreenOrientation contentOrientation; QWindow::Visibility visibility; +#if QT_CONFIG(im) QWaylandInputMethodControl *inputMethodControl; +#endif class Subsurface : public QtWaylandServer::wl_subsurface { diff --git a/src/compositor/compositor_api/qwaylandtouch_p.h b/src/compositor/compositor_api/qwaylandtouch_p.h index 9ee3e9c17..e5f6d3f8c 100644 --- a/src/compositor/compositor_api/qwaylandtouch_p.h +++ b/src/compositor/compositor_api/qwaylandtouch_p.h @@ -76,7 +76,7 @@ public: uint sendUp(QWaylandClient *client, uint32_t time, int touch_id); private: - void touch_release(Resource *resource) Q_DECL_OVERRIDE; + void touch_release(Resource *resource) override; QWaylandSeat *seat; }; diff --git a/src/compositor/extensions/qwaylandiviapplication.h b/src/compositor/extensions/qwaylandiviapplication.h index 57a140bf7..1db45416f 100644 --- a/src/compositor/extensions/qwaylandiviapplication.h +++ b/src/compositor/extensions/qwaylandiviapplication.h @@ -56,7 +56,7 @@ public: QWaylandIviApplication(); QWaylandIviApplication(QWaylandCompositor *compositor); - void initialize() Q_DECL_OVERRIDE; + void initialize() override; static const struct wl_interface *interface(); static QByteArray interfaceName(); diff --git a/src/compositor/extensions/qwaylandiviapplication_p.h b/src/compositor/extensions/qwaylandiviapplication_p.h index ea211a84a..609a945e8 100644 --- a/src/compositor/extensions/qwaylandiviapplication_p.h +++ b/src/compositor/extensions/qwaylandiviapplication_p.h @@ -71,7 +71,7 @@ public: QHash<uint, QWaylandIviSurface*> m_iviSurfaces; protected: - void ivi_application_surface_create(Resource *resource, uint32_t ivi_id, wl_resource *surface, uint32_t id) Q_DECL_OVERRIDE; + void ivi_application_surface_create(Resource *resource, uint32_t ivi_id, wl_resource *surface, uint32_t id) override; }; QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandivisurface.cpp b/src/compositor/extensions/qwaylandivisurface.cpp index 06e12a5ab..7feff17d8 100644 --- a/src/compositor/extensions/qwaylandivisurface.cpp +++ b/src/compositor/extensions/qwaylandivisurface.cpp @@ -37,7 +37,9 @@ #include "qwaylandivisurface.h" #include "qwaylandivisurface_p.h" #include "qwaylandiviapplication_p.h" +#ifdef QT_WAYLAND_COMPOSITOR_QUICK #include "qwaylandivisurfaceintegration_p.h" +#endif #include <QtWaylandCompositor/QWaylandResource> diff --git a/src/compositor/extensions/qwaylandivisurface.h b/src/compositor/extensions/qwaylandivisurface.h index 4e11493fc..e362eecb9 100644 --- a/src/compositor/extensions/qwaylandivisurface.h +++ b/src/compositor/extensions/qwaylandivisurface.h @@ -74,7 +74,7 @@ public: Q_INVOKABLE void sendConfigure(const QSize &size); #ifdef QT_WAYLAND_COMPOSITOR_QUICK - QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) Q_DECL_OVERRIDE; + QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override; #endif Q_SIGNALS: @@ -82,7 +82,7 @@ Q_SIGNALS: void iviIdChanged(); private: - void initialize() Q_DECL_OVERRIDE; + void initialize() override; }; QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandivisurface_p.h b/src/compositor/extensions/qwaylandivisurface_p.h index db237721d..8cbec4148 100644 --- a/src/compositor/extensions/qwaylandivisurface_p.h +++ b/src/compositor/extensions/qwaylandivisurface_p.h @@ -68,8 +68,8 @@ public: static QWaylandIviSurfacePrivate *get(QWaylandIviSurface *iviSurface) { return iviSurface->d_func(); } protected: - void ivi_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; - void ivi_surface_destroy(Resource *resource) Q_DECL_OVERRIDE; + void ivi_surface_destroy_resource(Resource *resource) override; + void ivi_surface_destroy(Resource *resource) override; private: QWaylandIviApplication *m_iviApplication; diff --git a/src/compositor/extensions/qwaylandqtwindowmanager.h b/src/compositor/extensions/qwaylandqtwindowmanager.h index 4d3951025..7265abc33 100644 --- a/src/compositor/extensions/qwaylandqtwindowmanager.h +++ b/src/compositor/extensions/qwaylandqtwindowmanager.h @@ -61,7 +61,7 @@ public: void sendQuitMessage(QWaylandClient *client); - void initialize() Q_DECL_OVERRIDE; + void initialize() override; static const struct wl_interface *interface(); static QByteArray interfaceName(); diff --git a/src/compositor/extensions/qwaylandqtwindowmanager_p.h b/src/compositor/extensions/qwaylandqtwindowmanager_p.h index a6df2138f..992ee6e62 100644 --- a/src/compositor/extensions/qwaylandqtwindowmanager_p.h +++ b/src/compositor/extensions/qwaylandqtwindowmanager_p.h @@ -66,9 +66,9 @@ public: QWaylandQtWindowManagerPrivate(); protected: - void windowmanager_bind_resource(Resource *resource) Q_DECL_OVERRIDE; - void windowmanager_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; - void windowmanager_open_url(Resource *resource, uint32_t remaining, const QString &url) Q_DECL_OVERRIDE; + void windowmanager_bind_resource(Resource *resource) override; + void windowmanager_destroy_resource(Resource *resource) override; + void windowmanager_open_url(Resource *resource, uint32_t remaining, const QString &url) override; private: bool showIsFullScreen; diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h index f72b970c2..de03163cc 100644 --- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.h +++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h @@ -67,8 +67,8 @@ Q_SIGNALS: protected: QWaylandQuickShellSurfaceItem(QWaylandQuickShellSurfaceItemPrivate &dd, QQuickItem *parent); - void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; }; QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h index 3cd9bf228..b9eb5ad62 100644 --- a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h +++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h @@ -90,13 +90,13 @@ public: static void cancelFilter(); protected: - void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *event) override; private: void stopFilter(); QWaylandQuickShellEventFilter(QObject *parent = nullptr); - bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE; + bool eventFilter(QObject *, QEvent *) override; bool eventFilterInstalled; bool waitForRelease; QPointer<QWaylandClient> client; diff --git a/src/compositor/extensions/qwaylandshell.h b/src/compositor/extensions/qwaylandshell.h index 997573c95..4a9d28cba 100644 --- a/src/compositor/extensions/qwaylandshell.h +++ b/src/compositor/extensions/qwaylandshell.h @@ -81,7 +81,7 @@ public: : QWaylandShell(container) { } - const struct wl_interface *extensionInterface() const Q_DECL_OVERRIDE + const struct wl_interface *extensionInterface() const override { return T::interface(); } diff --git a/src/compositor/extensions/qwaylandshellsurface.h b/src/compositor/extensions/qwaylandshellsurface.h index e8c75327c..1df9fed0e 100644 --- a/src/compositor/extensions/qwaylandshellsurface.h +++ b/src/compositor/extensions/qwaylandshellsurface.h @@ -73,7 +73,7 @@ public: : QWaylandShellSurface(container) { } - const struct wl_interface *extensionInterface() const Q_DECL_OVERRIDE + const struct wl_interface *extensionInterface() const override { return T::interface(); } diff --git a/src/compositor/extensions/qwaylandtextinput_p.h b/src/compositor/extensions/qwaylandtextinput_p.h index da90cc90b..7af24bb25 100644 --- a/src/compositor/extensions/qwaylandtextinput_p.h +++ b/src/compositor/extensions/qwaylandtextinput_p.h @@ -115,19 +115,19 @@ public: QHash<Resource *, QWaylandSurface*> enabledSurfaces; protected: - void zwp_text_input_v2_bind_resource(Resource *resource) Q_DECL_OVERRIDE; - void zwp_text_input_v2_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; - - void zwp_text_input_v2_destroy(Resource *resource) Q_DECL_OVERRIDE; - void zwp_text_input_v2_enable(Resource *resource, wl_resource *surface) Q_DECL_OVERRIDE; - void zwp_text_input_v2_disable(Resource *resource, wl_resource *surface) Q_DECL_OVERRIDE; - void zwp_text_input_v2_show_input_panel(Resource *resource) Q_DECL_OVERRIDE; - void zwp_text_input_v2_hide_input_panel(Resource *resource) Q_DECL_OVERRIDE; - void zwp_text_input_v2_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) Q_DECL_OVERRIDE; - void zwp_text_input_v2_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) Q_DECL_OVERRIDE; - void zwp_text_input_v2_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE; - void zwp_text_input_v2_set_preferred_language(Resource *resource, const QString &language) Q_DECL_OVERRIDE; - void zwp_text_input_v2_update_state(Resource *resource, uint32_t serial, uint32_t flags) Q_DECL_OVERRIDE; + void zwp_text_input_v2_bind_resource(Resource *resource) override; + void zwp_text_input_v2_destroy_resource(Resource *resource) override; + + void zwp_text_input_v2_destroy(Resource *resource) override; + void zwp_text_input_v2_enable(Resource *resource, wl_resource *surface) override; + void zwp_text_input_v2_disable(Resource *resource, wl_resource *surface) override; + void zwp_text_input_v2_show_input_panel(Resource *resource) override; + void zwp_text_input_v2_hide_input_panel(Resource *resource) override; + void zwp_text_input_v2_set_surrounding_text(Resource *resource, const QString &text, int32_t cursor, int32_t anchor) override; + void zwp_text_input_v2_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) override; + void zwp_text_input_v2_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; + void zwp_text_input_v2_set_preferred_language(Resource *resource, const QString &language) override; + void zwp_text_input_v2_update_state(Resource *resource, uint32_t serial, uint32_t flags) override; }; QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandtextinputmanager.h b/src/compositor/extensions/qwaylandtextinputmanager.h index 805c61af8..4691ed0cd 100644 --- a/src/compositor/extensions/qwaylandtextinputmanager.h +++ b/src/compositor/extensions/qwaylandtextinputmanager.h @@ -53,7 +53,7 @@ public: QWaylandTextInputManager(); QWaylandTextInputManager(QWaylandCompositor *compositor); - void initialize() Q_DECL_OVERRIDE; + void initialize() override; static const struct wl_interface *interface(); static QByteArray interfaceName(); diff --git a/src/compositor/extensions/qwaylandtextinputmanager_p.h b/src/compositor/extensions/qwaylandtextinputmanager_p.h index 955a5cc8a..5034f7e4d 100644 --- a/src/compositor/extensions/qwaylandtextinputmanager_p.h +++ b/src/compositor/extensions/qwaylandtextinputmanager_p.h @@ -61,7 +61,7 @@ public: QWaylandTextInputManagerPrivate(); protected: - void zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) Q_DECL_OVERRIDE; + void zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) override; }; QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandwlshell.h b/src/compositor/extensions/qwaylandwlshell.h index 7fe07e7a9..1ecc15cd6 100644 --- a/src/compositor/extensions/qwaylandwlshell.h +++ b/src/compositor/extensions/qwaylandwlshell.h @@ -63,7 +63,7 @@ public: QWaylandWlShell(); QWaylandWlShell(QWaylandCompositor *compositor); - void initialize() Q_DECL_OVERRIDE; + void initialize() override; QList<QWaylandWlShellSurface *> shellSurfaces() const; QList<QWaylandWlShellSurface *> shellSurfacesForClient(QWaylandClient* client) const; QList<QWaylandWlShellSurface *> mappedPopups() const; @@ -136,7 +136,7 @@ public: Q_INVOKABLE void sendPopupDone(); #ifdef QT_WAYLAND_COMPOSITOR_QUICK - QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) Q_DECL_OVERRIDE; + QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override; #endif public Q_SLOTS: diff --git a/src/compositor/extensions/qwaylandwlshell_p.h b/src/compositor/extensions/qwaylandwlshell_p.h index 77229ef03..70fd45f7d 100644 --- a/src/compositor/extensions/qwaylandwlshell_p.h +++ b/src/compositor/extensions/qwaylandwlshell_p.h @@ -76,7 +76,7 @@ public: static QWaylandWlShellPrivate *get(QWaylandWlShell *shell) { return shell->d_func(); } protected: - void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) Q_DECL_OVERRIDE; + void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) override; QList<QWaylandWlShellSurface *> m_shellSurfaces; }; @@ -106,40 +106,40 @@ private: QString m_className; Qt::WindowType m_windowType; - void shell_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void shell_surface_destroy_resource(Resource *resource) override; void shell_surface_move(Resource *resource, struct wl_resource *input_device_super, - uint32_t time) Q_DECL_OVERRIDE; + uint32_t time) override; void shell_surface_resize(Resource *resource, struct wl_resource *input_device, uint32_t time, - uint32_t edges) Q_DECL_OVERRIDE; - void shell_surface_set_toplevel(Resource *resource) Q_DECL_OVERRIDE; + uint32_t edges) override; + void shell_surface_set_toplevel(Resource *resource) override; void shell_surface_set_transient(Resource *resource, struct wl_resource *parent_surface_resource, int x, int y, - uint32_t flags) Q_DECL_OVERRIDE; + uint32_t flags) override; void shell_surface_set_fullscreen(Resource *resource, uint32_t method, uint32_t framerate, - struct wl_resource *output_resource) Q_DECL_OVERRIDE; + struct wl_resource *output_resource) override; void shell_surface_set_popup(Resource *resource, struct wl_resource *input_device, uint32_t time, struct wl_resource *parent, int32_t x, int32_t y, - uint32_t flags) Q_DECL_OVERRIDE; + uint32_t flags) override; void shell_surface_set_maximized(Resource *resource, - struct wl_resource *output_resource) Q_DECL_OVERRIDE; + struct wl_resource *output_resource) override; void shell_surface_pong(Resource *resource, - uint32_t serial) Q_DECL_OVERRIDE; + uint32_t serial) override; void shell_surface_set_title(Resource *resource, - const QString &title) Q_DECL_OVERRIDE; + const QString &title) override; void shell_surface_set_class(Resource *resource, - const QString &class_) Q_DECL_OVERRIDE; + const QString &class_) override; static QWaylandSurfaceRole s_role; }; diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp index abf5b627c..b32416764 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration.cpp +++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp @@ -125,7 +125,8 @@ void WlShellIntegration::handleSetMaximized(QWaylandOutput *output) nextState = State::Maximized; finalPosition = designatedOutput->position() + designatedOutput->availableGeometry().topLeft(); - m_shellSurface->sendConfigure(designatedOutput->availableGeometry().size(), QWaylandWlShellSurface::NoneEdge); + auto scaleFactor = m_item->view()->output()->scaleFactor(); + m_shellSurface->sendConfigure(designatedOutput->availableGeometry().size() / scaleFactor, QWaylandWlShellSurface::NoneEdge); } void WlShellIntegration::handleSetFullScreen(QWaylandWlShellSurface::FullScreenMethod method, uint framerate, QWaylandOutput *output) @@ -176,8 +177,9 @@ void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *par t.clear(&t); m_item->setRotation(0); m_item->setScale(1.0); - m_item->setX(relativeToParent.x()); - m_item->setY(relativeToParent.y()); + auto scaleFactor = m_item->output()->scaleFactor() / devicePixelRatio(); + m_item->setX(relativeToParent.x() * scaleFactor); + m_item->setY(relativeToParent.y() * scaleFactor); m_item->setParentItem(parentItem); } @@ -206,6 +208,11 @@ void WlShellIntegration::handlePopupRemoved() isPopup = false; } +qreal WlShellIntegration::devicePixelRatio() const +{ + return m_item->window() ? m_item->window()->devicePixelRatio() : 1; +} + void WlShellIntegration::handleShellSurfaceDestroyed() { if (isPopup) @@ -237,7 +244,7 @@ void WlShellIntegration::adjustOffsetForNextFrame(const QPointF &offset) float scaleFactor = m_item->view()->output()->scaleFactor(); QQuickItem *moveItem = m_item->moveItem(); - moveItem->setPosition(moveItem->position() + offset * scaleFactor); + moveItem->setPosition(moveItem->position() + offset * scaleFactor / devicePixelRatio()); } bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event) @@ -250,7 +257,7 @@ bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event) return true; } float scaleFactor = m_item->view()->output()->scaleFactor(); - QPointF delta = (event->windowPos() - resizeState.initialMousePos) / scaleFactor; + QPointF delta = (event->windowPos() - resizeState.initialMousePos) / scaleFactor * devicePixelRatio(); QSize newSize = m_shellSurface->sizeForResize(resizeState.initialSize, delta, resizeState.resizeEdges); m_shellSurface->sendConfigure(newSize, resizeState.resizeEdges); } else if (grabberState == GrabberState::Move) { diff --git a/src/compositor/extensions/qwaylandwlshellintegration_p.h b/src/compositor/extensions/qwaylandwlshellintegration_p.h index c0bbcfd10..814f5e12d 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration_p.h +++ b/src/compositor/extensions/qwaylandwlshellintegration_p.h @@ -61,8 +61,8 @@ class WlShellIntegration : public QWaylandQuickShellIntegration Q_OBJECT public: WlShellIntegration(QWaylandQuickShellSurfaceItem *item); - bool mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - bool mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + bool mouseMoveEvent(QMouseEvent *event) override; + bool mouseReleaseEvent(QMouseEvent *event) override; private Q_SLOTS: void handleStartMove(QWaylandSeat *seat); @@ -86,6 +86,7 @@ private: void handlePopupClosed(); void handlePopupRemoved(); + qreal devicePixelRatio() const; QWaylandQuickShellSurfaceItem *m_item; QPointer<QWaylandWlShellSurface> m_shellSurface; diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp index 0a86b9f6f..80aa52e70 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5.cpp @@ -225,7 +225,7 @@ QWaylandXdgSurfaceV5Private::QWaylandXdgSurfaceV5Private() , m_xdgShell(nullptr) , m_surface(nullptr) , m_parentSurface(nullptr) - , m_windowType(UnknownWindowType) + , m_windowType(Qt::WindowType::Window) , m_unsetWindowGeometry(true) , m_lastAckedConfigure({{}, QSize(0, 0), 0}) { @@ -272,6 +272,17 @@ void QWaylandXdgSurfaceV5Private::updateFallbackWindowGeometry() emit q->windowGeometryChanged(); } +void QWaylandXdgSurfaceV5Private::setWindowType(Qt::WindowType windowType) +{ + if (m_windowType == windowType) + return; + + m_windowType = windowType; + + Q_Q(QWaylandXdgSurfaceV5); + emit q->windowTypeChanged(); +} + void QWaylandXdgSurfaceV5Private::xdg_surface_destroy_resource(Resource *resource) { Q_UNUSED(resource); @@ -358,13 +369,13 @@ void QWaylandXdgSurfaceV5Private::xdg_surface_set_parent(Resource *resource, wl_ emit q->parentSurfaceChanged(); } - if (m_parentSurface && m_windowType != TransientWindowType) { + if (m_parentSurface && m_windowType != Qt::WindowType::SubWindow) { // There's a parent now, which means the surface is transient - m_windowType = TransientWindowType; + setWindowType(Qt::WindowType::SubWindow); emit q->setTransient(); - } else if (!m_parentSurface && m_windowType != TopLevelWindowType) { + } else if (!m_parentSurface && m_windowType != Qt::WindowType::Window) { // When the surface has no parent it is toplevel - m_windowType = TopLevelWindowType; + setWindowType(Qt::WindowType::Window); emit q->setTopLevel(); } } @@ -758,6 +769,23 @@ QWaylandSurface *QWaylandXdgSurfaceV5::surface() const } /*! + * \qmlproperty enum QtWaylandCompositor::XdgSurfaceV5::windowType + * + * This property holds the window type of the XdgSurfaceV5. + */ + +/*! + * \property QWaylandXdgSurfaceV5::windowType + * + * This property holds the window type of the QWaylandXdgSurfaceV5. + */ +Qt::WindowType QWaylandXdgSurfaceV5::windowType() const +{ + Q_D(const QWaylandXdgSurfaceV5); + return d->m_windowType; +} + +/*! * \qmlproperty object QtWaylandCompositor::XdgSurface::parentSurface * * This property holds the XdgSurface parent of this XdgSurface. diff --git a/src/compositor/extensions/qwaylandxdgshellv5.h b/src/compositor/extensions/qwaylandxdgshellv5.h index bcc740c7d..269ea8934 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5.h +++ b/src/compositor/extensions/qwaylandxdgshellv5.h @@ -68,7 +68,7 @@ public: QWaylandXdgShellV5(); QWaylandXdgShellV5(QWaylandCompositor *compositor); - void initialize() Q_DECL_OVERRIDE; + void initialize() override; QWaylandClient *popupClient() const; static const struct wl_interface *interface(); @@ -135,6 +135,8 @@ public: Q_INVOKABLE void initialize(QWaylandXdgShellV5* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource); + Qt::WindowType windowType() const override; + QString title() const; QString appId() const; QRect windowGeometry() const; @@ -165,7 +167,7 @@ public: Q_INVOKABLE uint sendResizing(const QSize &maxSize); #ifdef QT_WAYLAND_COMPOSITOR_QUICK - QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) Q_DECL_OVERRIDE; + QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override; #endif Q_SIGNALS: @@ -236,7 +238,7 @@ public: Q_INVOKABLE void sendPopupDone(); #ifdef QT_WAYLAND_COMPOSITOR_QUICK - QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) Q_DECL_OVERRIDE; + QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override; #endif Q_SIGNALS: diff --git a/src/compositor/extensions/qwaylandxdgshellv5_p.h b/src/compositor/extensions/qwaylandxdgshellv5_p.h index 31aa2112c..8e74a6a20 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5_p.h +++ b/src/compositor/extensions/qwaylandxdgshellv5_p.h @@ -80,14 +80,14 @@ public: QWaylandXdgSurfaceV5 *xdgSurfaceFromSurface(QWaylandSurface *surface); protected: - void xdg_shell_destroy(Resource *resource) Q_DECL_OVERRIDE; + void xdg_shell_destroy(Resource *resource) override; void xdg_shell_get_xdg_surface(Resource *resource, uint32_t id, - struct ::wl_resource *surface) Q_DECL_OVERRIDE; - void xdg_shell_use_unstable_version(Resource *resource, int32_t version) Q_DECL_OVERRIDE; + struct ::wl_resource *surface) override; + void xdg_shell_use_unstable_version(Resource *resource, int32_t version) override; void xdg_shell_get_xdg_popup(Resource *resource, uint32_t id, struct ::wl_resource *surface, struct ::wl_resource *parent, struct ::wl_resource *seatResource, - uint32_t serial, int32_t x, int32_t y) Q_DECL_OVERRIDE; - void xdg_shell_pong(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE; + uint32_t serial, int32_t x, int32_t y) override; + void xdg_shell_pong(Resource *resource, uint32_t serial) override; }; class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV5Private @@ -99,12 +99,6 @@ public: QWaylandXdgSurfaceV5Private(); static QWaylandXdgSurfaceV5Private *get(QWaylandXdgSurfaceV5 *xdgSurface) { return xdgSurface->d_func(); } - enum WindowType { - UnknownWindowType, - TopLevelWindowType, - TransientWindowType - }; - struct ConfigureEvent { QVector<uint> states; QSize size; @@ -116,12 +110,14 @@ public: QRect calculateFallbackWindowGeometry() const; void updateFallbackWindowGeometry(); + void setWindowType(Qt::WindowType windowType); + private: QWaylandXdgShellV5 *m_xdgShell; QWaylandSurface *m_surface; QWaylandXdgSurfaceV5 *m_parentSurface; - WindowType m_windowType; + Qt::WindowType m_windowType; QString m_title; QString m_appId; @@ -132,27 +128,27 @@ private: ConfigureEvent m_lastAckedConfigure; ConfigureEvent lastSentConfigure() const { return m_pendingConfigures.empty() ? m_lastAckedConfigure : m_pendingConfigures.first(); } - void xdg_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void xdg_surface_destroy_resource(Resource *resource) override; - void xdg_surface_destroy(Resource *resource) Q_DECL_OVERRIDE; + void xdg_surface_destroy(Resource *resource) override; void xdg_surface_move(Resource *resource, struct ::wl_resource *seat, - uint32_t serial) Q_DECL_OVERRIDE; + uint32_t serial) override; void xdg_surface_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, - uint32_t edges) Q_DECL_OVERRIDE; - void xdg_surface_set_maximized(Resource *resource) Q_DECL_OVERRIDE; - void xdg_surface_unset_maximized(Resource *resource) Q_DECL_OVERRIDE; + uint32_t edges) override; + void xdg_surface_set_maximized(Resource *resource) override; + void xdg_surface_unset_maximized(Resource *resource) override; void xdg_surface_set_fullscreen(Resource *resource, - struct ::wl_resource *output) Q_DECL_OVERRIDE; - void xdg_surface_unset_fullscreen(Resource *resource) Q_DECL_OVERRIDE; - void xdg_surface_set_minimized(Resource *resource) Q_DECL_OVERRIDE; - void xdg_surface_set_parent(Resource *resource, struct ::wl_resource *parent) Q_DECL_OVERRIDE; - void xdg_surface_set_app_id(Resource *resource, const QString &app_id) Q_DECL_OVERRIDE; + struct ::wl_resource *output) override; + void xdg_surface_unset_fullscreen(Resource *resource) override; + void xdg_surface_set_minimized(Resource *resource) override; + void xdg_surface_set_parent(Resource *resource, struct ::wl_resource *parent) override; + void xdg_surface_set_app_id(Resource *resource, const QString &app_id) override; void xdg_surface_show_window_menu(Resource *resource, struct ::wl_resource *seatResource, - uint32_t serial, int32_t x, int32_t y) Q_DECL_OVERRIDE; - void xdg_surface_ack_configure(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE; - void xdg_surface_set_title(Resource *resource, const QString &title) Q_DECL_OVERRIDE; + uint32_t serial, int32_t x, int32_t y) override; + void xdg_surface_ack_configure(Resource *resource, uint32_t serial) override; + void xdg_surface_set_title(Resource *resource, const QString &title) override; void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, - int32_t width, int32_t height) Q_DECL_OVERRIDE; + int32_t width, int32_t height) override; static QWaylandSurfaceRole s_role; }; @@ -172,8 +168,8 @@ public: QWaylandXdgShellV5 *m_xdgShell; QPoint m_position; - void xdg_popup_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; - void xdg_popup_destroy(xdg_popup::Resource *resource) Q_DECL_OVERRIDE; + void xdg_popup_destroy_resource(Resource *resource) override; + void xdg_popup_destroy(xdg_popup::Resource *resource) override; static QWaylandSurfaceRole s_role; }; diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h b/src/compositor/extensions/qwaylandxdgshellv5integration_p.h index da4573c76..6f02ab399 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h +++ b/src/compositor/extensions/qwaylandxdgshellv5integration_p.h @@ -60,8 +60,8 @@ class XdgShellV5Integration : public QWaylandQuickShellIntegration Q_OBJECT public: XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item); - bool mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; - bool mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + bool mouseMoveEvent(QMouseEvent *event) override; + bool mouseReleaseEvent(QMouseEvent *event) override; private Q_SLOTS: void handleStartMove(QWaylandSeat *seat); diff --git a/src/compositor/extensions/qwlextendedsurface_p.h b/src/compositor/extensions/qwlextendedsurface_p.h index a868cd831..2317d1a45 100644 --- a/src/compositor/extensions/qwlextendedsurface_p.h +++ b/src/compositor/extensions/qwlextendedsurface_p.h @@ -136,17 +136,17 @@ private: void extended_surface_update_generic_property(Resource *resource, const QString &name, - struct wl_array *value) Q_DECL_OVERRIDE; + struct wl_array *value) override; void extended_surface_set_content_orientation_mask(Resource *resource, - int32_t orientation) Q_DECL_OVERRIDE; + int32_t orientation) override; void extended_surface_set_window_flags(Resource *resource, - int32_t flags) Q_DECL_OVERRIDE; + int32_t flags) override; - void extended_surface_destroy_resource(Resource *) Q_DECL_OVERRIDE; - void extended_surface_raise(Resource *) Q_DECL_OVERRIDE; - void extended_surface_lower(Resource *) Q_DECL_OVERRIDE; + void extended_surface_destroy_resource(Resource *) override; + void extended_surface_raise(Resource *) override; + void extended_surface_lower(Resource *) override; }; } diff --git a/src/compositor/extensions/qwlqttouch_p.h b/src/compositor/extensions/qwlqttouch_p.h index f3697aa83..d659872ae 100644 --- a/src/compositor/extensions/qwlqttouch_p.h +++ b/src/compositor/extensions/qwlqttouch_p.h @@ -86,8 +86,8 @@ Q_SIGNALS: void behaviorFlagsChanged(); protected: - void touch_extension_bind_resource(Resource *resource) Q_DECL_OVERRIDE; - void touch_extension_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void touch_extension_bind_resource(Resource *resource) override; + void touch_extension_destroy_resource(Resource *resource) override; private: QWaylandCompositor *m_compositor; diff --git a/src/compositor/global/qwaylandcompositorextension.h b/src/compositor/global/qwaylandcompositorextension.h index e9aa84609..fe8a7ff1e 100644 --- a/src/compositor/global/qwaylandcompositorextension.h +++ b/src/compositor/global/qwaylandcompositorextension.h @@ -89,7 +89,7 @@ protected: QWaylandCompositorExtension(QWaylandCompositorExtensionPrivate &dd); QWaylandCompositorExtension(QWaylandObject *container, QWaylandCompositorExtensionPrivate &dd); - bool event(QEvent *event) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; }; template <typename T> @@ -104,7 +104,7 @@ public: : QWaylandCompositorExtension(container) { } - const struct wl_interface *extensionInterface() const Q_DECL_OVERRIDE + const struct wl_interface *extensionInterface() const override { return T::interface(); } diff --git a/src/compositor/global/qwaylandquickextension.h b/src/compositor/global/qwaylandquickextension.h index 63c3d135e..d328f7bdb 100644 --- a/src/compositor/global/qwaylandquickextension.h +++ b/src/compositor/global/qwaylandquickextension.h @@ -56,8 +56,8 @@ QT_BEGIN_NAMESPACE { \ return QQmlListProperty<QObject>(this, m_objects); \ } \ - void classBegin() Q_DECL_OVERRIDE {} \ - void componentComplete() Q_DECL_OVERRIDE { initialize(); } \ + void classBegin() override {} \ + void componentComplete() override { initialize(); } \ private: \ QList<QObject *> m_objects; \ }; diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp index d52950388..f1c55f547 100644 --- a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp +++ b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp @@ -114,7 +114,9 @@ QWaylandBufferRef::BufferFormatEgl ClientBuffer::bufferFormatEgl() const SharedMemoryBuffer::SharedMemoryBuffer(wl_resource *bufferResource) : ClientBuffer(bufferResource) +#if QT_CONFIG(opengl) , m_shmTexture(nullptr) +#endif { } diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h index dafb3c5e5..efb2eb18b 100644 --- a/src/compositor/wayland_wrapper/qwlclientbuffer_p.h +++ b/src/compositor/wayland_wrapper/qwlclientbuffer_p.h @@ -128,12 +128,12 @@ class Q_WAYLAND_COMPOSITOR_EXPORT SharedMemoryBuffer : public ClientBuffer public: SharedMemoryBuffer(struct ::wl_resource *bufferResource); - QSize size() const Q_DECL_OVERRIDE; - QWaylandSurface::Origin origin() const Q_DECL_OVERRIDE; + QSize size() const override; + QWaylandSurface::Origin origin() const override; QImage image() const; #if QT_CONFIG(opengl) - QOpenGLTexture *toOpenGlTexture(int plane = 0) Q_DECL_OVERRIDE; + QOpenGLTexture *toOpenGlTexture(int plane = 0) override; private: QOpenGLTexture *m_shmTexture; diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h index 17591ae27..57a9c0a80 100644 --- a/src/compositor/wayland_wrapper/qwldatadevice_p.h +++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h @@ -79,8 +79,8 @@ public: void cancelDrag(); protected: - void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) Q_DECL_OVERRIDE; - void data_device_set_selection(Resource *resource, struct ::wl_resource *source, uint32_t serial) Q_DECL_OVERRIDE; + void data_device_start_drag(Resource *resource, struct ::wl_resource *source, struct ::wl_resource *origin, struct ::wl_resource *icon, uint32_t serial) override; + void data_device_set_selection(Resource *resource, struct ::wl_resource *source, uint32_t serial) override; private: void setDragIcon(QWaylandSurface *icon); diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h index 8408db977..483731dfd 100644 --- a/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h +++ b/src/compositor/wayland_wrapper/qwldatadevicemanager_p.h @@ -85,8 +85,8 @@ public: void offerRetainedSelection(wl_resource *clientDataDeviceResource); protected: - void data_device_manager_create_data_source(Resource *resource, uint32_t id) Q_DECL_OVERRIDE; - void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE; + void data_device_manager_create_data_source(Resource *resource, uint32_t id) override; + void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) override; private Q_SLOTS: void readFromClient(int fd); diff --git a/src/compositor/wayland_wrapper/qwldataoffer_p.h b/src/compositor/wayland_wrapper/qwldataoffer_p.h index 09ca87650..dc1c84fe0 100644 --- a/src/compositor/wayland_wrapper/qwldataoffer_p.h +++ b/src/compositor/wayland_wrapper/qwldataoffer_p.h @@ -65,10 +65,10 @@ public: ~DataOffer(); protected: - void data_offer_accept(Resource *resource, uint32_t serial, const QString &mime_type) Q_DECL_OVERRIDE; - void data_offer_receive(Resource *resource, const QString &mime_type, int32_t fd) Q_DECL_OVERRIDE; - void data_offer_destroy(Resource *resource) Q_DECL_OVERRIDE; - void data_offer_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void data_offer_accept(Resource *resource, uint32_t serial, const QString &mime_type) override; + void data_offer_receive(Resource *resource, const QString &mime_type, int32_t fd) override; + void data_offer_destroy(Resource *resource) override; + void data_offer_destroy_resource(Resource *resource) override; private: QPointer<DataSource> m_dataSource; diff --git a/src/compositor/wayland_wrapper/qwldatasource_p.h b/src/compositor/wayland_wrapper/qwldatasource_p.h index 4389b40fb..b548a2411 100644 --- a/src/compositor/wayland_wrapper/qwldatasource_p.h +++ b/src/compositor/wayland_wrapper/qwldatasource_p.h @@ -78,9 +78,9 @@ public: static DataSource *fromResource(struct ::wl_resource *resource); protected: - void data_source_offer(Resource *resource, const QString &mime_type) Q_DECL_OVERRIDE; - void data_source_destroy(Resource *resource) Q_DECL_OVERRIDE; - void data_source_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void data_source_offer(Resource *resource, const QString &mime_type) override; + void data_source_destroy(Resource *resource) override; + void data_source_destroy_resource(Resource *resource) override; private: uint32_t m_time; diff --git a/src/compositor/wayland_wrapper/qwlregion_p.h b/src/compositor/wayland_wrapper/qwlregion_p.h index c63cdbc45..c5047596e 100644 --- a/src/compositor/wayland_wrapper/qwlregion_p.h +++ b/src/compositor/wayland_wrapper/qwlregion_p.h @@ -76,11 +76,11 @@ private: QRegion m_region; - void region_destroy_resource(Resource *) Q_DECL_OVERRIDE; + void region_destroy_resource(Resource *) override; - void region_destroy(Resource *resource) Q_DECL_OVERRIDE; - void region_add(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) Q_DECL_OVERRIDE; - void region_subtract(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) Q_DECL_OVERRIDE; + void region_destroy(Resource *resource) override; + void region_add(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) override; + void region_subtract(Resource *resource, int32_t x, int32_t y, int32_t w, int32_t h) override; }; } |