diff options
Diffstat (limited to 'examples/wayland/qwindow-compositor/compositor.cpp')
-rw-r--r-- | examples/wayland/qwindow-compositor/compositor.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/examples/wayland/qwindow-compositor/compositor.cpp b/examples/wayland/qwindow-compositor/compositor.cpp index c60ecc6b5..d9f850424 100644 --- a/examples/wayland/qwindow-compositor/compositor.cpp +++ b/examples/wayland/qwindow-compositor/compositor.cpp @@ -46,7 +46,7 @@ #include <QtWaylandCompositor/QWaylandXdgShell> #include <QtWaylandCompositor/QWaylandWlShellSurface> -#include <QtWaylandCompositor/qwaylandinput.h> +#include <QtWaylandCompositor/qwaylandseat.h> #include <QtWaylandCompositor/qwaylanddrag.h> #include <QDebug> @@ -72,7 +72,7 @@ GLuint View::getTexture(GLenum *target) if (streamingTexture) m_texture = streamingTexture; - if (!buf.isShm() && buf.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES) + if (!buf.isSharedMemory() && buf.bufferFormatEgl() == QWaylandBufferRef::BufferFormatEgl_EXTERNAL_OES) m_textureTarget = GL_TEXTURE_EXTERNAL_OES; if (advance()) { @@ -81,7 +81,7 @@ GLuint View::getTexture(GLenum *target) glGenTextures(1, &m_texture); glBindTexture(m_textureTarget, m_texture); - if (buf.isShm()) + if (buf.isSharedMemory()) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); buf.bindToTexture(); } @@ -101,7 +101,7 @@ bool View::isCursor() const void View::onXdgSetMaximized() { - m_xdgSurface->requestMaximized(output()->geometry().size()); + m_xdgSurface->sendMaximized(output()->geometry().size()); // An improvement here, would have been to wait for the commit after the ack_configure for the // request above before moving the window. This would have prevented the window from being @@ -112,7 +112,7 @@ void View::onXdgSetMaximized() void View::onXdgUnsetMaximized() { - m_xdgSurface->requestUnMaximized(); + m_xdgSurface->sendUnmaximized(); } void View::onXdgSetFullscreen(QWaylandOutput* clientPreferredOutput) @@ -121,7 +121,7 @@ void View::onXdgSetFullscreen(QWaylandOutput* clientPreferredOutput) ? clientPreferredOutput : output(); - m_xdgSurface->requestFullscreen(outputToFullscreen->geometry().size()); + m_xdgSurface->sendFullscreen(outputToFullscreen->geometry().size()); // An improvement here, would have been to wait for the commit after the ack_configure for the // request above before moving the window. This would have prevented the window from being @@ -147,9 +147,9 @@ Compositor::Compositor(QWindow *window) , m_wlShell(new QWaylandWlShell(this)) , m_xdgShell(new QWaylandXdgShell(this)) { - connect(m_wlShell, &QWaylandWlShell::shellSurfaceCreated, this, &Compositor::onWlShellSurfaceCreated); + connect(m_wlShell, &QWaylandWlShell::wlShellSurfaceCreated, this, &Compositor::onWlShellSurfaceCreated); connect(m_xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, this, &Compositor::onXdgSurfaceCreated); - connect(m_xdgShell, &QWaylandXdgShell::createXdgPopup, this, &Compositor::onCreateXdgPopup); + connect(m_xdgShell, &QWaylandXdgShell::xdgPopupRequested, this, &Compositor::onXdgPopupRequested); } Compositor::~Compositor() @@ -162,8 +162,8 @@ void Compositor::create() QWaylandCompositor::create(); connect(this, &QWaylandCompositor::surfaceCreated, this, &Compositor::onSurfaceCreated); - connect(defaultInputDevice(), &QWaylandInputDevice::cursorSurfaceRequest, this, &Compositor::adjustCursorSurface); - connect(defaultInputDevice()->drag(), &QWaylandDrag::dragStarted, this, &Compositor::startDrag); + connect(defaultSeat(), &QWaylandSeat::cursorSurfaceRequest, this, &Compositor::adjustCursorSurface); + connect(defaultSeat()->drag(), &QWaylandDrag::dragStarted, this, &Compositor::startDrag); connect(this, &QWaylandCompositor::subsurfaceChanged, this, &Compositor::onSubsurfaceChanged); } @@ -171,7 +171,7 @@ void Compositor::create() void Compositor::onSurfaceCreated(QWaylandSurface *surface) { connect(surface, &QWaylandSurface::surfaceDestroyed, this, &Compositor::surfaceDestroyed); - connect(surface, &QWaylandSurface::mappedChanged, this, &Compositor::surfaceMappedChanged); + connect(surface, &QWaylandSurface::hasContentChanged, this, &Compositor::surfaceHasContentChanged); connect(surface, &QWaylandSurface::redraw, this, &Compositor::triggerRender); connect(surface, &QWaylandSurface::subsurfacePositionChanged, this, &Compositor::onSubsurfacePositionChanged); @@ -184,14 +184,14 @@ void Compositor::onSurfaceCreated(QWaylandSurface *surface) connect(surface, &QWaylandSurface::offsetForNextFrame, view, &View::onOffsetForNextFrame); } -void Compositor::surfaceMappedChanged() +void Compositor::surfaceHasContentChanged() { QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender()); - if (surface->isMapped()) { + if (surface->hasContent()) { if (surface->role() == QWaylandWlShellSurface::role() || surface->role() == QWaylandXdgSurface::role() || surface->role() == QWaylandXdgPopup::role()) { - defaultInputDevice()->setKeyboardFocus(surface); + defaultSeat()->setKeyboardFocus(surface); } } else if (popupActive()) { for (int i = 0; i < m_popupViews.count(); i++) { @@ -252,13 +252,13 @@ void Compositor::onXdgSurfaceCreated(QWaylandXdgSurface *xdgSurface) connect(xdgSurface, &QWaylandXdgSurface::unsetFullscreen, view, &View::onXdgUnsetFullscreen); } -void Compositor::onCreateXdgPopup(QWaylandSurface *surface, QWaylandSurface *parent, - QWaylandInputDevice *inputDevice, const QPoint &position, - const QWaylandResource &resource) +void Compositor::onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, + QWaylandSeat *seat, const QPoint &position, + const QWaylandResource &resource) { - Q_UNUSED(inputDevice); + Q_UNUSED(seat); - QWaylandXdgPopup *xdgPopup = new QWaylandXdgPopup(m_xdgShell, surface, parent, resource); + QWaylandXdgPopup *xdgPopup = new QWaylandXdgPopup(m_xdgShell, surface, parent, position, resource); View *view = findView(surface); Q_ASSERT(view); @@ -276,16 +276,16 @@ void Compositor::onStartMove() emit startMove(); } -void Compositor::onWlStartResize(QWaylandInputDevice *, QWaylandWlShellSurface::ResizeEdge edges) +void Compositor::onWlStartResize(QWaylandSeat *, QWaylandWlShellSurface::ResizeEdge edges) { closePopups(); emit startResize(int(edges), false); } -void Compositor::onXdgStartResize(QWaylandInputDevice *inputDevice, - QWaylandXdgSurface::ResizeEdge edges) +void Compositor::onXdgStartResize(QWaylandSeat *seat, + QWaylandXdgSurface::ResizeEdge edges) { - Q_UNUSED(inputDevice); + Q_UNUSED(seat); emit startResize(int(edges), true); } @@ -303,9 +303,9 @@ void Compositor::onSetTransient(QWaylandSurface *parent, const QPoint &relativeT } } -void Compositor::onSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent) +void Compositor::onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent) { - Q_UNUSED(inputDevice); + Q_UNUSED(seat); QWaylandWlShellSurface *surface = qobject_cast<QWaylandWlShellSurface*>(sender()); View *view = findView(surface->surface()); m_popupViews << view; @@ -374,7 +374,7 @@ void Compositor::adjustCursorSurface(QWaylandSurface *surface, int hotspotX, int m_cursorHotspotX = hotspotX; m_cursorHotspotY = hotspotY; - if (surface && surface->isMapped()) + if (surface && surface->hasContent()) updateCursor(); } @@ -395,7 +395,7 @@ void Compositor::handleMouseEvent(QWaylandView *target, QMouseEvent *me) && target->surface()->client() != m_popupViews.first()->surface()->client()) { closePopups(); } - QWaylandInputDevice *input = defaultInputDevice(); + QWaylandSeat *input = defaultSeat(); QWaylandSurface *surface = target ? target->surface() : nullptr; switch (me->type()) { case QEvent::MouseButtonPress: @@ -432,13 +432,13 @@ void Compositor::handleResize(View *target, const QSize &initialSize, const QPoi if (xdgSurface) { QWaylandXdgSurface::ResizeEdge edges = static_cast<QWaylandXdgSurface::ResizeEdge>(edge); QSize newSize = xdgSurface->sizeForResize(initialSize, delta, edges); - xdgSurface->requestResizing(newSize); + xdgSurface->sendResizing(newSize); } } void Compositor::startDrag() { - QWaylandDrag *currentDrag = defaultInputDevice()->drag(); + QWaylandDrag *currentDrag = defaultSeat()->drag(); Q_ASSERT(currentDrag); View *iconView = findView(currentDrag->icon()); iconView->setPosition(m_window->mapFromGlobal(QCursor::pos())); @@ -454,7 +454,7 @@ void Compositor::handleDrag(View *target, QMouseEvent *me) pos -= target->position(); surface = target->surface(); } - QWaylandDrag *currentDrag = defaultInputDevice()->drag(); + QWaylandDrag *currentDrag = defaultSeat()->drag(); currentDrag->dragMove(surface, pos); if (me->buttons() == Qt::NoButton) { m_views.removeOne(findView(currentDrag->icon())); |