diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-07-02 09:12:27 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-07-07 09:29:06 +0200 |
commit | 322b28f183d20850326ebc229d2658586c8cc5b6 (patch) | |
tree | de569089a39446913037f8a3a70bb8b8dd79f3a1 | |
parent | c114e173ce2f47f8df2fb0ea35af0ede04354751 (diff) | |
download | qtwayland-322b28f183d20850326ebc229d2658586c8cc5b6.tar.gz |
Remove deprecated code
XdgShellv5 and XdgShellv6 have been deprecated in
the compositor since 5.15, and wl-scaler since 5.13.
These are now removed.
Since the qwindow-compositor has not been updated
for a long time, it depends on the outdated protocols.
This change removes it, since it no longer represents
best practices. This means we will be missing a proper
C++-based compositor for now, so we will have to
create a new one later.
Change-Id: Icc6ef97c17e553f266c4145abeef26ddd631d6bf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
55 files changed, 21 insertions, 10425 deletions
@@ -22,9 +22,9 @@ no client buffer integration is specified, then the wayland-egl plugin will be loaded. Please note that no Weston clients will work if the non standard wayland-egl client buffer integration is used. -To start the qwindow-compositor with the xcomposite-glx integration then start +To start a compositor with the xcomposite-glx integration then start the compositor as follows: -QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-glx ./qwindow-compositor +QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=xcomposite-glx ./my-compositor Now it should be possible to start an application in a separate terminal. ie: $QTBASEDIR/examples/opengl/hellowindow/hellowindow -platform wayland --single diff --git a/examples/wayland/.prev_CMakeLists.txt b/examples/wayland/.prev_CMakeLists.txt index 435734b7..490035a9 100644 --- a/examples/wayland/.prev_CMakeLists.txt +++ b/examples/wayland/.prev_CMakeLists.txt @@ -1,7 +1,6 @@ # Generated from wayland.pro. if(QT_FEATURE_opengl) - add_subdirectory(qwindow-compositor) add_subdirectory(minimal-cpp) endif() if(TARGET Qt::Quick) diff --git a/examples/wayland/CMakeLists.txt b/examples/wayland/CMakeLists.txt index 9470d3a1..1275ca2e 100644 --- a/examples/wayland/CMakeLists.txt +++ b/examples/wayland/CMakeLists.txt @@ -2,7 +2,6 @@ if(QT_FEATURE_wayland_server) # special case if(QT_FEATURE_opengl) - add_subdirectory(qwindow-compositor) add_subdirectory(minimal-cpp) endif() if(TARGET Qt::Quick) diff --git a/examples/wayland/hwlayer-compositor/main.qml b/examples/wayland/hwlayer-compositor/main.qml index b4f088c9..ae4720f3 100644 --- a/examples/wayland/hwlayer-compositor/main.qml +++ b/examples/wayland/hwlayer-compositor/main.qml @@ -156,6 +156,5 @@ WaylandCompositor { shellSurfaces.append({shSurface: shellSurface, animatePosition: false, animateOpacity: false, level: 0}); } XdgShell { onToplevelCreated: addShellSurface(xdgSurface) } - XdgShellV6 { onToplevelCreated: addShellSurface(xdgSurface) } WlShell { onWlShellSurfaceCreated: addShellSurface(shellSurface) } } diff --git a/examples/wayland/minimal-cpp/README b/examples/wayland/minimal-cpp/README index 87c389c3..2a4a51f3 100644 --- a/examples/wayland/minimal-cpp/README +++ b/examples/wayland/minimal-cpp/README @@ -3,6 +3,3 @@ and running. Input events are not delivered to clients, to avoid the logic for finding the correct window and map the coordinates. This example uses the IVI-application shell protocol, positioning windows based on the ivi_id. -See the qwindow-compositor example for information on how to implement -support for key and mouse events, and everything else a proper desktop -compositor needs. diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml index 61cb6c9e..55ec9c03 100644 --- a/examples/wayland/minimal-qml/main.qml +++ b/examples/wayland/minimal-qml/main.qml @@ -82,10 +82,6 @@ WaylandCompositor { onWlShellSurfaceCreated: shellSurfaces.append({shellSurface: shellSurface}); } - XdgShellV6 { - onToplevelCreated: - shellSurfaces.append({shellSurface: xdgSurface}); - } XdgShell { onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface}); diff --git a/examples/wayland/multi-screen/qml/main.qml b/examples/wayland/multi-screen/qml/main.qml index ecd32739..2925d7e0 100644 --- a/examples/wayland/multi-screen/qml/main.qml +++ b/examples/wayland/multi-screen/qml/main.qml @@ -100,10 +100,6 @@ WaylandCompositor { onWlShellSurfaceCreated: handleShellSurfaceCreated(shellSurface) } - XdgShellV6 { - onToplevelCreated: handleShellSurfaceCreated(xdgSurface) - } - XdgShell { onToplevelCreated: handleShellSurfaceCreated(xdgSurface) } diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml index 391dbed4..83d7b2a1 100644 --- a/examples/wayland/pure-qml/qml/main.qml +++ b/examples/wayland/pure-qml/qml/main.qml @@ -62,11 +62,6 @@ WaylandCompositor { onToplevelCreated: screen.handleShellSurface(xdgSurface) } - // Unstable version of xdg-shell still used by some clients - XdgShellV6 { - onToplevelCreated: screen.handleShellSurface(xdgSurface) - } - // Deprecated shell extension, still used by some clients WlShell { onWlShellSurfaceCreated: screen.handleShellSurface(shellSurface) diff --git a/examples/wayland/qwindow-compositor/.prev_CMakeLists.txt b/examples/wayland/qwindow-compositor/.prev_CMakeLists.txt deleted file mode 100644 index 0207bb1c..00000000 --- a/examples/wayland/qwindow-compositor/.prev_CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ -# Generated from qwindow-compositor.pro. - -cmake_minimum_required(VERSION 3.14) -project(qwindow-compositor LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/qwindow-compositor") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS WaylandCompositor) - -add_qt_gui_executable(qwindow-compositor - compositor.cpp compositor.h - main.cpp - window.cpp window.h -) -target_include_directories(qwindow-compositor PUBLIC - ../../include -) - -target_link_libraries(qwindow-compositor PUBLIC - # Remove: L - ../../lib - Qt::Core - Qt::Gui - Qt::WaylandCompositor -) - - -# Resources: -set_source_files_properties("../pure-qml/images/background.jpg" - PROPERTIES QT_RESOURCE_ALIAS "background.jpg" -) -set(qwindow-compositor_resource_files - "../pure-qml/images/background.jpg" -) - -qt6_add_resources(qwindow-compositor "qwindow-compositor" - PREFIX - "/" - FILES - ${qwindow-compositor_resource_files} -) - -install(TARGETS qwindow-compositor - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/wayland/qwindow-compositor/CMakeLists.txt b/examples/wayland/qwindow-compositor/CMakeLists.txt deleted file mode 100644 index 6894f18f..00000000 --- a/examples/wayland/qwindow-compositor/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ -# Generated from qwindow-compositor.pro. - -cmake_minimum_required(VERSION 3.14) -project(qwindow-compositor LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/qwindow-compositor") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS WaylandCompositor) - -add_qt_gui_executable(qwindow-compositor - compositor.cpp compositor.h - main.cpp - window.cpp window.h -) -target_include_directories(qwindow-compositor PUBLIC - ../../include -) - -target_link_libraries(qwindow-compositor PUBLIC - # Remove: L - #../../lib # special case - Qt::Core - Qt::Gui - Qt::WaylandCompositor -) - - -# Resources: -set_source_files_properties("../pure-qml/images/background.jpg" - PROPERTIES QT_RESOURCE_ALIAS "background.jpg" -) -set(qwindow-compositor_resource_files - "../pure-qml/images/background.jpg" -) - -qt6_add_resources(qwindow-compositor "qwindow-compositor" - PREFIX - "/" - FILES - ${qwindow-compositor_resource_files} -) - -install(TARGETS qwindow-compositor - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/wayland/qwindow-compositor/compositor.cpp b/examples/wayland/qwindow-compositor/compositor.cpp deleted file mode 100644 index 72f23ce6..00000000 --- a/examples/wayland/qwindow-compositor/compositor.cpp +++ /dev/null @@ -1,550 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Wayland module -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "compositor.h" - -#include <QMouseEvent> -#include <QKeyEvent> -#include <QTouchEvent> - -#include <QtWaylandCompositor/QWaylandXdgShellV5> -#include <QtWaylandCompositor/QWaylandWlShellSurface> -#include <QtWaylandCompositor/qwaylandseat.h> -#include <QtWaylandCompositor/qwaylanddrag.h> - -#include <QDebug> -#include <QOpenGLContext> - -#ifndef GL_TEXTURE_EXTERNAL_OES -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#endif - -View::View(Compositor *compositor) - : m_compositor(compositor) -{} - -QOpenGLTexture *View::getTexture() -{ - bool newContent = advance(); - QWaylandBufferRef buf = currentBuffer(); - if (!buf.hasContent()) - m_texture = nullptr; - if (newContent) { - m_texture = buf.toOpenGLTexture(); - if (surface()) { - m_size = surface()->destinationSize(); - m_origin = buf.origin() == QWaylandSurface::OriginTopLeft - ? QOpenGLTextureBlitter::OriginTopLeft - : QOpenGLTextureBlitter::OriginBottomLeft; - } - } - - return m_texture; -} - -QOpenGLTextureBlitter::Origin View::textureOrigin() const -{ - return m_origin; -} - -QSize View::size() const -{ - return surface() ? surface()->destinationSize() : m_size; -} - -bool View::isCursor() const -{ - return surface() && surface()->isCursorSurface(); -} - - -void View::onXdgSetMaximized() -{ - 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 - // moved until the contents of the window had actually updated. This improvement is left as an - // exercise for the reader. - setPosition(QPoint(0, 0)); -} - -void View::onXdgUnsetMaximized() -{ - m_xdgSurface->sendUnmaximized(); -} - -void View::onXdgSetFullscreen(QWaylandOutput* clientPreferredOutput) -{ - QWaylandOutput *outputToFullscreen = clientPreferredOutput - ? clientPreferredOutput - : output(); - - 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 - // moved until the contents of the window had actually updated. This improvement is left as an - // exercise for the reader. - setPosition(outputToFullscreen->position()); -} - -void View::onOffsetForNextFrame(const QPoint &offset) -{ - m_offset = offset; - setPosition(position() + offset); -} - - -void View::timerEvent(QTimerEvent *event) -{ - if (event->timerId() != m_animationTimer.timerId()) - return; - - m_compositor->triggerRender(); - - if (m_animationCountUp) { - m_animationFactor += .08; - if (m_animationFactor > 1.0) { - m_animationFactor = 1.0; - m_animationTimer.stop(); - emit animationDone(); - } - } else { - m_animationFactor -= .08; - if (m_animationFactor < 0.01) { - m_animationFactor = 0.01; - m_animationTimer.stop(); - emit animationDone(); - } - } -} - -void View::startAnimation(bool countUp) -{ - m_animationCountUp = countUp; - m_animationFactor = countUp ? .1 : 1.0; - m_animationTimer.start(20, this); -} - -void View::cancelAnimation() -{ - m_animationFactor = 1.0; - m_animationTimer.stop(); -} - -void View::onXdgUnsetFullscreen() -{ - onXdgUnsetMaximized(); -} - -Compositor::Compositor(QWindow *window) - : m_window(window) - , m_wlShell(new QWaylandWlShell(this)) - , m_xdgShell(new QWaylandXdgShellV5(this)) -{ - connect(m_wlShell, &QWaylandWlShell::wlShellSurfaceCreated, this, &Compositor::onWlShellSurfaceCreated); - connect(m_xdgShell, &QWaylandXdgShellV5::xdgSurfaceCreated, this, &Compositor::onXdgSurfaceCreated); - connect(m_xdgShell, &QWaylandXdgShellV5::xdgPopupRequested, this, &Compositor::onXdgPopupRequested); -} - -Compositor::~Compositor() -{ -} - -void Compositor::create() -{ - QWaylandOutput *output = new QWaylandOutput(this, m_window); - QWaylandOutputMode mode(QSize(800, 600), 60000); - output->addMode(mode, true); - QWaylandCompositor::create(); - output->setCurrentMode(mode); - - connect(this, &QWaylandCompositor::surfaceCreated, this, &Compositor::onSurfaceCreated); - connect(defaultSeat(), &QWaylandSeat::cursorSurfaceRequest, this, &Compositor::adjustCursorSurface); - connect(defaultSeat()->drag(), &QWaylandDrag::dragStarted, this, &Compositor::startDrag); - - connect(this, &QWaylandCompositor::subsurfaceChanged, this, &Compositor::onSubsurfaceChanged); -} - -void Compositor::onSurfaceCreated(QWaylandSurface *surface) -{ - connect(surface, &QWaylandSurface::surfaceDestroyed, this, &Compositor::surfaceDestroyed); - connect(surface, &QWaylandSurface::hasContentChanged, this, &Compositor::surfaceHasContentChanged); - connect(surface, &QWaylandSurface::redraw, this, &Compositor::triggerRender); - - connect(surface, &QWaylandSurface::subsurfacePositionChanged, this, &Compositor::onSubsurfacePositionChanged); - View *view = new View(this); - view->setSurface(surface); - view->setOutput(outputFor(m_window)); - m_views << view; - connect(view, &QWaylandView::surfaceDestroyed, this, &Compositor::viewSurfaceDestroyed); - connect(surface, &QWaylandSurface::offsetForNextFrame, view, &View::onOffsetForNextFrame); -} - -void Compositor::surfaceHasContentChanged() -{ - QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender()); - if (surface->hasContent()) { - if (surface->role() == QWaylandWlShellSurface::role() - || surface->role() == QWaylandXdgSurfaceV5::role() - || surface->role() == QWaylandXdgPopupV5::role()) { - defaultSeat()->setKeyboardFocus(surface); - } - } - triggerRender(); -} - -void Compositor::surfaceDestroyed() -{ - triggerRender(); -} - -void Compositor::viewSurfaceDestroyed() -{ - View *view = qobject_cast<View*>(sender()); - view->setBufferLocked(true); - view->startAnimation(false); - connect(view, &View::animationDone, this, &Compositor::viewAnimationDone); -} - - -void Compositor::viewAnimationDone() -{ - View *view = qobject_cast<View*>(sender()); - m_views.removeAll(view); - delete view; -} - - -View * Compositor::findView(const QWaylandSurface *s) const -{ - for (View* view : m_views) { - if (view->surface() == s) - return view; - } - return nullptr; -} - -void Compositor::onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface) -{ - connect(wlShellSurface, &QWaylandWlShellSurface::startMove, this, &Compositor::onStartMove); - connect(wlShellSurface, &QWaylandWlShellSurface::startResize, this, &Compositor::onWlStartResize); - connect(wlShellSurface, &QWaylandWlShellSurface::setTransient, this, &Compositor::onSetTransient); - connect(wlShellSurface, &QWaylandWlShellSurface::setPopup, this, &Compositor::onSetPopup); - - View *view = findView(wlShellSurface->surface()); - Q_ASSERT(view); - view->m_wlShellSurface = wlShellSurface; - view->startAnimation(true); -} - -void Compositor::onXdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface) -{ - connect(xdgSurface, &QWaylandXdgSurfaceV5::startMove, this, &Compositor::onStartMove); - connect(xdgSurface, &QWaylandXdgSurfaceV5::startResize, this, &Compositor::onXdgStartResize); - - View *view = findView(xdgSurface->surface()); - Q_ASSERT(view); - view->m_xdgSurface = xdgSurface; - - connect(xdgSurface, &QWaylandXdgSurfaceV5::setMaximized, view, &View::onXdgSetMaximized); - connect(xdgSurface, &QWaylandXdgSurfaceV5::setFullscreen, view, &View::onXdgSetFullscreen); - connect(xdgSurface, &QWaylandXdgSurfaceV5::unsetMaximized, view, &View::onXdgUnsetMaximized); - connect(xdgSurface, &QWaylandXdgSurfaceV5::unsetFullscreen, view, &View::onXdgUnsetFullscreen); - view->startAnimation(true); -} - -void Compositor::onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, - QWaylandSeat *seat, const QPoint &position, - const QWaylandResource &resource) -{ - Q_UNUSED(seat); - - QWaylandXdgPopupV5 *xdgPopup = new QWaylandXdgPopupV5(m_xdgShell, surface, parent, position, resource); - - View *view = findView(surface); - Q_ASSERT(view); - - View *parentView = findView(parent); - Q_ASSERT(parentView); - - view->setPosition(parentView->position() + position); - view->m_xdgPopup = xdgPopup; -} - -void Compositor::onStartMove() -{ - closePopups(); - emit startMove(); -} - -void Compositor::onWlStartResize(QWaylandSeat *, QWaylandWlShellSurface::ResizeEdge edges) -{ - closePopups(); - emit startResize(int(edges), false); -} - -void Compositor::onXdgStartResize(QWaylandSeat *seat, - QWaylandXdgSurfaceV5::ResizeEdge edges) -{ - Q_UNUSED(seat); - emit startResize(int(edges), true); -} - -void Compositor::onSetTransient(QWaylandSurface *parent, const QPoint &relativeToParent, bool inactive) -{ - Q_UNUSED(inactive); - - QWaylandWlShellSurface *wlShellSurface = qobject_cast<QWaylandWlShellSurface*>(sender()); - View *view = findView(wlShellSurface->surface()); - - if (view) { - raise(view); - View *parentView = findView(parent); - if (parentView) - view->setPosition(parentView->position() + relativeToParent); - } -} - -void Compositor::onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent) -{ - Q_UNUSED(seat); - QWaylandWlShellSurface *surface = qobject_cast<QWaylandWlShellSurface*>(sender()); - View *view = findView(surface->surface()); - if (view) { - raise(view); - View *parentView = findView(parent); - if (parentView) - view->setPosition(parentView->position() + relativeToParent); - view->cancelAnimation(); - } -} - -void Compositor::onSubsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent) -{ - View *view = findView(child); - View *parentView = findView(parent); - view->setParentView(parentView); -} - -void Compositor::onSubsurfacePositionChanged(const QPoint &position) -{ - QWaylandSurface *surface = qobject_cast<QWaylandSurface*>(sender()); - if (!surface) - return; - View *view = findView(surface); - view->setPosition(position); - triggerRender(); -} - -void Compositor::triggerRender() -{ - m_window->requestUpdate(); -} - -void Compositor::startRender() -{ - QWaylandOutput *out = defaultOutput(); - if (out) - out->frameStarted(); -} - -void Compositor::endRender() -{ - QWaylandOutput *out = defaultOutput(); - if (out) - out->sendFrameCallbacks(); -} - -void Compositor::updateCursor() -{ - m_cursorView.advance(); - QImage image = m_cursorView.currentBuffer().image(); - if (!image.isNull()) - m_window->setCursor(QCursor(QPixmap::fromImage(image), m_cursorHotspotX, m_cursorHotspotY)); -} - -void Compositor::adjustCursorSurface(QWaylandSurface *surface, int hotspotX, int hotspotY) -{ - if ((m_cursorView.surface() != surface)) { - if (m_cursorView.surface()) - disconnect(m_cursorView.surface(), &QWaylandSurface::redraw, this, &Compositor::updateCursor); - if (surface) - connect(surface, &QWaylandSurface::redraw, this, &Compositor::updateCursor); - } - - m_cursorView.setSurface(surface); - m_cursorHotspotX = hotspotX; - m_cursorHotspotY = hotspotY; - - if (surface && surface->hasContent()) - updateCursor(); -} - -void Compositor::closePopups() -{ - m_wlShell->closeAllPopups(); - m_xdgShell->closeAllPopups(); -} - -void Compositor::handleMouseEvent(QWaylandView *target, QMouseEvent *me) -{ - auto popClient = popupClient(); - if (target && me->type() == QEvent::MouseButtonPress - && popClient && popClient != target->surface()->client()) { - closePopups(); - } - - QWaylandSeat *seat = defaultSeat(); - QWaylandSurface *surface = target ? target->surface() : nullptr; - switch (me->type()) { - case QEvent::MouseButtonPress: - seat->sendMousePressEvent(me->button()); - if (surface != seat->keyboardFocus()) { - if (surface == nullptr - || surface->role() == QWaylandWlShellSurface::role() - || surface->role() == QWaylandXdgSurfaceV5::role() - || surface->role() == QWaylandXdgPopupV5::role()) { - seat->setKeyboardFocus(surface); - } - } - break; - case QEvent::MouseButtonRelease: - seat->sendMouseReleaseEvent(me->button()); - break; - case QEvent::MouseMove: - seat->sendMouseMoveEvent(target, me->position(), me->globalPosition()); - default: - break; - } -} - -void Compositor::handleResize(View *target, const QSize &initialSize, const QPoint &delta, int edge) -{ - QWaylandWlShellSurface *wlShellSurface = target->m_wlShellSurface; - if (wlShellSurface) { - QWaylandWlShellSurface::ResizeEdge edges = QWaylandWlShellSurface::ResizeEdge(edge); - QSize newSize = wlShellSurface->sizeForResize(initialSize, delta, edges); - wlShellSurface->sendConfigure(newSize, edges); - } - - QWaylandXdgSurfaceV5 *xdgSurface = target->m_xdgSurface; - if (xdgSurface) { - QWaylandXdgSurfaceV5::ResizeEdge edges = static_cast<QWaylandXdgSurfaceV5::ResizeEdge>(edge); - QSize newSize = xdgSurface->sizeForResize(initialSize, delta, edges); - xdgSurface->sendResizing(newSize); - } -} - -void Compositor::startDrag() -{ - QWaylandDrag *currentDrag = defaultSeat()->drag(); - Q_ASSERT(currentDrag); - View *iconView = findView(currentDrag->icon()); - iconView->setPosition(m_window->mapFromGlobal(QCursor::pos())); - - emit dragStarted(iconView); -} - -void Compositor::handleDrag(View *target, QMouseEvent *me) -{ - QPointF pos = me->position(); - QWaylandSurface *surface = nullptr; - if (target) { - pos -= target->position(); - surface = target->surface(); - } - QWaylandDrag *currentDrag = defaultSeat()->drag(); - currentDrag->dragMove(surface, pos); - if (me->buttons() == Qt::NoButton) { - m_views.removeOne(findView(currentDrag->icon())); - currentDrag->drop(); - } -} - -QWaylandClient *Compositor::popupClient() const -{ - auto client = m_wlShell->popupClient(); - return client ? client : m_xdgShell->popupClient(); -} - -// We only have a flat list of views, plus pointers from child to parent, -// so maintaining a stacking order gets a bit complex. A better data -// structure is left as an exercise for the reader. - -static int findEndOfChildTree(const QList<View*> &list, int index) -{ - int n = list.count(); - View *parent = list.at(index); - while (index + 1 < n) { - if (list.at(index+1)->parentView() != parent) - break; - index = findEndOfChildTree(list, index + 1); - } - return index; -} - -void Compositor::raise(View *view) -{ - int startPos = m_views.indexOf(view); - int endPos = findEndOfChildTree(m_views, startPos); - - int n = m_views.count(); - int tail = n - endPos - 1; - - //bubble sort: move the child tree to the end of the list - for (int i = 0; i < tail; i++) { - int source = endPos + 1 + i; - int dest = startPos + i; - for (int j = source; j > dest; j--) - m_views.swapItemsAt(j, j-1); - } -} diff --git a/examples/wayland/qwindow-compositor/compositor.h b/examples/wayland/qwindow-compositor/compositor.h deleted file mode 100644 index 8f18dc53..00000000 --- a/examples/wayland/qwindow-compositor/compositor.h +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Wayland module -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WINDOWCOMPOSITOR_H -#define WINDOWCOMPOSITOR_H - -#include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandSurface> -#include <QtWaylandCompositor/QWaylandView> -#include <QtWaylandCompositor/QWaylandWlShellSurface> -#include <QtWaylandCompositor/QWaylandXdgSurfaceV5> -#include <QTimer> -#include <QOpenGLTextureBlitter> - -QT_BEGIN_NAMESPACE - -class QWaylandWlShell; -class QWaylandWlShellSurface; -class QWaylandXdgShellV5; -class QOpenGLTexture; -class Compositor; - -class View : public QWaylandView -{ - Q_OBJECT -public: - View(Compositor *compositor); - QOpenGLTexture *getTexture(); - QOpenGLTextureBlitter::Origin textureOrigin() const; - QPointF position() const { return m_position; } - void setPosition(const QPointF &pos) { m_position = pos; } - QSize size() const; - bool isCursor() const; - bool hasShell() const { return m_wlShellSurface; } - void setParentView(View *parent) { m_parentView = parent; } - View *parentView() const { return m_parentView; } - QPointF parentPosition() const { return m_parentView ? (m_parentView->position() + m_parentView->parentPosition()) : QPointF(); } - QSize windowSize() { return m_xdgSurface ? m_xdgSurface->windowGeometry().size() : surface() ? surface()->destinationSize() : m_size; } - QPoint offset() const { return m_offset; } - - qreal animationFactor() const {return m_animationFactor; } - void setAnimationFactor(qreal f) {m_animationFactor = f; } - -signals: - void animationDone(); - -protected: - void timerEvent(QTimerEvent *event) override; - -private: - friend class Compositor; - Compositor *m_compositor = nullptr; - GLenum m_textureTarget = GL_TEXTURE_2D; - QOpenGLTexture *m_texture = nullptr; - QOpenGLTextureBlitter::Origin m_origin; - QPointF m_position; - QSize m_size; - QWaylandWlShellSurface *m_wlShellSurface = nullptr; - QWaylandXdgSurfaceV5 *m_xdgSurface = nullptr; - QWaylandXdgPopupV5 *m_xdgPopup = nullptr; - View *m_parentView = nullptr; - QPoint m_offset; - qreal m_animationFactor = 1.0; - QBasicTimer m_animationTimer; - bool m_animationCountUp; - -public slots: - void onXdgSetMaximized(); - void onXdgUnsetMaximized(); - void onXdgSetFullscreen(QWaylandOutput *output); - void onXdgUnsetFullscreen(); - void onOffsetForNextFrame(const QPoint &offset); - - void startAnimation(bool countUp); - void cancelAnimation(); -}; - -class Compositor : public QWaylandCompositor -{ - Q_OBJECT -public: - Compositor(QWindow *window); - ~Compositor() override; - void create() override; - - void startRender(); - void endRender(); - - QList<View*> views() const { return m_views; } - void raise(View *view); - - void handleMouseEvent(QWaylandView *target, QMouseEvent *me); - void handleResize(View *target, const QSize &initialSize, const QPoint &delta, int edge); - void handleDrag(View *target, QMouseEvent *me); - - QWaylandClient *popupClient() const; - void closePopups(); -protected: - void adjustCursorSurface(QWaylandSurface *surface, int hotspotX, int hotspotY); - -signals: - void startMove(); - void startResize(int edge, bool anchored); - void dragStarted(View *dragIcon); - void frameOffset(const QPoint &offset); - -public slots: - void triggerRender(); - -private slots: - void surfaceHasContentChanged(); - void surfaceDestroyed(); - void viewSurfaceDestroyed(); - void onStartMove(); - void onWlStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges); - void onXdgStartResize(QWaylandSeat *seat, QWaylandXdgSurfaceV5::ResizeEdge edges); - - void startDrag(); - - - void onSurfaceCreated(QWaylandSurface *surface); - void onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface); - void onXdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface); - void onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, - const QPoint &position, const QWaylandResource &resource); - void onSetTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, bool inactive); - void onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent); - - void onSubsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent); - void onSubsurfacePositionChanged(const QPoint &position); - - void updateCursor(); - void viewAnimationDone(); -private: - View *findView(const QWaylandSurface *s) const; - QWindow *m_window = nullptr; - QList<View*> m_views; - QWaylandWlShell *m_wlShell = nullptr; - QWaylandXdgShellV5 *m_xdgShell = nullptr; - QWaylandView m_cursorView; - int m_cursorHotspotX; - int m_cursorHotspotY; -}; - - -QT_END_NAMESPACE - -#endif // WINDOWCOMPOSITOR_H diff --git a/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc b/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc deleted file mode 100644 index c4f408c5..00000000 --- a/examples/wayland/qwindow-compositor/doc/src/qwindow-compositor.qdoc +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Wayland Compositor Examples - QWindow Compositor - \example qwindow-compositor - \brief QWindow Compositor is an example that demonstrates how to write a Wayland compositor in C++. - \ingroup qtwaylandcompositor-examples - - QWindow Compositor is a desktop-style Wayland compositor example that demonstrates the power - of the Qt Wayland Compositor C++ APIs. -*/ diff --git a/examples/wayland/qwindow-compositor/main.cpp b/examples/wayland/qwindow-compositor/main.cpp deleted file mode 100644 index 9d8c1f78..00000000 --- a/examples/wayland/qwindow-compositor/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Wayland module -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QGuiApplication> -#include "window.h" -#include "compositor.h" - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - Window window; - Compositor compositor(&window); - window.setCompositor(&compositor); - window.resize(800,600); - window.show(); - - return app.exec(); -} diff --git a/examples/wayland/qwindow-compositor/qwindow-compositor.pro b/examples/wayland/qwindow-compositor/qwindow-compositor.pro deleted file mode 100644 index b9261e77..00000000 --- a/examples/wayland/qwindow-compositor/qwindow-compositor.pro +++ /dev/null @@ -1,20 +0,0 @@ -QT += gui waylandcompositor - -LIBS += -L ../../lib - -HEADERS += \ - window.h \ - compositor.h - -SOURCES += main.cpp \ - window.cpp \ - compositor.cpp - -# to make QtWaylandCompositor/... style includes working without installing -INCLUDEPATH += $$PWD/../../include - - -RESOURCES += qwindow-compositor.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/wayland/qwindow-compositor -INSTALLS += target diff --git a/examples/wayland/qwindow-compositor/qwindow-compositor.qrc b/examples/wayland/qwindow-compositor/qwindow-compositor.qrc deleted file mode 100644 index 688dd900..00000000 --- a/examples/wayland/qwindow-compositor/qwindow-compositor.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file alias="background.jpg">../pure-qml/images/background.jpg</file> - </qresource> -</RCC> diff --git a/examples/wayland/qwindow-compositor/window.cpp b/examples/wayland/qwindow-compositor/window.cpp deleted file mode 100644 index 34066f42..00000000 --- a/examples/wayland/qwindow-compositor/window.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Wayland module -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "window.h" - -#include <QMouseEvent> -#include <QOpenGLWindow> -#include <QOpenGLTexture> -#include <QOpenGLFunctions> -#include <QMatrix4x4> - -#include "compositor.h" -#include <QtWaylandCompositor/qwaylandseat.h> - -Window::Window() -{ -} - -void Window::setCompositor(Compositor *comp) { - m_compositor = comp; - connect(m_compositor, &Compositor::startMove, this, &Window::startMove); - connect(m_compositor, &Compositor::startResize, this, &Window::startResize); - connect(m_compositor, &Compositor::dragStarted, this, &Window::startDrag); -} - -void Window::initializeGL() -{ - QImage backgroundImage = QImage(QLatin1String(":/background.jpg")).rgbSwapped(); - backgroundImage.invertPixels(); - m_backgroundTexture = new QOpenGLTexture(backgroundImage, QOpenGLTexture::DontGenerateMipMaps); - m_backgroundTexture->setMinificationFilter(QOpenGLTexture::Nearest); - m_backgroundImageSize = backgroundImage.size(); - m_textureBlitter.create(); - m_compositor->create(); // the compositor's hardware integration may depend on GL -} - -void Window::drawBackground() -{ - for (int y = 0; y < height(); y += m_backgroundImageSize.height()) { - for (int x = 0; x < width(); x += m_backgroundImageSize.width()) { - QMatrix4x4 targetTransform = QOpenGLTextureBlitter::targetTransform(QRect(QPoint(x,y), m_backgroundImageSize), QRect(QPoint(0,0), size())); - m_textureBlitter.blit(m_backgroundTexture->textureId(), - targetTransform, - QOpenGLTextureBlitter::OriginTopLeft); - } - } -} - -QPointF Window::getAnchorPosition(const QPointF &position, int resizeEdge, const QSize &windowSize) -{ - float y = position.y(); - if (resizeEdge & QWaylandXdgSurfaceV5::ResizeEdge::TopEdge) - y += windowSize.height(); - - float x = position.x(); - if (resizeEdge & QWaylandXdgSurfaceV5::ResizeEdge::LeftEdge) - x += windowSize.width(); - - return QPointF(x, y); -} - -QPointF Window::getAnchoredPosition(const QPointF &anchorPosition, int resizeEdge, const QSize &windowSize) -{ - return anchorPosition - getAnchorPosition(QPointF(), resizeEdge, windowSize); -} - -void Window::paintGL() -{ - m_compositor->startRender(); - QOpenGLFunctions *functions = context()->functions(); - functions->glClearColor(1.f, .6f, .0f, 0.5f); - functions->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - m_textureBlitter.bind(); - drawBackground(); - - functions->glEnable(GL_BLEND); - functions->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - GLenum currentTarget = GL_TEXTURE_2D; - const auto views = m_compositor->views(); - for (View *view : views) { - if (view->isCursor()) - continue; - auto texture = view->getTexture(); - if (!texture) - continue; - if (texture->target() != currentTarget) { - currentTarget = texture->target(); - m_textureBlitter.bind(currentTarget); - } - QWaylandSurface *surface = view->surface(); - if ((surface && surface->hasContent()) || view->isBufferLocked()) { - QSize s = view->size(); - if (!s.isEmpty()) { - if (m_mouseView == view && m_grabState == ResizeGrab && m_resizeAnchored) - view->setPosition(getAnchoredPosition(m_resizeAnchorPosition, m_resizeEdge, s)); - QPointF pos = view->position() + view->parentPosition(); - QRectF surfaceGeometry(pos, s); - auto surfaceOrigin = view->textureOrigin(); - auto sf = view->animationFactor(); - QRectF targetRect(surfaceGeometry.topLeft() * sf, surfaceGeometry.size() * sf); - QMatrix4x4 targetTransform = QOpenGLTextureBlitter::targetTransform(targetRect, QRect(QPoint(), size())); - m_textureBlitter.blit(texture->textureId(), targetTransform, surfaceOrigin); - } - } - } - functions->glDisable(GL_BLEND); - - m_textureBlitter.release(); - m_compositor->endRender(); -} - -View *Window::viewAt(const QPointF &point) -{ - View *ret = nullptr; - const auto views = m_compositor->views(); - for (View *view : views) { - if (view == m_dragIconView) - continue; - QRectF geom(view->position(), view->size()); - if (geom.contains(point)) - ret = view; - } - return ret; -} - -void Window::startMove() -{ - m_grabState = MoveGrab; -} - -void Window::startResize(int edge, bool anchored) -{ - m_initialSize = m_mouseView->windowSize(); - m_grabState = ResizeGrab; - m_resizeEdge = edge; - m_resizeAnchored = anchored; - m_resizeAnchorPosition = getAnchorPosition(m_mouseView->position(), edge, m_mouseView->surface()->destinationSize()); -} - -void Window::startDrag(View *dragIcon) -{ - m_grabState = DragGrab; - m_dragIconView = dragIcon; - m_compositor->raise(dragIcon); -} - -void Window::mousePressEvent(QMouseEvent *e) -{ - if (mouseGrab()) - return; - if (m_mouseView.isNull()) { - m_mouseView = viewAt(e->position()); - if (!m_mouseView) { - m_compositor->closePopups(); - return; - } - if (e->modifiers() == Qt::AltModifier || e->modifiers() == Qt::MetaModifier) - m_grabState = MoveGrab; //start move - else - m_compositor->raise(m_mouseView); - m_initialMousePos = e->position(); - m_mouseOffset = e->position() - m_mouseView->position(); - - QMouseEvent moveEvent(QEvent::MouseMove, e->position(), e->globalPosition(), Qt::NoButton, Qt::NoButton, e->modifiers()); - sendMouseEvent(&moveEvent, m_mouseView); - } - sendMouseEvent(e, m_mouseView); -} - -void Window::mouseReleaseEvent(QMouseEvent *e) -{ - if (!mouseGrab()) - sendMouseEvent(e, m_mouseView); - if (e->buttons() == Qt::NoButton) { - if (m_grabState == DragGrab) { - View *view = viewAt(e->position()); - m_compositor->handleDrag(view, e); - } - m_mouseView = nullptr; - m_grabState = NoGrab; - } -} - -void Window::mouseMoveEvent(QMouseEvent *e) -{ - switch (m_grabState) { - case NoGrab: { - View *view = m_mouseView ? m_mouseView.data() : viewAt(e->position()); - sendMouseEvent(e, view); - if (!view) - setCursor(Qt::ArrowCursor); - } - break; - case MoveGrab: { - m_mouseView->setPosition(e->position() - m_mouseOffset); - update(); - } - break; - case ResizeGrab: { - QPoint delta = (e->position() - m_initialMousePos).toPoint(); - m_compositor->handleResize(m_mouseView, m_initialSize, delta, m_resizeEdge); - } - break; - case DragGrab: { - View *view = viewAt(e->position()); - m_compositor->handleDrag(view, e); - if (m_dragIconView) { - m_dragIconView->setPosition(e->position() + m_dragIconView->offset()); - update(); - } - } - break; - } -} - -void Window::sendMouseEvent(QMouseEvent *e, View *target) -{ - QPointF mappedPos = e->position(); - if (target) - mappedPos -= target->position(); - QMouseEvent viewEvent(e->type(), mappedPos, e->position(), e->button(), e->buttons(), e->modifiers()); - m_compositor->handleMouseEvent(target, &viewEvent); -} - -void Window::keyPressEvent(QKeyEvent *e) -{ - m_compositor->defaultSeat()->sendKeyPressEvent(e->nativeScanCode()); -} - -void Window::keyReleaseEvent(QKeyEvent *e) -{ - m_compositor->defaultSeat()->sendKeyReleaseEvent(e->nativeScanCode()); -} diff --git a/examples/wayland/qwindow-compositor/window.h b/examples/wayland/qwindow-compositor/window.h deleted file mode 100644 index c16e726b..00000000 --- a/examples/wayland/qwindow-compositor/window.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Wayland module -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef COMPOSITORWINDOW_H -#define COMPOSITORWINDOW_H - -#include <QOpenGLWindow> -#include <QPointer> -#include <QOpenGLTextureBlitter> - -QT_BEGIN_NAMESPACE - -class Compositor; -class View; -class QOpenGLTexture; - -class Window : public QOpenGLWindow -{ -public: - Window(); - - void setCompositor(Compositor *comp); - -protected: - void initializeGL() override; - void paintGL() override; - - void mousePressEvent(QMouseEvent *e) override; - void mouseReleaseEvent(QMouseEvent *e) override; - void mouseMoveEvent(QMouseEvent *e) override; - - void keyPressEvent(QKeyEvent *e) override; - void keyReleaseEvent(QKeyEvent *e) override; - -private slots: - void startMove(); - void startResize(int edge, bool anchored); - void startDrag(View *dragIcon); - -private: - enum GrabState { NoGrab, MoveGrab, ResizeGrab, DragGrab }; - - View *viewAt(const QPointF &point); - bool mouseGrab() const { return m_grabState != NoGrab ;} - void drawBackground(); - void sendMouseEvent(QMouseEvent *e, View *target); - static QPointF getAnchoredPosition(const QPointF &anchorPosition, int resizeEdge, const QSize &windowSize); - static QPointF getAnchorPosition(const QPointF &position, int resizeEdge, const QSize &windowSize); - - QOpenGLTextureBlitter m_textureBlitter; - QSize m_backgroundImageSize; - QOpenGLTexture *m_backgroundTexture = nullptr; - Compositor *m_compositor = nullptr; - QPointer<View> m_mouseView; - GrabState m_grabState = NoGrab; - QSize m_initialSize; - int m_resizeEdge; - bool m_resizeAnchored; - QPointF m_resizeAnchorPosition; - QPointF m_mouseOffset; - QPointF m_initialMousePos; - View *m_dragIconView = nullptr; -}; - -QT_END_NAMESPACE - -#endif // COMPOSITORWINDOW_H diff --git a/examples/wayland/texture-sharing/custom-compositor/qml/main.qml b/examples/wayland/texture-sharing/custom-compositor/qml/main.qml index 6a0b90c8..fc6befd9 100644 --- a/examples/wayland/texture-sharing/custom-compositor/qml/main.qml +++ b/examples/wayland/texture-sharing/custom-compositor/qml/main.qml @@ -105,10 +105,6 @@ WaylandCompositor { onWlShellSurfaceCreated: shellSurfaces.append({shellSurface: shellSurface}); } - XdgShellV6 { - onToplevelCreated: - shellSurfaces.append({shellSurface: xdgSurface}); - } XdgShell { onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface}); diff --git a/examples/wayland/texture-sharing/minimal-compositor.qml b/examples/wayland/texture-sharing/minimal-compositor.qml index 226da429..84756047 100644 --- a/examples/wayland/texture-sharing/minimal-compositor.qml +++ b/examples/wayland/texture-sharing/minimal-compositor.qml @@ -75,10 +75,6 @@ WaylandCompositor { onWlShellSurfaceCreated: shellSurfaces.append({shellSurface: shellSurface}); } - XdgShellV6 { - onToplevelCreated: - shellSurfaces.append({shellSurface: xdgSurface}); - } XdgShell { onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface}); diff --git a/examples/wayland/wayland.pro b/examples/wayland/wayland.pro index f9287481..e7ff0a16 100644 --- a/examples/wayland/wayland.pro +++ b/examples/wayland/wayland.pro @@ -5,7 +5,6 @@ TEMPLATE=subdirs qtConfig(opengl) { SUBDIRS += \ - qwindow-compositor \ minimal-cpp } diff --git a/src/3rdparty/protocol/qt_attribution.json b/src/3rdparty/protocol/qt_attribution.json index 87f24227..d714d1dc 100644 --- a/src/3rdparty/protocol/qt_attribution.json +++ b/src/3rdparty/protocol/qt_attribution.json @@ -163,7 +163,7 @@ Copyright 2015-2016 © Red Hat, Inc." "Name": "Wayland XDG Shell Protocol", "QDocModule": "qtwaylandcompositor", "QtUsage": "Used in the Qt Wayland Compositor, and the Qt Wayland platform plugin.", - "Files": " xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp ../../compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c ../../compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c", + "Files": " xdg-shell-unstable-v5.xml xdg-shell-unstable-v6.xml xdg-shell.xml ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5.cpp ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/qwayland-xdg-shell-unstable-v5_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-client-protocol_p.h ../../plugins/shellintegration/xdg-shell-v5/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c", "Description": "The XDG-Shell protocol is an extended way to manage surfaces under Wayland compositors.", "Homepage": "https://gitlab.freedesktop.org/wayland/wayland-protocols/", diff --git a/src/compositor/.prev_CMakeLists.txt b/src/compositor/.prev_CMakeLists.txt index 19303dac..d5bcb713 100644 --- a/src/compositor/.prev_CMakeLists.txt +++ b/src/compositor/.prev_CMakeLists.txt @@ -26,9 +26,6 @@ qt_add_module(WaylandCompositor compositor_api/qwaylandsurfacegrabber.cpp compositor_api/qwaylandsurfacegrabber.h compositor_api/qwaylandtouch.cpp compositor_api/qwaylandtouch.h compositor_api/qwaylandtouch_p.h compositor_api/qwaylandview.cpp compositor_api/qwaylandview.h compositor_api/qwaylandview_p.h - extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h - extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c - extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h extensions/qwaylandidleinhibitv1.cpp extensions/qwaylandidleinhibitv1.h extensions/qwaylandidleinhibitv1_p.h extensions/qwaylandiviapplication.cpp extensions/qwaylandiviapplication.h extensions/qwaylandiviapplication_p.h extensions/qwaylandivisurface.cpp extensions/qwaylandivisurface.h extensions/qwaylandivisurface_p.h @@ -38,13 +35,10 @@ qt_add_module(WaylandCompositor extensions/qwaylandtextinput.cpp extensions/qwaylandtextinput.h extensions/qwaylandtextinput_p.h extensions/qwaylandtextinputmanager.cpp extensions/qwaylandtextinputmanager.h extensions/qwaylandtextinputmanager_p.h extensions/qwaylandviewporter.cpp extensions/qwaylandviewporter.h extensions/qwaylandviewporter_p.h - extensions/qwaylandwlscaler.cpp extensions/qwaylandwlscaler.h extensions/qwaylandwlscaler_p.h extensions/qwaylandwlshell.cpp extensions/qwaylandwlshell.h extensions/qwaylandwlshell_p.h extensions/qwaylandxdgdecorationv1.cpp extensions/qwaylandxdgdecorationv1.h extensions/qwaylandxdgdecorationv1_p.h extensions/qwaylandxdgoutputv1.cpp extensions/qwaylandxdgoutputv1.h extensions/qwaylandxdgoutputv1_p.h extensions/qwaylandxdgshell.cpp extensions/qwaylandxdgshell.h extensions/qwaylandxdgshell_p.h - extensions/qwaylandxdgshellv5.cpp extensions/qwaylandxdgshellv5.h extensions/qwaylandxdgshellv5_p.h - extensions/qwaylandxdgshellv6.cpp extensions/qwaylandxdgshellv6.h extensions/qwaylandxdgshellv6_p.h extensions/qwlqtkey.cpp extensions/qwlqtkey_p.h extensions/qwlqttouch.cpp extensions/qwlqttouch_p.h global/qtwaylandcompositorglobal.h @@ -101,7 +95,6 @@ qt6_generate_wayland_protocol_server_sources(WaylandCompositor ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-decoration-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell-unstable-v6.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml @@ -156,8 +149,6 @@ qt_extend_target(WaylandCompositor CONDITION TARGET Qt::Quick extensions/qwaylandquickxdgoutputv1.cpp extensions/qwaylandquickxdgoutputv1.h extensions/qwaylandwlshellintegration.cpp extensions/qwaylandwlshellintegration_p.h extensions/qwaylandxdgshellintegration.cpp extensions/qwaylandxdgshellintegration_p.h - extensions/qwaylandxdgshellv5integration.cpp extensions/qwaylandxdgshellv5integration_p.h - extensions/qwaylandxdgshellv6integration.cpp extensions/qwaylandxdgshellv6integration_p.h LIBRARIES Qt::QuickPrivate PUBLIC_LIBRARIES diff --git a/src/compositor/CMakeLists.txt b/src/compositor/CMakeLists.txt index c56f1a58..18e1cd6c 100644 --- a/src/compositor/CMakeLists.txt +++ b/src/compositor/CMakeLists.txt @@ -26,9 +26,6 @@ qt_add_module(WaylandCompositor compositor_api/qwaylandsurfacegrabber.cpp compositor_api/qwaylandsurfacegrabber.h compositor_api/qwaylandtouch.cpp compositor_api/qwaylandtouch.h compositor_api/qwaylandtouch_p.h compositor_api/qwaylandview.cpp compositor_api/qwaylandview.h compositor_api/qwaylandview_p.h - extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h - extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c - extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h extensions/qwaylandidleinhibitv1.cpp extensions/qwaylandidleinhibitv1.h extensions/qwaylandidleinhibitv1_p.h extensions/qwaylandiviapplication.cpp extensions/qwaylandiviapplication.h extensions/qwaylandiviapplication_p.h extensions/qwaylandivisurface.cpp extensions/qwaylandivisurface.h extensions/qwaylandivisurface_p.h @@ -38,13 +35,10 @@ qt_add_module(WaylandCompositor extensions/qwaylandtextinput.cpp extensions/qwaylandtextinput.h extensions/qwaylandtextinput_p.h extensions/qwaylandtextinputmanager.cpp extensions/qwaylandtextinputmanager.h extensions/qwaylandtextinputmanager_p.h extensions/qwaylandviewporter.cpp extensions/qwaylandviewporter.h extensions/qwaylandviewporter_p.h - extensions/qwaylandwlscaler.cpp extensions/qwaylandwlscaler.h extensions/qwaylandwlscaler_p.h extensions/qwaylandwlshell.cpp extensions/qwaylandwlshell.h extensions/qwaylandwlshell_p.h extensions/qwaylandxdgdecorationv1.cpp extensions/qwaylandxdgdecorationv1.h extensions/qwaylandxdgdecorationv1_p.h extensions/qwaylandxdgoutputv1.cpp extensions/qwaylandxdgoutputv1.h extensions/qwaylandxdgoutputv1_p.h extensions/qwaylandxdgshell.cpp extensions/qwaylandxdgshell.h extensions/qwaylandxdgshell_p.h - extensions/qwaylandxdgshellv5.cpp extensions/qwaylandxdgshellv5.h extensions/qwaylandxdgshellv5_p.h - extensions/qwaylandxdgshellv6.cpp extensions/qwaylandxdgshellv6.h extensions/qwaylandxdgshellv6_p.h extensions/qwlqtkey.cpp extensions/qwlqtkey_p.h extensions/qwlqttouch.cpp extensions/qwlqttouch_p.h global/qtwaylandcompositorglobal.h @@ -101,7 +95,6 @@ qt6_generate_wayland_protocol_server_sources(WaylandCompositor ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-decoration-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-output-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell.xml - ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/protocol/xdg-shell-unstable-v6.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-key-unstable-v1.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/qt-windowmanager.xml ${CMAKE_CURRENT_SOURCE_DIR}/../extensions/touch-extension.xml @@ -156,8 +149,6 @@ qt_extend_target(WaylandCompositor CONDITION TARGET Qt::Quick extensions/qwaylandquickxdgoutputv1.cpp extensions/qwaylandquickxdgoutputv1.h extensions/qwaylandwlshellintegration.cpp extensions/qwaylandwlshellintegration_p.h extensions/qwaylandxdgshellintegration.cpp extensions/qwaylandxdgshellintegration_p.h - extensions/qwaylandxdgshellv5integration.cpp extensions/qwaylandxdgshellv5integration_p.h - extensions/qwaylandxdgshellv6integration.cpp extensions/qwaylandxdgshellv6integration_p.h LIBRARIES Qt::QuickPrivate PUBLIC_LIBRARIES diff --git a/src/compositor/compositor_api/qwaylandquicksurface.cpp b/src/compositor/compositor_api/qwaylandquicksurface.cpp index 8b2f13a3..76bb4a3b 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.cpp +++ b/src/compositor/compositor_api/qwaylandquicksurface.cpp @@ -94,28 +94,4 @@ void QWaylandQuickSurface::setUseTextureAlpha(bool useTextureAlpha) } } -/*! - * \qmlproperty bool QtWaylandCompositor::WaylandSurface::clientRenderingEnabled - * \deprecated - * - * This property used to specify whether client rendering was enabled for the surface. - * It depended on a Wayland extension that was part of the private API. The surface extension - * is not used anymore, so this property does nothing. - */ -bool QWaylandQuickSurface::clientRenderingEnabled() const -{ - Q_D(const QWaylandQuickSurface); - return d->clientRenderingEnabled; -} - -void QWaylandQuickSurface::setClientRenderingEnabled(bool enabled) -{ - Q_D(QWaylandQuickSurface); - qWarning() << Q_FUNC_INFO << "doesn't do anything"; - if (d->clientRenderingEnabled != enabled) { - d->clientRenderingEnabled = enabled; - emit clientRenderingEnabledChanged(); - } -} - QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquicksurface.h b/src/compositor/compositor_api/qwaylandquicksurface.h index 394fc8e0..b0f3f012 100644 --- a/src/compositor/compositor_api/qwaylandquicksurface.h +++ b/src/compositor/compositor_api/qwaylandquicksurface.h @@ -46,7 +46,6 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickSurface : public QWaylandSurface Q_DECLARE_PRIVATE(QWaylandQuickSurface) Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandQuickSurface) Q_PROPERTY(bool useTextureAlpha READ useTextureAlpha WRITE setUseTextureAlpha NOTIFY useTextureAlphaChanged) - Q_PROPERTY(bool clientRenderingEnabled READ clientRenderingEnabled WRITE setClientRenderingEnabled NOTIFY clientRenderingEnabledChanged) public: QWaylandQuickSurface(); QWaylandQuickSurface(QWaylandCompositor *compositor, QWaylandClient *client, quint32 id, int version); @@ -55,12 +54,8 @@ public: bool useTextureAlpha() const; void setUseTextureAlpha(bool useTextureAlpha); - Q_DECL_DEPRECATED bool clientRenderingEnabled() const; - Q_DECL_DEPRECATED void setClientRenderingEnabled(bool enabled); - Q_SIGNALS: void useTextureAlphaChanged(); - void clientRenderingEnabledChanged(); //deprecated }; QT_END_NAMESPACE diff --git a/src/compositor/extensions/extensions.pri b/src/compositor/extensions/extensions.pri index 64b1439b..d7729a19 100644 --- a/src/compositor/extensions/extensions.pri +++ b/src/compositor/extensions/extensions.pri @@ -11,7 +11,6 @@ WAYLANDSERVERSOURCES += \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/viewporter.xml \ ../3rdparty/protocol/scaler.xml \ - ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ ../3rdparty/protocol/xdg-shell.xml \ ../3rdparty/protocol/xdg-decoration-unstable-v1.xml \ ../3rdparty/protocol/xdg-output-unstable-v1.xml \ @@ -33,12 +32,6 @@ HEADERS += \ extensions/qwaylandqtwindowmanager_p.h \ extensions/qwaylandviewporter.h \ extensions/qwaylandviewporter_p.h \ - extensions/qwaylandwlscaler.h \ - extensions/qwaylandwlscaler_p.h \ - extensions/qwaylandxdgshellv5.h \ - extensions/qwaylandxdgshellv5_p.h \ - extensions/qwaylandxdgshellv6.h \ - extensions/qwaylandxdgshellv6_p.h \ extensions/qwaylandxdgshell.h \ extensions/qwaylandxdgshell_p.h \ extensions/qwaylandxdgdecorationv1.h \ @@ -62,9 +55,6 @@ SOURCES += \ extensions/qwaylandtextinputmanager.cpp \ extensions/qwaylandqtwindowmanager.cpp \ extensions/qwaylandviewporter.cpp \ - extensions/qwaylandwlscaler.cpp \ - extensions/qwaylandxdgshellv5.cpp \ - extensions/qwaylandxdgshellv6.cpp \ extensions/qwaylandxdgshell.cpp \ extensions/qwaylandxdgdecorationv1.cpp \ extensions/qwaylandxdgoutputv1.cpp \ @@ -83,8 +73,6 @@ qtHaveModule(quick) { extensions/qwaylandivisurfaceintegration_p.h \ extensions/qwaylandwlshellintegration_p.h \ extensions/qwaylandquickxdgoutputv1.h \ - extensions/qwaylandxdgshellv5integration_p.h \ - extensions/qwaylandxdgshellv6integration_p.h \ extensions/qwaylandxdgshellintegration_p.h \ SOURCES += \ @@ -93,8 +81,6 @@ qtHaveModule(quick) { extensions/qwaylandivisurfaceintegration.cpp \ extensions/qwaylandwlshellintegration.cpp \ extensions/qwaylandquickxdgoutputv1.cpp \ - extensions/qwaylandxdgshellv5integration.cpp \ - extensions/qwaylandxdgshellv6integration.cpp \ extensions/qwaylandxdgshellintegration.cpp \ qtConfig(opengl) { @@ -109,6 +95,4 @@ qtHaveModule(quick) { } } -include ($$PWD/pregenerated/xdg-shell-v5.pri) - INCLUDEPATH += extensions diff --git a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp b/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp deleted file mode 100644 index 78877171..00000000 --- a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp +++ /dev/null @@ -1,890 +0,0 @@ -/* - * Copyright © 2008-2013 Kristian Høgsberg - * Copyright © 2013 Rafael Antognolli - * Copyright © 2013 Jasper St. Pierre - * Copyright © 2010-2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <QtWaylandCompositor/private/qwayland-server-xdg-shell-unstable-v5_p.h> - -QT_BEGIN_NAMESPACE -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers") - -namespace QtWaylandServer { - xdg_shell_v5::xdg_shell_v5(struct ::wl_client *client, int id, int version) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(client, id, version); - } - - xdg_shell_v5::xdg_shell_v5(struct ::wl_display *display, int version) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(display, version); - } - - xdg_shell_v5::xdg_shell_v5(struct ::wl_resource *resource) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(resource); - } - - xdg_shell_v5::xdg_shell_v5() - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - } - - xdg_shell_v5::~xdg_shell_v5() - { - for (auto resource : qAsConst(m_resource_map)) - wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr); - - if (m_global) { - wl_global_destroy(m_global); - wl_list_remove(&m_displayDestroyedListener.link); - } - } - - void xdg_shell_v5::init(struct ::wl_client *client, int id, int version) - { - m_resource = bind(client, id, version); - } - - void xdg_shell_v5::init(struct ::wl_resource *resource) - { - m_resource = bind(resource); - } - - xdg_shell_v5::Resource *xdg_shell_v5::add(struct ::wl_client *client, int version) - { - Resource *resource = bind(client, 0, version); - m_resource_map.insert(client, resource); - return resource; - } - - xdg_shell_v5::Resource *xdg_shell_v5::add(struct ::wl_client *client, int id, int version) - { - Resource *resource = bind(client, id, version); - m_resource_map.insert(client, resource); - return resource; - } - - void xdg_shell_v5::init(struct ::wl_display *display, int version) - { - m_global = wl_global_create(display, &::xdg_shell_v5_interface, version, this, bind_func); - m_globalVersion = version; - m_displayDestroyedListener.notify = xdg_shell_v5::display_destroy_func; - m_displayDestroyedListener.parent = this; - wl_display_add_destroy_listener(display, &m_displayDestroyedListener); - } - - const struct wl_interface *xdg_shell_v5::interface() - { - return &::xdg_shell_v5_interface; - } - - xdg_shell_v5::Resource *xdg_shell_v5::xdg_shell_allocate() - { - return new Resource; - } - - void xdg_shell_v5::xdg_shell_bind_resource(Resource *) - { - } - - void xdg_shell_v5::xdg_shell_destroy_resource(Resource *) - { - } - - void xdg_shell_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) - { - xdg_shell_v5 *that = static_cast<xdg_shell_v5 *>(data); - that->add(client, id, qMin(that->m_globalVersion, version)); - } - - void xdg_shell_v5::display_destroy_func(struct ::wl_listener *listener, void *data) - { - Q_UNUSED(data); - xdg_shell_v5 *that = static_cast<xdg_shell_v5::DisplayDestroyedListener *>(listener)->parent; - that->m_global = nullptr; - } - - void xdg_shell_v5::destroy_func(struct ::wl_resource *client_resource) - { - Resource *resource = Resource::fromResource(client_resource); - xdg_shell_v5 *that = resource->xdg_shell_object; - that->m_resource_map.remove(resource->client(), resource); - that->xdg_shell_destroy_resource(resource); - delete resource; - } - - xdg_shell_v5::Resource *xdg_shell_v5::bind(struct ::wl_client *client, uint32_t id, int version) - { - Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData()); - struct ::wl_resource *handle = wl_resource_create(client, &::xdg_shell_v5_interface, version, id); - return bind(handle); - } - - xdg_shell_v5::Resource *xdg_shell_v5::bind(struct ::wl_resource *handle) - { - Resource *resource = xdg_shell_allocate(); - resource->xdg_shell_object = this; - - wl_resource_set_implementation(handle, &m_xdg_shell_interface, resource, destroy_func); - resource->handle = handle; - xdg_shell_bind_resource(resource); - return resource; - } - xdg_shell_v5::Resource *xdg_shell_v5::Resource::fromResource(struct ::wl_resource *resource) - { - if (wl_resource_instance_of(resource, &::xdg_shell_v5_interface, &m_xdg_shell_interface)) - return static_cast<Resource *>(resource->data); - return nullptr; - } - - const struct ::xdg_shell_v5_interface xdg_shell_v5::m_xdg_shell_interface = { - xdg_shell_v5::handle_destroy, - xdg_shell_v5::handle_use_unstable_version, - xdg_shell_v5::handle_get_xdg_surface, - xdg_shell_v5::handle_get_xdg_popup, - xdg_shell_v5::handle_pong - }; - - void xdg_shell_v5::xdg_shell_destroy(Resource *) - { - } - - void xdg_shell_v5::xdg_shell_use_unstable_version(Resource *, int32_t ) - { - } - - void xdg_shell_v5::xdg_shell_get_xdg_surface(Resource *, uint32_t, struct ::wl_resource *) - { - } - - void xdg_shell_v5::xdg_shell_get_xdg_popup(Resource *, uint32_t, struct ::wl_resource *, struct ::wl_resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t ) - { - } - - void xdg_shell_v5::xdg_shell_pong(Resource *, uint32_t ) - { - } - - - void xdg_shell_v5::handle_destroy( - ::wl_client *client, - struct wl_resource *resource) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_destroy( - r); - } - - void xdg_shell_v5::handle_use_unstable_version( - ::wl_client *client, - struct wl_resource *resource, - int32_t version) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_use_unstable_version( - r, - version); - } - - void xdg_shell_v5::handle_get_xdg_surface( - ::wl_client *client, - struct wl_resource *resource, - uint32_t id, - struct ::wl_resource *surface) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_get_xdg_surface( - r, - id, - surface); - } - - void xdg_shell_v5::handle_get_xdg_popup( - ::wl_client *client, - struct wl_resource *resource, - uint32_t id, - struct ::wl_resource *surface, - struct ::wl_resource *parent, - struct ::wl_resource *seat, - uint32_t serial, - int32_t x, - int32_t y) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_get_xdg_popup( - r, - id, - surface, - parent, - seat, - serial, - x, - y); - } - - void xdg_shell_v5::handle_pong( - ::wl_client *client, - struct wl_resource *resource, - uint32_t serial) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_shell_v5 *>(r->xdg_shell_object)->xdg_shell_pong( - r, - serial); - } - - void xdg_shell_v5::send_ping(uint32_t serial) - { - send_ping( - m_resource->handle, - serial); - } - - void xdg_shell_v5::send_ping(struct ::wl_resource *resource, uint32_t serial) - { - xdg_shell_send_ping( - resource, - serial); - } - - - xdg_surface_v5::xdg_surface_v5(struct ::wl_client *client, int id, int version) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(client, id, version); - } - - xdg_surface_v5::xdg_surface_v5(struct ::wl_display *display, int version) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(display, version); - } - - xdg_surface_v5::xdg_surface_v5(struct ::wl_resource *resource) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(resource); - } - - xdg_surface_v5::xdg_surface_v5() - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - } - - xdg_surface_v5::~xdg_surface_v5() - { - for (auto resource : qAsConst(m_resource_map)) - wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr); - - if (m_global) { - wl_global_destroy(m_global); - wl_list_remove(&m_displayDestroyedListener.link); - } - } - - void xdg_surface_v5::init(struct ::wl_client *client, int id, int version) - { - m_resource = bind(client, id, version); - } - - void xdg_surface_v5::init(struct ::wl_resource *resource) - { - m_resource = bind(resource); - } - - xdg_surface_v5::Resource *xdg_surface_v5::add(struct ::wl_client *client, int version) - { - Resource *resource = bind(client, 0, version); - m_resource_map.insert(client, resource); - return resource; - } - - xdg_surface_v5::Resource *xdg_surface_v5::add(struct ::wl_client *client, int id, int version) - { - Resource *resource = bind(client, id, version); - m_resource_map.insert(client, resource); - return resource; - } - - void xdg_surface_v5::init(struct ::wl_display *display, int version) - { - m_global = wl_global_create(display, &::xdg_surface_v5_interface, version, this, bind_func); - m_globalVersion = version; - m_displayDestroyedListener.notify = xdg_surface_v5::display_destroy_func; - m_displayDestroyedListener.parent = this; - wl_display_add_destroy_listener(display, &m_displayDestroyedListener); - } - - const struct wl_interface *xdg_surface_v5::interface() - { - return &::xdg_surface_v5_interface; - } - - xdg_surface_v5::Resource *xdg_surface_v5::xdg_surface_allocate() - { - return new Resource; - } - - void xdg_surface_v5::xdg_surface_bind_resource(Resource *) - { - } - - void xdg_surface_v5::xdg_surface_destroy_resource(Resource *) - { - } - - void xdg_surface_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) - { - xdg_surface_v5 *that = static_cast<xdg_surface_v5 *>(data); - that->add(client, id, qMin(that->m_globalVersion, version)); - } - - void xdg_surface_v5::display_destroy_func(struct ::wl_listener *listener, void *data) - { - Q_UNUSED(data); - xdg_surface_v5 *that = static_cast<xdg_surface_v5::DisplayDestroyedListener *>(listener)->parent; - that->m_global = nullptr; - } - - void xdg_surface_v5::destroy_func(struct ::wl_resource *client_resource) - { - Resource *resource = Resource::fromResource(client_resource); - xdg_surface_v5 *that = resource->xdg_surface_object; - that->m_resource_map.remove(resource->client(), resource); - that->xdg_surface_destroy_resource(resource); - delete resource; - } - - xdg_surface_v5::Resource *xdg_surface_v5::bind(struct ::wl_client *client, uint32_t id, int version) - { - Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData()); - struct ::wl_resource *handle = wl_resource_create(client, &::xdg_surface_v5_interface, version, id); - return bind(handle); - } - - xdg_surface_v5::Resource *xdg_surface_v5::bind(struct ::wl_resource *handle) - { - Resource *resource = xdg_surface_allocate(); - resource->xdg_surface_object = this; - - wl_resource_set_implementation(handle, &m_xdg_surface_interface, resource, destroy_func); - resource->handle = handle; - xdg_surface_bind_resource(resource); - return resource; - } - xdg_surface_v5::Resource *xdg_surface_v5::Resource::fromResource(struct ::wl_resource *resource) - { - if (wl_resource_instance_of(resource, &::xdg_surface_v5_interface, &m_xdg_surface_interface)) - return static_cast<Resource *>(resource->data); - return nullptr; - } - - const struct ::xdg_surface_v5_interface xdg_surface_v5::m_xdg_surface_interface = { - xdg_surface_v5::handle_destroy, - xdg_surface_v5::handle_set_parent, - xdg_surface_v5::handle_set_title, - xdg_surface_v5::handle_set_app_id, - xdg_surface_v5::handle_show_window_menu, - xdg_surface_v5::handle_move, - xdg_surface_v5::handle_resize, - xdg_surface_v5::handle_ack_configure, - xdg_surface_v5::handle_set_window_geometry, - xdg_surface_v5::handle_set_maximized, - xdg_surface_v5::handle_unset_maximized, - xdg_surface_v5::handle_set_fullscreen, - xdg_surface_v5::handle_unset_fullscreen, - xdg_surface_v5::handle_set_minimized - }; - - void xdg_surface_v5::xdg_surface_destroy(Resource *) - { - } - - void xdg_surface_v5::xdg_surface_set_parent(Resource *, struct ::wl_resource *) - { - } - - void xdg_surface_v5::xdg_surface_set_title(Resource *, const QString &) - { - } - - void xdg_surface_v5::xdg_surface_set_app_id(Resource *, const QString &) - { - } - - void xdg_surface_v5::xdg_surface_show_window_menu(Resource *, struct ::wl_resource *, uint32_t , int32_t , int32_t ) - { - } - - void xdg_surface_v5::xdg_surface_move(Resource *, struct ::wl_resource *, uint32_t ) - { - } - - void xdg_surface_v5::xdg_surface_resize(Resource *, struct ::wl_resource *, uint32_t , uint32_t ) - { - } - - void xdg_surface_v5::xdg_surface_ack_configure(Resource *, uint32_t ) - { - } - - void xdg_surface_v5::xdg_surface_set_window_geometry(Resource *, int32_t , int32_t , int32_t , int32_t ) - { - } - - void xdg_surface_v5::xdg_surface_set_maximized(Resource *) - { - } - - void xdg_surface_v5::xdg_surface_unset_maximized(Resource *) - { - } - - void xdg_surface_v5::xdg_surface_set_fullscreen(Resource *, struct ::wl_resource *) - { - } - - void xdg_surface_v5::xdg_surface_unset_fullscreen(Resource *) - { - } - - void xdg_surface_v5::xdg_surface_set_minimized(Resource *) - { - } - - - void xdg_surface_v5::handle_destroy( - ::wl_client *client, - struct wl_resource *resource) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_destroy( - r); - } - - void xdg_surface_v5::handle_set_parent( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *parent) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_parent( - r, - parent); - } - - void xdg_surface_v5::handle_set_title( - ::wl_client *client, - struct wl_resource *resource, - const char *title) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_title( - r, - QString::fromUtf8(title)); - } - - void xdg_surface_v5::handle_set_app_id( - ::wl_client *client, - struct wl_resource *resource, - const char *app_id) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_app_id( - r, - QString::fromUtf8(app_id)); - } - - void xdg_surface_v5::handle_show_window_menu( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *seat, - uint32_t serial, - int32_t x, - int32_t y) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_show_window_menu( - r, - seat, - serial, - x, - y); - } - - void xdg_surface_v5::handle_move( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *seat, - uint32_t serial) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_move( - r, - seat, - serial); - } - - void xdg_surface_v5::handle_resize( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *seat, - uint32_t serial, - uint32_t edges) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_resize( - r, - seat, - serial, - edges); - } - - void xdg_surface_v5::handle_ack_configure( - ::wl_client *client, - struct wl_resource *resource, - uint32_t serial) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_ack_configure( - r, - serial); - } - - void xdg_surface_v5::handle_set_window_geometry( - ::wl_client *client, - struct wl_resource *resource, - int32_t x, - int32_t y, - int32_t width, - int32_t height) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_window_geometry( - r, - x, - y, - width, - height); - } - - void xdg_surface_v5::handle_set_maximized( - ::wl_client *client, - struct wl_resource *resource) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_maximized( - r); - } - - void xdg_surface_v5::handle_unset_maximized( - ::wl_client *client, - struct wl_resource *resource) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_unset_maximized( - r); - } - - void xdg_surface_v5::handle_set_fullscreen( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *output) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_fullscreen( - r, - output); - } - - void xdg_surface_v5::handle_unset_fullscreen( - ::wl_client *client, - struct wl_resource *resource) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_unset_fullscreen( - r); - } - - void xdg_surface_v5::handle_set_minimized( - ::wl_client *client, - struct wl_resource *resource) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_surface_v5 *>(r->xdg_surface_object)->xdg_surface_set_minimized( - r); - } - - void xdg_surface_v5::send_configure(int32_t width, int32_t height, const QByteArray &states, uint32_t serial) - { - send_configure( - m_resource->handle, - width, - height, - states, - serial); - } - - void xdg_surface_v5::send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, const QByteArray &states, uint32_t serial) - { - struct wl_array states_data; - states_data.size = states.size(); - states_data.data = static_cast<void *>(const_cast<char *>(states.constData())); - states_data.alloc = 0; - - xdg_surface_send_configure( - resource, - width, - height, - &states_data, - serial); - } - - - void xdg_surface_v5::send_close() - { - send_close( - m_resource->handle); - } - - void xdg_surface_v5::send_close(struct ::wl_resource *resource) - { - xdg_surface_send_close( - resource); - } - - - xdg_popup_v5::xdg_popup_v5(struct ::wl_client *client, int id, int version) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(client, id, version); - } - - xdg_popup_v5::xdg_popup_v5(struct ::wl_display *display, int version) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(display, version); - } - - xdg_popup_v5::xdg_popup_v5(struct ::wl_resource *resource) - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - init(resource); - } - - xdg_popup_v5::xdg_popup_v5() - : m_resource_map() - , m_resource(nullptr) - , m_global(nullptr) - { - } - - xdg_popup_v5::~xdg_popup_v5() - { - for (auto resource : qAsConst(m_resource_map)) - wl_resource_set_implementation(resource->handle, nullptr, nullptr, nullptr); - - if (m_global) { - wl_global_destroy(m_global); - wl_list_remove(&m_displayDestroyedListener.link); - } - } - - void xdg_popup_v5::init(struct ::wl_client *client, int id, int version) - { - m_resource = bind(client, id, version); - } - - void xdg_popup_v5::init(struct ::wl_resource *resource) - { - m_resource = bind(resource); - } - - xdg_popup_v5::Resource *xdg_popup_v5::add(struct ::wl_client *client, int version) - { - Resource *resource = bind(client, 0, version); - m_resource_map.insert(client, resource); - return resource; - } - - xdg_popup_v5::Resource *xdg_popup_v5::add(struct ::wl_client *client, int id, int version) - { - Resource *resource = bind(client, id, version); - m_resource_map.insert(client, resource); - return resource; - } - - void xdg_popup_v5::init(struct ::wl_display *display, int version) - { - m_global = wl_global_create(display, &::xdg_popup_v5_interface, version, this, bind_func); - m_globalVersion = version; - m_displayDestroyedListener.notify = xdg_popup_v5::display_destroy_func; - m_displayDestroyedListener.parent = this; - wl_display_add_destroy_listener(display, &m_displayDestroyedListener); - } - - const struct wl_interface *xdg_popup_v5::interface() - { - return &::xdg_popup_v5_interface; - } - - xdg_popup_v5::Resource *xdg_popup_v5::xdg_popup_allocate() - { - return new Resource; - } - - void xdg_popup_v5::xdg_popup_bind_resource(Resource *) - { - } - - void xdg_popup_v5::xdg_popup_destroy_resource(Resource *) - { - } - - void xdg_popup_v5::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id) - { - xdg_popup_v5 *that = static_cast<xdg_popup_v5 *>(data); - that->add(client, id, qMin(that->m_globalVersion, version)); - } - - void xdg_popup_v5::display_destroy_func(struct ::wl_listener *listener, void *data) - { - Q_UNUSED(data); - xdg_popup_v5 *that = static_cast<xdg_popup_v5::DisplayDestroyedListener *>(listener)->parent; - that->m_global = nullptr; - } - - void xdg_popup_v5::destroy_func(struct ::wl_resource *client_resource) - { - Resource *resource = Resource::fromResource(client_resource); - xdg_popup_v5 *that = resource->xdg_popup_object; - that->m_resource_map.remove(resource->client(), resource); - that->xdg_popup_destroy_resource(resource); - delete resource; - } - - xdg_popup_v5::Resource *xdg_popup_v5::bind(struct ::wl_client *client, uint32_t id, int version) - { - Q_ASSERT_X(!wl_client_get_object(client, id), "QWaylandObject bind", QStringLiteral("binding to object %1 more than once").arg(id).toLocal8Bit().constData()); - struct ::wl_resource *handle = wl_resource_create(client, &::xdg_popup_v5_interface, version, id); - return bind(handle); - } - - xdg_popup_v5::Resource *xdg_popup_v5::bind(struct ::wl_resource *handle) - { - Resource *resource = xdg_popup_allocate(); - resource->xdg_popup_object = this; - - wl_resource_set_implementation(handle, &m_xdg_popup_interface, resource, destroy_func); - resource->handle = handle; - xdg_popup_bind_resource(resource); - return resource; - } - xdg_popup_v5::Resource *xdg_popup_v5::Resource::fromResource(struct ::wl_resource *resource) - { - if (wl_resource_instance_of(resource, &::xdg_popup_v5_interface, &m_xdg_popup_interface)) - return static_cast<Resource *>(resource->data); - return nullptr; - } - - const struct ::xdg_popup_v5_interface xdg_popup_v5::m_xdg_popup_interface = { - xdg_popup_v5::handle_destroy - }; - - void xdg_popup_v5::xdg_popup_destroy(Resource *) - { - } - - - void xdg_popup_v5::handle_destroy( - ::wl_client *client, - struct wl_resource *resource) - { - Q_UNUSED(client); - Resource *r = Resource::fromResource(resource); - static_cast<xdg_popup_v5 *>(r->xdg_popup_object)->xdg_popup_destroy( - r); - } - - void xdg_popup_v5::send_popup_done() - { - send_popup_done( - m_resource->handle); - } - - void xdg_popup_v5::send_popup_done(struct ::wl_resource *resource) - { - xdg_popup_send_popup_done( - resource); - } - -} - -QT_WARNING_POP -QT_END_NAMESPACE diff --git a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h b/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h deleted file mode 100644 index 8124860b..00000000 --- a/src/compositor/extensions/pregenerated/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Copyright © 2008-2013 Kristian Høgsberg - * Copyright © 2013 Rafael Antognolli - * Copyright © 2013 Jasper St. Pierre - * Copyright © 2010-2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef QT_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5 -#define QT_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5 - -#include "wayland-server.h" -#include <QtWaylandCompositor/private/wayland-xdg-shell-unstable-v5-server-protocol_p.h> -#include <QByteArray> -#include <QMultiMap> -#include <QString> - -#ifndef WAYLAND_VERSION_CHECK -#define WAYLAND_VERSION_CHECK(major, minor, micro) \ - ((WAYLAND_VERSION_MAJOR > (major)) || \ - (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR > (minor)) || \ - (WAYLAND_VERSION_MAJOR == (major) && WAYLAND_VERSION_MINOR == (minor) && WAYLAND_VERSION_MICRO >= (micro))) -#endif - -QT_BEGIN_NAMESPACE -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers") -QT_WARNING_DISABLE_CLANG("-Wmissing-field-initializers") - -#if !defined(Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT) -# if defined(QT_SHARED) -# define Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT Q_DECL_EXPORT -# else -# define Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT -# endif -#endif - -namespace QtWaylandServer { - class Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT xdg_shell_v5 - { - public: - xdg_shell_v5(struct ::wl_client *client, int id, int version); - xdg_shell_v5(struct ::wl_display *display, int version); - xdg_shell_v5(struct ::wl_resource *resource); - xdg_shell_v5(); - - virtual ~xdg_shell_v5(); - - class Resource - { - public: - Resource() : xdg_shell_object(nullptr), handle(nullptr) {} - virtual ~Resource() {} - - xdg_shell_v5 *xdg_shell_object; - xdg_shell_v5 *object() { return xdg_shell_object; } - struct ::wl_resource *handle; - - struct ::wl_client *client() const { return wl_resource_get_client(handle); } - int version() const { return wl_resource_get_version(handle); } - - static Resource *fromResource(struct ::wl_resource *resource); - }; - - void init(struct ::wl_client *client, int id, int version); - void init(struct ::wl_display *display, int version); - void init(struct ::wl_resource *resource); - - Resource *add(struct ::wl_client *client, int version); - Resource *add(struct ::wl_client *client, int id, int version); - Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); - - Resource *resource() { return m_resource; } - const Resource *resource() const { return m_resource; } - - QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; } - const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; } - - bool isGlobal() const { return m_global != nullptr; } - bool isResource() const { return m_resource != nullptr; } - - static const struct ::wl_interface *interface(); - static QByteArray interfaceName() { return interface()->name; } - static int interfaceVersion() { return interface()->version; } - - - enum version { - version_current = 5 // Always the latest version - }; - - enum error { - error_role = 0, // given wl_surface has another role - error_defunct_surfaces = 1, // xdg_shell was destroyed before children - error_not_the_topmost_popup = 2, // the client tried to map or destroy a non-topmost popup - error_invalid_popup_parent = 3 // the client specified an invalid popup parent surface - }; - - void send_ping(uint32_t serial); - void send_ping(struct ::wl_resource *resource, uint32_t serial); - - protected: - virtual Resource *xdg_shell_allocate(); - - virtual void xdg_shell_bind_resource(Resource *resource); - virtual void xdg_shell_destroy_resource(Resource *resource); - - virtual void xdg_shell_destroy(Resource *resource); - virtual void xdg_shell_use_unstable_version(Resource *resource, int32_t version); - virtual void xdg_shell_get_xdg_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface); - virtual void xdg_shell_get_xdg_popup(Resource *resource, uint32_t id, struct ::wl_resource *surface, struct ::wl_resource *parent, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y); - virtual void xdg_shell_pong(Resource *resource, uint32_t serial); - - private: - static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); - static void destroy_func(struct ::wl_resource *client_resource); - static void display_destroy_func(struct ::wl_listener *listener, void *data); - - Resource *bind(struct ::wl_client *client, uint32_t id, int version); - Resource *bind(struct ::wl_resource *handle); - - static const struct ::xdg_shell_v5_interface m_xdg_shell_interface; - - static void handle_destroy( - ::wl_client *client, - struct wl_resource *resource); - static void handle_use_unstable_version( - ::wl_client *client, - struct wl_resource *resource, - int32_t version); - static void handle_get_xdg_surface( - ::wl_client *client, - struct wl_resource *resource, - uint32_t id, - struct ::wl_resource *surface); - static void handle_get_xdg_popup( - ::wl_client *client, - struct wl_resource *resource, - uint32_t id, - struct ::wl_resource *surface, - struct ::wl_resource *parent, - struct ::wl_resource *seat, - uint32_t serial, - int32_t x, - int32_t y); - static void handle_pong( - ::wl_client *client, - struct wl_resource *resource, - uint32_t serial); - - QMultiMap<struct ::wl_client*, Resource*> m_resource_map; - Resource *m_resource; - struct ::wl_global *m_global; - uint32_t m_globalVersion; - struct DisplayDestroyedListener : ::wl_listener { - xdg_shell_v5 *parent; - }; - DisplayDestroyedListener m_displayDestroyedListener; - }; - - class Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT xdg_surface_v5 - { - public: - xdg_surface_v5(struct ::wl_client *client, int id, int version); - xdg_surface_v5(struct ::wl_display *display, int version); - xdg_surface_v5(struct ::wl_resource *resource); - xdg_surface_v5(); - - virtual ~xdg_surface_v5(); - - class Resource - { - public: - Resource() : xdg_surface_object(nullptr), handle(nullptr) {} - virtual ~Resource() {} - - xdg_surface_v5 *xdg_surface_object; - xdg_surface_v5 *object() { return xdg_surface_object; } - struct ::wl_resource *handle; - - struct ::wl_client *client() const { return wl_resource_get_client(handle); } - int version() const { return wl_resource_get_version(handle); } - - static Resource *fromResource(struct ::wl_resource *resource); - }; - - void init(struct ::wl_client *client, int id, int version); - void init(struct ::wl_display *display, int version); - void init(struct ::wl_resource *resource); - - Resource *add(struct ::wl_client *client, int version); - Resource *add(struct ::wl_client *client, int id, int version); - Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); - - Resource *resource() { return m_resource; } - const Resource *resource() const { return m_resource; } - - QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; } - const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; } - - bool isGlobal() const { return m_global != nullptr; } - bool isResource() const { return m_resource != nullptr; } - - static const struct ::wl_interface *interface(); - static QByteArray interfaceName() { return interface()->name; } - static int interfaceVersion() { return interface()->version; } - - - enum resize_edge { - resize_edge_none = 0, - resize_edge_top = 1, - resize_edge_bottom = 2, - resize_edge_left = 4, - resize_edge_top_left = 5, - resize_edge_bottom_left = 6, - resize_edge_right = 8, - resize_edge_top_right = 9, - resize_edge_bottom_right = 10 - }; - - enum state { - state_maximized = 1, // the surface is maximized - state_fullscreen = 2, // the surface is fullscreen - state_resizing = 3, - state_activated = 4 - }; - - void send_configure(int32_t width, int32_t height, const QByteArray &states, uint32_t serial); - void send_configure(struct ::wl_resource *resource, int32_t width, int32_t height, const QByteArray &states, uint32_t serial); - void send_close(); - void send_close(struct ::wl_resource *resource); - - protected: - virtual Resource *xdg_surface_allocate(); - - virtual void xdg_surface_bind_resource(Resource *resource); - virtual void xdg_surface_destroy_resource(Resource *resource); - - virtual void xdg_surface_destroy(Resource *resource); - virtual void xdg_surface_set_parent(Resource *resource, struct ::wl_resource *parent); - virtual void xdg_surface_set_title(Resource *resource, const QString &title); - virtual void xdg_surface_set_app_id(Resource *resource, const QString &app_id); - virtual void xdg_surface_show_window_menu(Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y); - virtual void xdg_surface_move(Resource *resource, struct ::wl_resource *seat, uint32_t serial); - virtual void xdg_surface_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges); - virtual void xdg_surface_ack_configure(Resource *resource, uint32_t serial); - virtual void xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); - virtual void xdg_surface_set_maximized(Resource *resource); - virtual void xdg_surface_unset_maximized(Resource *resource); - virtual void xdg_surface_set_fullscreen(Resource *resource, struct ::wl_resource *output); - virtual void xdg_surface_unset_fullscreen(Resource *resource); - virtual void xdg_surface_set_minimized(Resource *resource); - - private: - static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); - static void destroy_func(struct ::wl_resource *client_resource); - static void display_destroy_func(struct ::wl_listener *listener, void *data); - - Resource *bind(struct ::wl_client *client, uint32_t id, int version); - Resource *bind(struct ::wl_resource *handle); - - static const struct ::xdg_surface_v5_interface m_xdg_surface_interface; - - static void handle_destroy( - ::wl_client *client, - struct wl_resource *resource); - static void handle_set_parent( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *parent); - static void handle_set_title( - ::wl_client *client, - struct wl_resource *resource, - const char *title); - static void handle_set_app_id( - ::wl_client *client, - struct wl_resource *resource, - const char *app_id); - static void handle_show_window_menu( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *seat, - uint32_t serial, - int32_t x, - int32_t y); - static void handle_move( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *seat, - uint32_t serial); - static void handle_resize( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *seat, - uint32_t serial, - uint32_t edges); - static void handle_ack_configure( - ::wl_client *client, - struct wl_resource *resource, - uint32_t serial); - static void handle_set_window_geometry( - ::wl_client *client, - struct wl_resource *resource, - int32_t x, - int32_t y, - int32_t width, - int32_t height); - static void handle_set_maximized( - ::wl_client *client, - struct wl_resource *resource); - static void handle_unset_maximized( - ::wl_client *client, - struct wl_resource *resource); - static void handle_set_fullscreen( - ::wl_client *client, - struct wl_resource *resource, - struct ::wl_resource *output); - static void handle_unset_fullscreen( - ::wl_client *client, - struct wl_resource *resource); - static void handle_set_minimized( - ::wl_client *client, - struct wl_resource *resource); - - QMultiMap<struct ::wl_client*, Resource*> m_resource_map; - Resource *m_resource; - struct ::wl_global *m_global; - uint32_t m_globalVersion; - struct DisplayDestroyedListener : ::wl_listener { - xdg_surface_v5 *parent; - }; - DisplayDestroyedListener m_displayDestroyedListener; - }; - - class Q_WAYLAND_SERVER_XDG_SHELL_UNSTABLE_V5_EXPORT xdg_popup_v5 - { - public: - xdg_popup_v5(struct ::wl_client *client, int id, int version); - xdg_popup_v5(struct ::wl_display *display, int version); - xdg_popup_v5(struct ::wl_resource *resource); - xdg_popup_v5(); - - virtual ~xdg_popup_v5(); - - class Resource - { - public: - Resource() : xdg_popup_object(nullptr), handle(nullptr) {} - virtual ~Resource() {} - - xdg_popup_v5 *xdg_popup_object; - xdg_popup_v5 *object() { return xdg_popup_object; } - struct ::wl_resource *handle; - - struct ::wl_client *client() const { return wl_resource_get_client(handle); } - int version() const { return wl_resource_get_version(handle); } - - static Resource *fromResource(struct ::wl_resource *resource); - }; - - void init(struct ::wl_client *client, int id, int version); - void init(struct ::wl_display *display, int version); - void init(struct ::wl_resource *resource); - - Resource *add(struct ::wl_client *client, int version); - Resource *add(struct ::wl_client *client, int id, int version); - Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version); - - Resource *resource() { return m_resource; } - const Resource *resource() const { return m_resource; } - - QMultiMap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; } - const QMultiMap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; } - - bool isGlobal() const { return m_global != nullptr; } - bool isResource() const { return m_resource != nullptr; } - - static const struct ::wl_interface *interface(); - static QByteArray interfaceName() { return interface()->name; } - static int interfaceVersion() { return interface()->version; } - - - void send_popup_done(); - void send_popup_done(struct ::wl_resource *resource); - - protected: - virtual Resource *xdg_popup_allocate(); - - virtual void xdg_popup_bind_resource(Resource *resource); - virtual void xdg_popup_destroy_resource(Resource *resource); - - virtual void xdg_popup_destroy(Resource *resource); - - private: - static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id); - static void destroy_func(struct ::wl_resource *client_resource); - static void display_destroy_func(struct ::wl_listener *listener, void *data); - - Resource *bind(struct ::wl_client *client, uint32_t id, int version); - Resource *bind(struct ::wl_resource *handle); - - static const struct ::xdg_popup_v5_interface m_xdg_popup_interface; - - static void handle_destroy( - ::wl_client *client, - struct wl_resource *resource); - - QMultiMap<struct ::wl_client*, Resource*> m_resource_map; - Resource *m_resource; - struct ::wl_global *m_global; - uint32_t m_globalVersion; - struct DisplayDestroyedListener : ::wl_listener { - xdg_popup_v5 *parent; - }; - DisplayDestroyedListener m_displayDestroyedListener; - }; -} - -QT_WARNING_POP -QT_END_NAMESPACE - -#endif diff --git a/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c b/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c deleted file mode 100644 index e2781c99..00000000 --- a/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Generated by wayland-scanner 1.15.92 */ -// Hand edited to resolve conflicts with xdg-shell stable - -/* - * Copyright © 2008-2013 Kristian Høgsberg - * Copyright © 2013 Rafael Antognolli - * Copyright © 2013 Jasper St. Pierre - * Copyright © 2010-2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <stdlib.h> -#include <stdint.h> -#include "wayland-util.h" - -extern const struct wl_interface wl_output_interface; -extern const struct wl_interface wl_seat_interface; -extern const struct wl_interface wl_surface_interface; -extern const struct wl_interface xdg_popup_v5_interface; -extern const struct wl_interface xdg_surface_v5_interface; - -static const struct wl_interface *types[] = { - NULL, - NULL, - NULL, - NULL, - &xdg_surface_v5_interface, - &wl_surface_interface, - &xdg_popup_v5_interface, - &wl_surface_interface, - &wl_surface_interface, - &wl_seat_interface, - NULL, - NULL, - NULL, - &xdg_surface_v5_interface, - &wl_seat_interface, - NULL, - NULL, - NULL, - &wl_seat_interface, - NULL, - &wl_seat_interface, - NULL, - NULL, - &wl_output_interface, -}; - -static const struct wl_message xdg_shell_requests[] = { - { "destroy", "", types + 0 }, - { "use_unstable_version", "i", types + 0 }, - { "get_xdg_surface", "no", types + 4 }, - { "get_xdg_popup", "nooouii", types + 6 }, - { "pong", "u", types + 0 }, -}; - -static const struct wl_message xdg_shell_events[] = { - { "ping", "u", types + 0 }, -}; - -WL_EXPORT const struct wl_interface xdg_shell_v5_interface = { - "xdg_shell", 1, - 5, xdg_shell_requests, - 1, xdg_shell_events, -}; - -static const struct wl_message xdg_surface_requests[] = { - { "destroy", "", types + 0 }, - { "set_parent", "?o", types + 13 }, - { "set_title", "s", types + 0 }, - { "set_app_id", "s", types + 0 }, - { "show_window_menu", "ouii", types + 14 }, - { "move", "ou", types + 18 }, - { "resize", "ouu", types + 20 }, - { "ack_configure", "u", types + 0 }, - { "set_window_geometry", "iiii", types + 0 }, - { "set_maximized", "", types + 0 }, - { "unset_maximized", "", types + 0 }, - { "set_fullscreen", "?o", types + 23 }, - { "unset_fullscreen", "", types + 0 }, - { "set_minimized", "", types + 0 }, -}; - -static const struct wl_message xdg_surface_events[] = { - { "configure", "iiau", types + 0 }, - { "close", "", types + 0 }, -}; - -WL_EXPORT const struct wl_interface xdg_surface_v5_interface = { - "xdg_surface", 1, - 14, xdg_surface_requests, - 2, xdg_surface_events, -}; - -static const struct wl_message xdg_popup_requests[] = { - { "destroy", "", types + 0 }, -}; - -static const struct wl_message xdg_popup_events[] = { - { "popup_done", "", types + 0 }, -}; - -WL_EXPORT const struct wl_interface xdg_popup_v5_interface = { - "xdg_popup", 1, - 1, xdg_popup_requests, - 1, xdg_popup_events, -}; - diff --git a/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h b/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h deleted file mode 100644 index 493fd52d..00000000 --- a/src/compositor/extensions/pregenerated/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h +++ /dev/null @@ -1,905 +0,0 @@ -/* Generated by wayland-scanner 1.15.92 */ -// Hand edited to resolve conflicts with xdg-shell stable - -#ifndef XDG_SHELL_UNSTABLE_V5_SERVER_PROTOCOL_H -#define XDG_SHELL_UNSTABLE_V5_SERVER_PROTOCOL_H - -#include <stdint.h> -#include <stddef.h> -#include "wayland-server-core.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct wl_client; -struct wl_resource; - -/** - * @page page_xdg_shell_unstable_v5 The xdg_shell_unstable_v5 protocol - * @section page_ifaces_xdg_shell_unstable_v5 Interfaces - * - @subpage page_iface_xdg_shell - create desktop-style surfaces - * - @subpage page_iface_xdg_surface - A desktop window - * - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus - * @section page_copyright_xdg_shell_unstable_v5 Copyright - * <pre> - * - * Copyright © 2008-2013 Kristian Høgsberg - * Copyright © 2013 Rafael Antognolli - * Copyright © 2013 Jasper St. Pierre - * Copyright © 2010-2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * </pre> - */ -struct wl_output; -struct wl_seat; -struct wl_surface; -struct xdg_popup; -struct xdg_shell; -struct xdg_surface; - -/** - * @page page_iface_xdg_shell xdg_shell - * @section page_iface_xdg_shell_desc Description - * - * xdg_shell allows clients to turn a wl_surface into a "real window" - * which can be dragged, resized, stacked, and moved around by the - * user. Everything about this interface is suited towards traditional - * desktop environments. - * @section page_iface_xdg_shell_api API - * See @ref iface_xdg_shell. - */ -/** - * @defgroup iface_xdg_shell The xdg_shell interface - * - * xdg_shell allows clients to turn a wl_surface into a "real window" - * which can be dragged, resized, stacked, and moved around by the - * user. Everything about this interface is suited towards traditional - * desktop environments. - */ -extern const struct wl_interface xdg_shell_v5_interface; -/** - * @page page_iface_xdg_surface xdg_surface - * @section page_iface_xdg_surface_desc Description - * - * An interface that may be implemented by a wl_surface, for - * implementations that provide a desktop-style user interface. - * - * It provides requests to treat surfaces like windows, allowing to set - * properties like maximized, fullscreen, minimized, and to move and resize - * them, and associate metadata like title and app id. - * - * The client must call wl_surface.commit on the corresponding wl_surface - * for the xdg_surface state to take effect. Prior to committing the new - * state, it can set up initial configuration, such as maximizing or setting - * a window geometry. - * - * Even without attaching a buffer the compositor must respond to initial - * committed configuration, for instance sending a configure event with - * expected window geometry if the client maximized its surface during - * initialization. - * - * For a surface to be mapped by the compositor the client must have - * committed both an xdg_surface state and a buffer. - * @section page_iface_xdg_surface_api API - * See @ref iface_xdg_surface. - */ -/** - * @defgroup iface_xdg_surface The xdg_surface interface - * - * An interface that may be implemented by a wl_surface, for - * implementations that provide a desktop-style user interface. - * - * It provides requests to treat surfaces like windows, allowing to set - * properties like maximized, fullscreen, minimized, and to move and resize - * them, and associate metadata like title and app id. - * - * The client must call wl_surface.commit on the corresponding wl_surface - * for the xdg_surface state to take effect. Prior to committing the new - * state, it can set up initial configuration, such as maximizing or setting - * a window geometry. - * - * Even without attaching a buffer the compositor must respond to initial - * committed configuration, for instance sending a configure event with - * expected window geometry if the client maximized its surface during - * initialization. - * - * For a surface to be mapped by the compositor the client must have - * committed both an xdg_surface state and a buffer. - */ -extern const struct wl_interface xdg_surface_v5_interface; -/** - * @page page_iface_xdg_popup xdg_popup - * @section page_iface_xdg_popup_desc Description - * - * A popup surface is a short-lived, temporary surface that can be - * used to implement menus. It takes an explicit grab on the surface - * that will be dismissed when the user dismisses the popup. This can - * be done by the user clicking outside the surface, using the keyboard, - * or even locking the screen through closing the lid or a timeout. - * - * When the popup is dismissed, a popup_done event will be sent out, - * and at the same time the surface will be unmapped. The xdg_popup - * object is now inert and cannot be reactivated, so clients should - * destroy it. Explicitly destroying the xdg_popup object will also - * dismiss the popup and unmap the surface. - * - * Clients will receive events for all their surfaces during this - * grab (which is an "owner-events" grab in X11 parlance). This is - * done so that users can navigate through submenus and other - * "nested" popup windows without having to dismiss the topmost - * popup. - * - * Clients that want to dismiss the popup when another surface of - * their own is clicked should dismiss the popup using the destroy - * request. - * - * The parent surface must have either an xdg_surface or xdg_popup - * role. - * - * Specifying an xdg_popup for the parent means that the popups are - * nested, with this popup now being the topmost popup. Nested - * popups must be destroyed in the reverse order they were created - * in, e.g. the only popup you are allowed to destroy at all times - * is the topmost one. - * - * If there is an existing popup when creating a new popup, the - * parent must be the current topmost popup. - * - * A parent surface must be mapped before the new popup is mapped. - * - * When compositors choose to dismiss a popup, they will likely - * dismiss every nested popup as well. When a compositor dismisses - * popups, it will follow the same dismissing order as required - * from the client. - * - * The x and y arguments passed when creating the popup object specify - * where the top left of the popup should be placed, relative to the - * local surface coordinates of the parent surface. See - * xdg_shell.get_xdg_popup. - * - * The client must call wl_surface.commit on the corresponding wl_surface - * for the xdg_popup state to take effect. - * - * For a surface to be mapped by the compositor the client must have - * committed both the xdg_popup state and a buffer. - * @section page_iface_xdg_popup_api API - * See @ref iface_xdg_popup. - */ -/** - * @defgroup iface_xdg_popup The xdg_popup interface - * - * A popup surface is a short-lived, temporary surface that can be - * used to implement menus. It takes an explicit grab on the surface - * that will be dismissed when the user dismisses the popup. This can - * be done by the user clicking outside the surface, using the keyboard, - * or even locking the screen through closing the lid or a timeout. - * - * When the popup is dismissed, a popup_done event will be sent out, - * and at the same time the surface will be unmapped. The xdg_popup - * object is now inert and cannot be reactivated, so clients should - * destroy it. Explicitly destroying the xdg_popup object will also - * dismiss the popup and unmap the surface. - * - * Clients will receive events for all their surfaces during this - * grab (which is an "owner-events" grab in X11 parlance). This is - * done so that users can navigate through submenus and other - * "nested" popup windows without having to dismiss the topmost - * popup. - * - * Clients that want to dismiss the popup when another surface of - * their own is clicked should dismiss the popup using the destroy - * request. - * - * The parent surface must have either an xdg_surface or xdg_popup - * role. - * - * Specifying an xdg_popup for the parent means that the popups are - * nested, with this popup now being the topmost popup. Nested - * popups must be destroyed in the reverse order they were created - * in, e.g. the only popup you are allowed to destroy at all times - * is the topmost one. - * - * If there is an existing popup when creating a new popup, the - * parent must be the current topmost popup. - * - * A parent surface must be mapped before the new popup is mapped. - * - * When compositors choose to dismiss a popup, they will likely - * dismiss every nested popup as well. When a compositor dismisses - * popups, it will follow the same dismissing order as required - * from the client. - * - * The x and y arguments passed when creating the popup object specify - * where the top left of the popup should be placed, relative to the - * local surface coordinates of the parent surface. See - * xdg_shell.get_xdg_popup. - * - * The client must call wl_surface.commit on the corresponding wl_surface - * for the xdg_popup state to take effect. - * - * For a surface to be mapped by the compositor the client must have - * committed both the xdg_popup state and a buffer. - */ -extern const struct wl_interface xdg_popup_v5_interface; - -#ifndef XDG_SHELL_VERSION_ENUM -#define XDG_SHELL_VERSION_ENUM -/** - * @ingroup iface_xdg_shell - * latest protocol version - * - * The 'current' member of this enum gives the version of the - * protocol. Implementations can compare this to the version - * they implement using static_assert to ensure the protocol and - * implementation versions match. - */ -enum xdg_shell_version { - /** - * Always the latest version - */ - XDG_SHELL_VERSION_CURRENT = 5, -}; -#endif /* XDG_SHELL_VERSION_ENUM */ - -#ifndef XDG_SHELL_ERROR_ENUM -#define XDG_SHELL_ERROR_ENUM -enum xdg_shell_error { - /** - * given wl_surface has another role - */ - XDG_SHELL_ERROR_ROLE = 0, - /** - * xdg_shell was destroyed before children - */ - XDG_SHELL_ERROR_DEFUNCT_SURFACES = 1, - /** - * the client tried to map or destroy a non-topmost popup - */ - XDG_SHELL_ERROR_NOT_THE_TOPMOST_POPUP = 2, - /** - * the client specified an invalid popup parent surface - */ - XDG_SHELL_ERROR_INVALID_POPUP_PARENT = 3, -}; -#endif /* XDG_SHELL_ERROR_ENUM */ - -/** - * @ingroup iface_xdg_shell - * @struct xdg_shell_v5_interface - */ -struct xdg_shell_v5_interface { - /** - * destroy xdg_shell - * - * Destroy this xdg_shell object. - * - * Destroying a bound xdg_shell object while there are surfaces - * still alive created by this xdg_shell object instance is illegal - * and will result in a protocol error. - */ - void (*destroy)(struct wl_client *client, - struct wl_resource *resource); - /** - * enable use of this unstable version - * - * Negotiate the unstable version of the interface. This - * mechanism is in place to ensure client and server agree on the - * unstable versions of the protocol that they speak or exit - * cleanly if they don't agree. This request will go away once the - * xdg-shell protocol is stable. - */ - void (*use_unstable_version)(struct wl_client *client, - struct wl_resource *resource, - int32_t version); - /** - * create a shell surface from a surface - * - * This creates an xdg_surface for the given surface and gives it - * the xdg_surface role. A wl_surface can only be given an - * xdg_surface role once. If get_xdg_surface is called with a - * wl_surface that already has an active xdg_surface associated - * with it, or if it had any other role, an error is raised. - * - * See the documentation of xdg_surface for more details about what - * an xdg_surface is and how it is used. - */ - void (*get_xdg_surface)(struct wl_client *client, - struct wl_resource *resource, - uint32_t id, - struct wl_resource *surface); - /** - * create a popup for a surface - * - * This creates an xdg_popup for the given surface and gives it - * the xdg_popup role. A wl_surface can only be given an xdg_popup - * role once. If get_xdg_popup is called with a wl_surface that - * already has an active xdg_popup associated with it, or if it had - * any other role, an error is raised. - * - * This request must be used in response to some sort of user - * action like a button press, key press, or touch down event. - * - * See the documentation of xdg_popup for more details about what - * an xdg_popup is and how it is used. - * @param seat the wl_seat of the user event - * @param serial the serial of the user event - */ - void (*get_xdg_popup)(struct wl_client *client, - struct wl_resource *resource, - uint32_t id, - struct wl_resource *surface, - struct wl_resource *parent, - struct wl_resource *seat, - uint32_t serial, - int32_t x, - int32_t y); - /** - * respond to a ping event - * - * A client must respond to a ping event with a pong request or - * the client may be deemed unresponsive. - * @param serial serial of the ping event - */ - void (*pong)(struct wl_client *client, - struct wl_resource *resource, - uint32_t serial); -}; - -#define XDG_SHELL_PING 0 - -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_PING_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_USE_UNSTABLE_VERSION_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_GET_XDG_SURFACE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_GET_XDG_POPUP_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_shell - */ -#define XDG_SHELL_PONG_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_shell - * Sends an ping event to the client owning the resource. - * @param resource_ The client's resource - * @param serial pass this to the pong request - */ -static inline void -xdg_shell_send_ping(struct wl_resource *resource_, uint32_t serial) -{ - wl_resource_post_event(resource_, XDG_SHELL_PING, serial); -} - -#ifndef XDG_SURFACE_RESIZE_EDGE_ENUM -#define XDG_SURFACE_RESIZE_EDGE_ENUM -/** - * @ingroup iface_xdg_surface - * edge values for resizing - * - * These values are used to indicate which edge of a surface - * is being dragged in a resize operation. - */ -enum xdg_surface_resize_edge { - XDG_SURFACE_RESIZE_EDGE_NONE = 0, - XDG_SURFACE_RESIZE_EDGE_TOP = 1, - XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2, - XDG_SURFACE_RESIZE_EDGE_LEFT = 4, - XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5, - XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6, - XDG_SURFACE_RESIZE_EDGE_RIGHT = 8, - XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9, - XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10, -}; -#endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */ - -#ifndef XDG_SURFACE_STATE_ENUM -#define XDG_SURFACE_STATE_ENUM -/** - * @ingroup iface_xdg_surface - * types of state on the surface - * - * The different state values used on the surface. This is designed for - * state values like maximized, fullscreen. It is paired with the - * configure event to ensure that both the client and the compositor - * setting the state can be synchronized. - * - * States set in this way are double-buffered. They will get applied on - * the next commit. - * - * Desktop environments may extend this enum by taking up a range of - * values and documenting the range they chose in this description. - * They are not required to document the values for the range that they - * chose. Ideally, any good extensions from a desktop environment should - * make its way into standardization into this enum. - * - * The current reserved ranges are: - * - * 0x0000 - 0x0FFF: xdg-shell core values, documented below. - * 0x1000 - 0x1FFF: GNOME - */ -enum xdg_surface_state { - /** - * the surface is maximized - */ - XDG_SURFACE_STATE_MAXIMIZED = 1, - /** - * the surface is fullscreen - */ - XDG_SURFACE_STATE_FULLSCREEN = 2, - XDG_SURFACE_STATE_RESIZING = 3, - XDG_SURFACE_STATE_ACTIVATED = 4, -}; -#endif /* XDG_SURFACE_STATE_ENUM */ - -/** - * @ingroup iface_xdg_surface - * @struct xdg_surface_v5_interface - */ -struct xdg_surface_v5_interface { - /** - * Destroy the xdg_surface - * - * Unmap and destroy the window. The window will be effectively - * hidden from the user's point of view, and all state like - * maximization, fullscreen, and so on, will be lost. - */ - void (*destroy)(struct wl_client *client, - struct wl_resource *resource); - /** - * set the parent of this surface - * - * Set the "parent" of this surface. This window should be - * stacked above a parent. The parent surface must be mapped as - * long as this surface is mapped. - * - * Parent windows should be set on dialogs, toolboxes, or other - * "auxiliary" surfaces, so that the parent is raised when the - * dialog is raised. - */ - void (*set_parent)(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *parent); - /** - * set surface title - * - * Set a short title for the surface. - * - * This string may be used to identify the surface in a task bar, - * window list, or other user interface elements provided by the - * compositor. - * - * The string must be encoded in UTF-8. - */ - void (*set_title)(struct wl_client *client, - struct wl_resource *resource, - const char *title); - /** - * set application ID - * - * Set an application identifier for the surface. - * - * The app ID identifies the general class of applications to which - * the surface belongs. The compositor can use this to group - * multiple surfaces together, or to determine how to launch a new - * application. - * - * For D-Bus activatable applications, the app ID is used as the - * D-Bus service name. - * - * The compositor shell will try to group application surfaces - * together by their app ID. As a best practice, it is suggested to - * select app ID's that match the basename of the application's - * .desktop file. For example, "org.freedesktop.FooViewer" where - * the .desktop file is "org.freedesktop.FooViewer.desktop". - * - * See the desktop-entry specification [0] for more details on - * application identifiers and how they relate to well-known D-Bus - * names and .desktop files. - * - * [0] http://standards.freedesktop.org/desktop-entry-spec/ - */ - void (*set_app_id)(struct wl_client *client, - struct wl_resource *resource, - const char *app_id); - /** - * show the window menu - * - * Clients implementing client-side decorations might want to - * show a context menu when right-clicking on the decorations, - * giving the user a menu that they can use to maximize or minimize - * the window. - * - * This request asks the compositor to pop up such a window menu at - * the given position, relative to the local surface coordinates of - * the parent surface. There are no guarantees as to what menu - * items the window menu contains. - * - * This request must be used in response to some sort of user - * action like a button press, key press, or touch down event. - * @param seat the wl_seat of the user event - * @param serial the serial of the user event - * @param x the x position to pop up the window menu at - * @param y the y position to pop up the window menu at - */ - void (*show_window_menu)(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *seat, - uint32_t serial, - int32_t x, - int32_t y); - /** - * start an interactive move - * - * Start an interactive, user-driven move of the surface. - * - * This request must be used in response to some sort of user - * action like a button press, key press, or touch down event. The - * passed serial is used to determine the type of interactive move - * (touch, pointer, etc). - * - * The server may ignore move requests depending on the state of - * the surface (e.g. fullscreen or maximized), or if the passed - * serial is no longer valid. - * - * If triggered, the surface will lose the focus of the device - * (wl_pointer, wl_touch, etc) used for the move. It is up to the - * compositor to visually indicate that the move is taking place, - * such as updating a pointer cursor, during the move. There is no - * guarantee that the device focus will return when the move is - * completed. - * @param seat the wl_seat of the user event - * @param serial the serial of the user event - */ - void (*move)(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *seat, - uint32_t serial); - /** - * start an interactive resize - * - * Start a user-driven, interactive resize of the surface. - * - * This request must be used in response to some sort of user - * action like a button press, key press, or touch down event. The - * passed serial is used to determine the type of interactive - * resize (touch, pointer, etc). - * - * The server may ignore resize requests depending on the state of - * the surface (e.g. fullscreen or maximized). - * - * If triggered, the client will receive configure events with the - * "resize" state enum value and the expected sizes. See the - * "resize" enum value for more details about what is required. The - * client must also acknowledge configure events using - * "ack_configure". After the resize is completed, the client will - * receive another "configure" event without the resize state. - * - * If triggered, the surface also will lose the focus of the device - * (wl_pointer, wl_touch, etc) used for the resize. It is up to the - * compositor to visually indicate that the resize is taking place, - * such as updating a pointer cursor, during the resize. There is - * no guarantee that the device focus will return when the resize - * is completed. - * - * The edges parameter specifies how the surface should be resized, - * and is one of the values of the resize_edge enum. The compositor - * may use this information to update the surface position for - * example when dragging the top left corner. The compositor may - * also use this information to adapt its behavior, e.g. choose an - * appropriate cursor image. - * @param seat the wl_seat of the user event - * @param serial the serial of the user event - * @param edges which edge or corner is being dragged - */ - void (*resize)(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *seat, - uint32_t serial, - uint32_t edges); - /** - * ack a configure event - * - * When a configure event is received, if a client commits the - * surface in response to the configure event, then the client must - * make a ack_configure request before the commit request, passing - * along the serial of the configure event. - * - * For instance, the compositor might use this information to move - * a surface to the top left only when the client has drawn itself - * for the maximized or fullscreen state. - * - * If the client receives multiple configure events before it can - * respond to one, it only has to ack the last configure event. - * @param serial the serial from the configure event - */ - void (*ack_configure)(struct wl_client *client, - struct wl_resource *resource, - uint32_t serial); - /** - * set the new window geometry - * - * The window geometry of a window is its "visible bounds" from - * the user's perspective. Client-side decorations often have - * invisible portions like drop-shadows which should be ignored for - * the purposes of aligning, placing and constraining windows. - * - * The window geometry is double buffered, and will be applied at - * the time wl_surface.commit of the corresponding wl_surface is - * called. - * - * Once the window geometry of the surface is set once, it is not - * possible to unset it, and it will remain the same until - * set_window_geometry is called again, even if a new subsurface or - * buffer is attached. - * - * If never set, the value is the full bounds of the surface, - * including any subsurfaces. This updates dynamically on every - * commit. This unset mode is meant for extremely simple clients. - * - * If responding to a configure event, the window geometry in here - * must respect the sizing negotiations specified by the states in - * the configure event. - * - * The arguments are given in the surface local coordinate space of - * the wl_surface associated with this xdg_surface. - * - * The width and height must be greater than zero. - */ - void (*set_window_geometry)(struct wl_client *client, - struct wl_resource *resource, - int32_t x, - int32_t y, - int32_t width, - int32_t height); - /** - * maximize the window - * - * Maximize the surface. - * - * After requesting that the surface should be maximized, the - * compositor will respond by emitting a configure event with the - * "maximized" state and the required window geometry. The client - * should then update its content, drawing it in a maximized state, - * i.e. without shadow or other decoration outside of the window - * geometry. The client must also acknowledge the configure when - * committing the new content (see ack_configure). - * - * It is up to the compositor to decide how and where to maximize - * the surface, for example which output and what region of the - * screen should be used. - * - * If the surface was already maximized, the compositor will still - * emit a configure event with the "maximized" state. - */ - void (*set_maximized)(struct wl_client *client, - struct wl_resource *resource); - /** - * unmaximize the window - * - * Unmaximize the surface. - * - * After requesting that the surface should be unmaximized, the - * compositor will respond by emitting a configure event without - * the "maximized" state. If available, the compositor will include - * the window geometry dimensions the window had prior to being - * maximized in the configure request. The client must then update - * its content, drawing it in a regular state, i.e. potentially - * with shadow, etc. The client must also acknowledge the configure - * when committing the new content (see ack_configure). - * - * It is up to the compositor to position the surface after it was - * unmaximized; usually the position the surface had before - * maximizing, if applicable. - * - * If the surface was already not maximized, the compositor will - * still emit a configure event without the "maximized" state. - */ - void (*unset_maximized)(struct wl_client *client, - struct wl_resource *resource); - /** - * set the window as fullscreen on a monitor - * - * Make the surface fullscreen. - * - * You can specify an output that you would prefer to be - * fullscreen. If this value is NULL, it's up to the compositor to - * choose which display will be used to map this surface. - * - * If the surface doesn't cover the whole output, the compositor - * will position the surface in the center of the output and - * compensate with black borders filling the rest of the output. - */ - void (*set_fullscreen)(struct wl_client *client, - struct wl_resource *resource, - struct wl_resource *output); - /** - */ - void (*unset_fullscreen)(struct wl_client *client, - struct wl_resource *resource); - /** - * set the window as minimized - * - * Request that the compositor minimize your surface. There is no - * way to know if the surface is currently minimized, nor is there - * any way to unset minimization on this surface. - * - * If you are looking to throttle redrawing when minimized, please - * instead use the wl_surface.frame event for this, as this will - * also work with live previews on windows in Alt-Tab, Expose or - * similar compositor features. - */ - void (*set_minimized)(struct wl_client *client, - struct wl_resource *resource); -}; - -#define XDG_SURFACE_CONFIGURE 0 -#define XDG_SURFACE_CLOSE 1 - -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_CLOSE_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_DESTROY_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_PARENT_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_TITLE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_APP_ID_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SHOW_WINDOW_MENU_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_MOVE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_RESIZE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_UNSET_MAXIMIZED_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_UNSET_FULLSCREEN_SINCE_VERSION 1 -/** - * @ingroup iface_xdg_surface - */ -#define XDG_SURFACE_SET_MINIMIZED_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_surface - * Sends an configure event to the client owning the resource. - * @param resource_ The client's resource - */ -static inline void -xdg_surface_send_configure(struct wl_resource *resource_, int32_t width, int32_t height, struct wl_array *states, uint32_t serial) -{ - wl_resource_post_event(resource_, XDG_SURFACE_CONFIGURE, width, height, states, serial); -} - -/** - * @ingroup iface_xdg_surface - * Sends an close event to the client owning the resource. - * @param resource_ The client's resource - */ -static inline void -xdg_surface_send_close(struct wl_resource *resource_) -{ - wl_resource_post_event(resource_, XDG_SURFACE_CLOSE); -} - -/** - * @ingroup iface_xdg_popup - * @struct xdg_popup_v5_interface - */ -struct xdg_popup_v5_interface { - /** - * remove xdg_popup interface - * - * This destroys the popup. Explicitly destroying the xdg_popup - * object will also dismiss the popup, and unmap the surface. - * - * If this xdg_popup is not the "topmost" popup, a protocol error - * will be sent. - */ - void (*destroy)(struct wl_client *client, - struct wl_resource *resource); -}; - -#define XDG_POPUP_POPUP_DONE 0 - -/** - * @ingroup iface_xdg_popup - */ -#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_popup - */ -#define XDG_POPUP_DESTROY_SINCE_VERSION 1 - -/** - * @ingroup iface_xdg_popup - * Sends an popup_done event to the client owning the resource. - * @param resource_ The client's resource - */ -static inline void -xdg_popup_send_popup_done(struct wl_resource *resource_) -{ - wl_resource_post_event(resource_, XDG_POPUP_POPUP_DONE); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/compositor/extensions/pregenerated/xdg-shell-v5.pri b/src/compositor/extensions/pregenerated/xdg-shell-v5.pri deleted file mode 100644 index 48d163f1..00000000 --- a/src/compositor/extensions/pregenerated/xdg-shell-v5.pri +++ /dev/null @@ -1,10 +0,0 @@ -# Putting pregenerated files in a 3rdparty directory to avoid -# qtqa's license checking failing. - -HEADERS += \ - $$PWD/3rdparty/qwayland-server-xdg-shell-unstable-v5_p.h \ - $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-server-protocol_p.h - -SOURCES += \ - $$PWD/3rdparty/qwayland-server-xdg-shell-unstable-v5.cpp \ - $$PWD/3rdparty/wayland-xdg-shell-unstable-v5-protocol.c diff --git a/src/compositor/extensions/qwaylandwlscaler.cpp b/src/compositor/extensions/qwaylandwlscaler.cpp deleted file mode 100644 index 5c8e4b27..00000000 --- a/src/compositor/extensions/qwaylandwlscaler.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandwlscaler_p.h" - -#include <QtWaylandCompositor/QWaylandSurface> -#include <QtWaylandCompositor/QWaylandCompositor> - -#include <QtWaylandCompositor/private/qwaylandsurface_p.h> - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \qmltype WlScaler - \inqmlmodule QtWayland.Compositor - \since 5.13 - \brief Provides an extension for surface resizing and cropping. - - The WlScaler extension provides a way for clients to resize and crop surface contents. - - WlScaler corresponds to the Wayland interface, \c wl_scaler. - - \c wl_scaler is a non-standard and deprecated protocol that has largely been replaced by - \c wp_viewporter. I.e. This extensions is only useful for supporting legacy clients. - \c wp_viewporter support is enabled automatically for all Qml compositors. - - To provide the functionality of the extension in a compositor, create an instance of the - WlScaler component and add it to the list of extensions supported by the compositor: - - \qml \QtMinorVersion - import QtWayland.Compositor 1.\1 - - WaylandCompositor { - // ... - WlScaler {} - } - \endqml - - \deprecated -*/ - -/*! - \class QWaylandWlScaler - \inmodule QtWaylandCompositor - \since 5.13 - \brief Provides an extension for surface resizing and croping. - - The QWaylandWlScaler extension provides a way for clients to resize and crop surface - contents. - - QWaylandWlScaler corresponds to the Wayland interface, \c wl_scaler. - - \c wl_scaler is a non-standard and deprecated protocol that has largely been replaced by - \c wp_viewporter. I.e. This extensions is only useful for supporting legacy clients. - - \sa QWaylandViewporter - - \deprecated -*/ - -/*! - Constructs a QWaylandWlScaler object. -*/ -QWaylandWlScaler::QWaylandWlScaler() - : QWaylandCompositorExtensionTemplate<QWaylandWlScaler>(*new QWaylandWlScalerPrivate) -{ -} - -/*! - * Constructs a QWaylandWlScaler object for the provided \a compositor. - */ -QWaylandWlScaler::QWaylandWlScaler(QWaylandCompositor *compositor) - : QWaylandCompositorExtensionTemplate<QWaylandWlScaler>(compositor, *new QWaylandWlScalerPrivate()) -{ -} - -/*! - Initializes the extension. -*/ -void QWaylandWlScaler::initialize() -{ - Q_D(QWaylandWlScaler); - - QWaylandCompositorExtensionTemplate::initialize(); - auto *compositor = static_cast<QWaylandCompositor *>(extensionContainer()); - if (!compositor) { - qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandWlScaler"; - return; - } - d->init(compositor->display(), 2); -} - -/*! - Returns the Wayland interface for the QWaylandWlScaler. -*/ -const wl_interface *QWaylandWlScaler::interface() -{ - return QWaylandWlScalerPrivate::interface(); -} - -void QWaylandWlScalerPrivate::scaler_destroy(Resource *resource) -{ - // Viewport objects are allowed ot outlive the scaler - wl_resource_destroy(resource->handle); -} - -void QWaylandWlScalerPrivate::scaler_get_viewport(Resource *resource, uint id, wl_resource *surfaceResource) -{ - auto *surface = QWaylandSurface::fromResource(surfaceResource); - if (!surface) { - qWarning() << "Couldn't find surface for viewporter"; - return; - } - - // Note: This will only protect us not creating scalers for surfaces with wp_viewport objects - auto *surfacePrivate = QWaylandSurfacePrivate::get(surface); - if (surfacePrivate->viewport) { - wl_resource_post_error(resource->handle, WL_SCALER_ERROR_VIEWPORT_EXISTS, - "viewport already exists for surface"); - return; - } - - // We can't set viewport here, since it's of the new type for wp_viewporter -// surfacePrivate->viewport = new Viewport(surface, resource->client(), id, resource->version()); - new Viewport(surface, resource->client(), id, resource->version()); -} - -QWaylandWlScalerPrivate::Viewport::Viewport(QWaylandSurface *surface, wl_client *client, int id, int version) - : QtWaylandServer::wl_viewport(client, id, version) - , m_surface(surface) -{ - Q_ASSERT(surface); -} - -//TODO: This isn't currently called -// This function has to be called immediately after a surface is committed, before no -// other client events have been dispatched, or we may incorrectly error out on an -// incomplete pending state. See comment below. -void QWaylandWlScalerPrivate::Viewport::checkCommittedState() -{ - auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface); - - // We can't use the current state for destination/source when checking, - // as that has fallbacks to the buffer size so we can't distinguish - // between the set/unset case. We use the pending state because no other - // requests has modified it yet. - QSize destination = surfacePrivate->pending.destinationSize; - QRectF source = surfacePrivate->pending.sourceGeometry; - - if (!destination.isValid() && source.size() != source.size().toSize()) { - //TODO: Do rounding to nearest integer - } - - QRectF max = QRectF(QPointF(), m_surface->bufferSize() / m_surface->bufferScale()); - // We can't use QRectF.contains, because that would return false for values on the border - if (max.united(source) != max) { - //TODO: surface contents are no undefined, surface size is still valid though - qCDebug(qLcWaylandCompositor) << "Source set outside buffer bounds (client error)"; - } -} - - -void QWaylandWlScalerPrivate::Viewport::viewport_destroy_resource(Resource *resource) -{ - Q_UNUSED(resource); - delete this; -} - -void QWaylandWlScalerPrivate::Viewport::viewport_destroy(Resource *resource) -{ - if (m_surface) { - auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface); - surfacePrivate->pending.destinationSize = QSize(); - surfacePrivate->pending.sourceGeometry = QRectF(); - } - wl_resource_destroy(resource->handle); -} - -void QWaylandWlScalerPrivate::Viewport::viewport_set(QtWaylandServer::wl_viewport::Resource *resource, wl_fixed_t src_x, wl_fixed_t src_y, wl_fixed_t src_width, wl_fixed_t src_height, int32_t dst_width, int32_t dst_height) -{ - viewport_set_source(resource, src_x, src_y, src_width, src_height); - viewport_set_destination(resource, dst_width, dst_height); -} - -void QWaylandWlScalerPrivate::Viewport::viewport_set_source(QtWaylandServer::wl_viewport::Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) -{ - Q_UNUSED(resource); - - if (!m_surface) { - qCDebug(qLcWaylandCompositor) << "set_source requested for destroyed surface"; - return; - } - - QPointF position(wl_fixed_to_double(x), wl_fixed_to_double(y)); - QSizeF size(wl_fixed_to_double(width), wl_fixed_to_double(height)); - QRectF sourceGeometry(position, size); - - if (sourceGeometry == QRectF(-1, -1, -1, -1)) { - auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface); - surfacePrivate->pending.sourceGeometry = QRectF(); - return; - } - - if (position.x() < 0 || position.y() < 0) { - wl_resource_post_error(resource->handle, error_bad_value, - "negative position in set_source"); - return; - } - - if (!size.isValid()) { - wl_resource_post_error(resource->handle, error_bad_value, - "negative size in set_source"); - return; - } - - auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface); - surfacePrivate->pending.sourceGeometry = sourceGeometry; -} - -void QWaylandWlScalerPrivate::Viewport::viewport_set_destination(QtWaylandServer::wl_viewport::Resource *resource, int32_t width, int32_t height) -{ - Q_UNUSED(resource); - - if (!m_surface) { - qCDebug(qLcWaylandCompositor) << "set_destination requested for destroyed surface"; - return; - } - - QSize destinationSize(width, height); - if (!destinationSize.isValid() && destinationSize != QSize(-1, -1)) { - wl_resource_post_error(resource->handle, error_bad_value, - "negative size in set_destination"); - return; - } - auto *surfacePrivate = QWaylandSurfacePrivate::get(m_surface); - surfacePrivate->pending.destinationSize = destinationSize; -} -#endif // QT_DEPRECATED_SINCE - -QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandwlscaler.h b/src/compositor/extensions/qwaylandwlscaler.h deleted file mode 100644 index 4ecdf396..00000000 --- a/src/compositor/extensions/qwaylandwlscaler.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDWLSCALER_H -#define QWAYLANDWLSCALER_H - -#include <QtWaylandCompositor/QWaylandCompositorExtension> - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 13) -class QWaylandWlScalerPrivate; - -// TODO: We should have used the QT_DEPRECATED macro here, but for some reason -// header file generation stops working when that's added. -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlScaler - : public QWaylandCompositorExtensionTemplate<QWaylandWlScaler> -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandWlScaler) - -public: - explicit QWaylandWlScaler(); - explicit QWaylandWlScaler(QWaylandCompositor *compositor); - - void initialize() override; - - static const struct wl_interface *interface(); -}; -#endif - -QT_END_NAMESPACE - -#endif // QWAYLANDWLSCALER_H diff --git a/src/compositor/extensions/qwaylandwlscaler_p.h b/src/compositor/extensions/qwaylandwlscaler_p.h deleted file mode 100644 index 10a66f88..00000000 --- a/src/compositor/extensions/qwaylandwlscaler_p.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDWLSCALER_P_H -#define QWAYLANDWLSCALER_P_H - -#include "qwaylandwlscaler.h" - -#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> -#include <QtWaylandCompositor/private/qwayland-server-scaler.h> - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 13) -class QWaylandSurface; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandWlScalerPrivate - : public QWaylandCompositorExtensionPrivate - , public QtWaylandServer::wl_scaler -{ - Q_DECLARE_PUBLIC(QWaylandWlScaler) -public: - explicit QWaylandWlScalerPrivate() = default; - -protected: - void scaler_destroy(Resource *resource) override; - void scaler_get_viewport(Resource *resource, uint32_t id, wl_resource *surface) override; - -private: - class Viewport : public QtWaylandServer::wl_viewport - { - public: - explicit Viewport(QWaylandSurface *surface, wl_client *client, int id, int version); - void checkCommittedState(); - - protected: - void viewport_destroy_resource(Resource *resource) override; - void viewport_destroy(Resource *resource) override; - void viewport_set(Resource *resource, wl_fixed_t src_x, wl_fixed_t src_y, wl_fixed_t src_width, wl_fixed_t src_height, int32_t dst_width, int32_t dst_height) override; - void viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override; - void viewport_set_destination(Resource *resource, int32_t width, int32_t height) override; - - private: - QPointer<QWaylandSurface> m_surface = nullptr; - }; -}; -#endif - -QT_END_NAMESPACE - -#endif // QWAYLANDWLSCALER_P_H diff --git a/src/compositor/extensions/qwaylandxdgshellv5.cpp b/src/compositor/extensions/qwaylandxdgshellv5.cpp deleted file mode 100644 index 6d0d269d..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv5.cpp +++ /dev/null @@ -1,1564 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv5.h" -#include "qwaylandxdgshellv5_p.h" - -#if QT_CONFIG(wayland_compositor_quick) -#include "qwaylandxdgshellv5integration_p.h" -#endif -#include <QtWaylandCompositor/private/qwaylandutils_p.h> - -#include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandSurface> -#include <QtWaylandCompositor/QWaylandSurfaceRole> -#include <QtWaylandCompositor/QWaylandResource> -#include <QtWaylandCompositor/QWaylandSeat> - -#include <QtCore/QObject> - -#include <algorithm> - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -QWaylandSurfaceRole QWaylandXdgSurfaceV5Private::s_role("xdg_surface"); -QWaylandSurfaceRole QWaylandXdgPopupV5Private::s_role("xdg_popup"); - -QWaylandXdgShellV5Private::QWaylandXdgShellV5Private() -{ -} - -void QWaylandXdgShellV5Private::ping(Resource *resource, uint32_t serial) -{ - m_pings.insert(serial); - send_ping(resource->handle, serial); -} - -void QWaylandXdgShellV5Private::registerSurface(QWaylandXdgSurfaceV5 *xdgSurface) -{ - m_xdgSurfaces.insert(xdgSurface->surface()->client()->client(), xdgSurface); -} - -void QWaylandXdgShellV5Private::unregisterXdgSurface(QWaylandXdgSurfaceV5 *xdgSurface) -{ - auto xdgSurfacePrivate = QWaylandXdgSurfaceV5Private::get(xdgSurface); - if (!m_xdgSurfaces.remove(xdgSurfacePrivate->resource()->client(), xdgSurface)) - qWarning("%s Unexpected state. Can't find registered xdg surface\n", Q_FUNC_INFO); -} - -void QWaylandXdgShellV5Private::registerXdgPopup(QWaylandXdgPopupV5 *xdgPopup) -{ - m_xdgPopups.insert(xdgPopup->surface()->client()->client(), xdgPopup); -} - -void QWaylandXdgShellV5Private::unregisterXdgPopup(QWaylandXdgPopupV5 *xdgPopup) -{ - auto xdgPopupPrivate = QWaylandXdgPopupV5Private::get(xdgPopup); - if (!m_xdgPopups.remove(xdgPopupPrivate->resource()->client(), xdgPopup)) - qWarning("%s Unexpected state. Can't find registered xdg popup\n", Q_FUNC_INFO); -} - -bool QWaylandXdgShellV5Private::isValidPopupParent(QWaylandSurface *parentSurface) const -{ - QWaylandXdgPopupV5 *topmostPopup = topmostPopupForClient(parentSurface->client()->client()); - if (topmostPopup && topmostPopup->surface() != parentSurface) { - return false; - } - - QWaylandSurfaceRole *parentRole = parentSurface->role(); - if (parentRole != QWaylandXdgSurfaceV5::role() && parentRole != QWaylandXdgPopupV5::role()) { - return false; - } - - return true; -} - -QWaylandXdgPopupV5 *QWaylandXdgShellV5Private::topmostPopupForClient(wl_client *client) const -{ - QList<QWaylandXdgPopupV5 *> clientPopups = m_xdgPopups.values(client); - return clientPopups.empty() ? nullptr : clientPopups.last(); -} - -QWaylandXdgSurfaceV5 *QWaylandXdgShellV5Private::xdgSurfaceFromSurface(QWaylandSurface *surface) const -{ - for (QWaylandXdgSurfaceV5 *xdgSurface : m_xdgSurfaces) { - if (surface == xdgSurface->surface()) - return xdgSurface; - } - return nullptr; -} - -void QWaylandXdgShellV5Private::xdg_shell_destroy(Resource *resource) -{ - if (!m_xdgSurfaces.values(resource->client()).empty()) - wl_resource_post_error(resource->handle, XDG_SHELL_ERROR_DEFUNCT_SURFACES, - "xdg_shell was destroyed before children"); - - wl_resource_destroy(resource->handle); -} - -void QWaylandXdgShellV5Private::xdg_shell_get_xdg_surface(Resource *resource, uint32_t id, - wl_resource *surface_res) -{ - Q_Q(QWaylandXdgShellV5); - QWaylandSurface *surface = QWaylandSurface::fromResource(surface_res); - - if (xdgSurfaceFromSurface(surface)) { - wl_resource_post_error(resource->handle, XDG_SHELL_ERROR_ROLE, - "An active xdg_surface already exists for wl_surface@%d", - wl_resource_get_id(surface->resource())); - return; - } - - if (!surface->setRole(QWaylandXdgSurfaceV5::role(), resource->handle, XDG_SHELL_ERROR_ROLE)) - return; - - QWaylandResource xdgSurfaceResource(wl_resource_create(resource->client(), &xdg_surface_v5_interface, - wl_resource_get_version(resource->handle), id)); - - emit q->xdgSurfaceRequested(surface, xdgSurfaceResource); - - QWaylandXdgSurfaceV5 *xdgSurface = QWaylandXdgSurfaceV5::fromResource(xdgSurfaceResource.resource()); - if (!xdgSurface) { - // A QWaylandXdgSurfaceV5 was not created in response to the xdgSurfaceRequested signal, so we - // create one as fallback here instead. - xdgSurface = new QWaylandXdgSurfaceV5(q, surface, xdgSurfaceResource); - } - - registerSurface(xdgSurface); - emit q->xdgSurfaceCreated(xdgSurface); -} - -void QWaylandXdgShellV5Private::xdg_shell_use_unstable_version(Resource *resource, int32_t version) -{ - if (xdg_shell_v5::version_current != version) { - wl_resource_post_error(resource->handle, WL_DISPLAY_ERROR_INVALID_OBJECT, - "incompatible version, server is %d, but client wants %d", - xdg_shell_v5::version_current, version); - } -} - -void QWaylandXdgShellV5Private::xdg_shell_get_xdg_popup(Resource *resource, uint32_t id, - wl_resource *surface_res, wl_resource *parent, - wl_resource *seatResource, uint32_t serial, - int32_t x, int32_t y) -{ - Q_UNUSED(serial); - Q_Q(QWaylandXdgShellV5); - QWaylandSurface *surface = QWaylandSurface::fromResource(surface_res); - QWaylandSurface *parentSurface = QWaylandSurface::fromResource(parent); - - if (!isValidPopupParent(parentSurface)) { - wl_resource_post_error(resource->handle, XDG_SHELL_ERROR_INVALID_POPUP_PARENT, - "the client specified an invalid popup parent surface"); - return; - } - - if (!surface->setRole(QWaylandXdgPopupV5::role(), resource->handle, XDG_SHELL_ERROR_ROLE)) { - return; - } - - QWaylandResource xdgPopupResource (wl_resource_create(resource->client(), &xdg_popup_v5_interface, - wl_resource_get_version(resource->handle), id)); - QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource); - QPoint position(x, y); - emit q->xdgPopupRequested(surface, parentSurface, seat, position, xdgPopupResource); - - QWaylandXdgPopupV5 *xdgPopup = QWaylandXdgPopupV5::fromResource(xdgPopupResource.resource()); - if (!xdgPopup) { - // A QWaylandXdgPopupV5 was not created in response to the xdgPopupRequested signal, so we - // create one as fallback here instead. - xdgPopup = new QWaylandXdgPopupV5(q, surface, parentSurface, position, xdgPopupResource); - } - - registerXdgPopup(xdgPopup); - emit q->xdgPopupCreated(xdgPopup); -} - -void QWaylandXdgShellV5Private::xdg_shell_pong(Resource *resource, uint32_t serial) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgShellV5); - if (m_pings.remove(serial)) - emit q->pong(serial); - else - qWarning("Received an unexpected pong!"); -} - -QWaylandXdgSurfaceV5Private::QWaylandXdgSurfaceV5Private() - : m_lastAckedConfigure({{}, QSize(0, 0), 0}) -{ -} - -void QWaylandXdgSurfaceV5Private::handleFocusLost() -{ - Q_Q(QWaylandXdgSurfaceV5); - QWaylandXdgSurfaceV5Private::ConfigureEvent current = lastSentConfigure(); - current.states.removeOne(QWaylandXdgSurfaceV5::State::ActivatedState); - q->sendConfigure(current.size, current.states); -} - -void QWaylandXdgSurfaceV5Private::handleFocusReceived() -{ - Q_Q(QWaylandXdgSurfaceV5); - - QWaylandXdgSurfaceV5Private::ConfigureEvent current = lastSentConfigure(); - if (!current.states.contains(QWaylandXdgSurfaceV5::State::ActivatedState)) { - current.states.push_back(QWaylandXdgSurfaceV5::State::ActivatedState); - } - - q->sendConfigure(current.size, current.states); -} - -QRect QWaylandXdgSurfaceV5Private::calculateFallbackWindowGeometry() const -{ - // TODO: The unset window geometry should include subsurfaces as well, so this solution - // won't work too well on those kinds of clients. - return QRect(QPoint(), m_surface->destinationSize()); -} - -void QWaylandXdgSurfaceV5Private::updateFallbackWindowGeometry() -{ - Q_Q(QWaylandXdgSurfaceV5); - if (!m_unsetWindowGeometry) - return; - - const QRect unsetGeometry = calculateFallbackWindowGeometry(); - if (unsetGeometry == m_windowGeometry) - return; - - m_windowGeometry = unsetGeometry; - 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); - Q_Q(QWaylandXdgSurfaceV5); - QWaylandXdgShellV5Private::get(m_xdgShell)->unregisterXdgSurface(q); - delete q; -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_destroy(Resource *resource) -{ - wl_resource_destroy(resource->handle); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_move(Resource *resource, wl_resource *seat, uint32_t serial) -{ - Q_UNUSED(resource); - Q_UNUSED(serial); - - Q_Q(QWaylandXdgSurfaceV5); - QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat); - emit q->startMove(input_device); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_resize(Resource *resource, wl_resource *seat, - uint32_t serial, uint32_t edges) -{ - Q_UNUSED(resource); - Q_UNUSED(serial); - - Q_Q(QWaylandXdgSurfaceV5); - QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat); - emit q->startResize(input_device, QWaylandXdgSurfaceV5::ResizeEdge(edges)); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_set_maximized(Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgSurfaceV5); - emit q->setMaximized(); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_unset_maximized(Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgSurfaceV5); - emit q->unsetMaximized(); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_set_fullscreen(Resource *resource, wl_resource *output_res) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgSurfaceV5); - QWaylandOutput *output = output_res ? QWaylandOutput::fromResource(output_res) : nullptr; - emit q->setFullscreen(output); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_unset_fullscreen(Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgSurfaceV5); - emit q->unsetFullscreen(); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_set_minimized(Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgSurfaceV5); - emit q->setMinimized(); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_set_parent(Resource *resource, wl_resource *parent) -{ - Q_UNUSED(resource); - QWaylandXdgSurfaceV5 *parentSurface = nullptr; - if (parent) { - parentSurface = static_cast<QWaylandXdgSurfaceV5Private *>( - QWaylandXdgSurfaceV5Private::Resource::fromResource(parent)->xdg_surface_object)->q_func(); - } - - Q_Q(QWaylandXdgSurfaceV5); - - if (m_parentSurface != parentSurface) { - m_parentSurface = parentSurface; - emit q->parentSurfaceChanged(); - } - - if (m_parentSurface && m_windowType != Qt::WindowType::SubWindow) { - // There's a parent now, which means the surface is transient - setWindowType(Qt::WindowType::SubWindow); - emit q->setTransient(); - } else if (!m_parentSurface && m_windowType != Qt::WindowType::Window) { - // When the surface has no parent it is toplevel - setWindowType(Qt::WindowType::Window); - emit q->setTopLevel(); - } -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_set_app_id(Resource *resource, const QString &app_id) -{ - Q_UNUSED(resource); - if (app_id == m_appId) - return; - Q_Q(QWaylandXdgSurfaceV5); - m_appId = app_id; - emit q->appIdChanged(); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_show_window_menu(Resource *resource, wl_resource *seatResource, - uint32_t serial, int32_t x, int32_t y) -{ - Q_UNUSED(resource); - Q_UNUSED(serial); - QPoint position(x, y); - auto seat = QWaylandSeat::fromSeatResource(seatResource); - Q_Q(QWaylandXdgSurfaceV5); - emit q->showWindowMenu(seat, position); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_ack_configure(Resource *resource, uint32_t serial) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgSurfaceV5); - - ConfigureEvent config; - Q_FOREVER { - if (m_pendingConfigures.empty()) { - qWarning("Received an unexpected ack_configure!"); - return; - } - - config = m_pendingConfigures.takeFirst(); - - if (config.serial == serial) - break; - } - - std::vector<uint> changedStates; - std::set_symmetric_difference( - m_lastAckedConfigure.states.begin(), m_lastAckedConfigure.states.end(), - config.states.begin(), config.states.end(), - std::back_inserter(changedStates)); - - m_lastAckedConfigure = config; - - if (!changedStates.empty()) { - for (uint state : changedStates) { - switch (state) { - case QWaylandXdgSurfaceV5::State::MaximizedState: - emit q->maximizedChanged(); - break; - case QWaylandXdgSurfaceV5::State::FullscreenState: - emit q->fullscreenChanged(); - break; - case QWaylandXdgSurfaceV5::State::ResizingState: - emit q->resizingChanged(); - break; - case QWaylandXdgSurfaceV5::State::ActivatedState: - emit q->activatedChanged(); - break; - } - } - emit q->statesChanged(); - } - - emit q->ackConfigure(serial); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_set_title(Resource *resource, const QString &title) -{ - Q_UNUSED(resource); - if (title == m_title) - return; - Q_Q(QWaylandXdgSurfaceV5); - m_title = title; - emit q->titleChanged(); -} - -void QWaylandXdgSurfaceV5Private::xdg_surface_set_window_geometry(Resource *resource, - int32_t x, int32_t y, - int32_t width, int32_t height) -{ - Q_UNUSED(resource); - - if (width <= 0 || height <= 0) { - qWarning() << "Invalid (non-positive) dimensions received in set_window_geometry"; - return; - } - - m_unsetWindowGeometry = false; - - QRect geometry(x, y, width, height); - - Q_Q(QWaylandXdgSurfaceV5); - if ((q->maximized() || q->fullscreen()) && m_lastAckedConfigure.size != geometry.size()) - qWarning() << "Client window geometry did not obey last acked configure"; - - if (geometry == m_windowGeometry) - return; - - m_windowGeometry = geometry; - emit q->windowGeometryChanged(); -} - -QWaylandXdgPopupV5Private::QWaylandXdgPopupV5Private() -{ -} - -void QWaylandXdgPopupV5Private::xdg_popup_destroy_resource(Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgPopupV5); - QWaylandXdgShellV5Private::get(m_xdgShell)->unregisterXdgPopup(q); - delete q; -} - -void QWaylandXdgPopupV5Private::xdg_popup_destroy(Resource *resource) -{ - //TODO: post error if not topmost popup - wl_resource_destroy(resource->handle); -} - -/*! - * \qmltype XdgShellV5 - * \inqmlmodule QtWayland.Compositor - * \since 5.8 - * \obsolete - * \brief Provides an extension for desktop-style user interfaces. - * - * The XdgShellV5 extension provides a way to associate an XdgSurfaceV5 - * with a regular Wayland surface. Using the xdg_surface interface, the client - * can request that the surface is resized, moved, and so on. - * - * XdgShellV5 corresponds to the Wayland interface \c xdg_shell. - * - * To provide the functionality of the shell extension in a compositor, create - * an instance of the XdgShellV5 component and add it as a child of the - * compositor: - * - * \qml \QtMinorVersion - * import QtWayland.Compositor 1.\1 - * - * WaylandCompositor { - * XdgShellV5 { - * // ... - * } - * } - * \endqml - * - * \deprecated - */ - -/*! - * \class QWaylandXdgShellV5 - * \inmodule QtWaylandCompositor - * \since 5.8 - * \obsolete - * \brief The QWaylandXdgShellV5 class is an extension for desktop-style user interfaces. - * - * The QWaylandXdgShellV5 extension provides a way to associate a QWaylandXdgSurfaceV5 with - * a regular Wayland surface. Using the xdg_surface interface, the client - * can request that the surface is resized, moved, and so on. - * - * QWaylandXdgShellV5 corresponds to the Wayland interface \c xdg_shell. - * - * \deprecated - */ - -/*! - * Constructs a QWaylandXdgShellV5 object. - */ -QWaylandXdgShellV5::QWaylandXdgShellV5() - : QWaylandShellTemplate<QWaylandXdgShellV5>(*new QWaylandXdgShellV5Private()) -{ } - -/*! - * Constructs a QWaylandXdgShellV5 object for the provided \a compositor. - */ -QWaylandXdgShellV5::QWaylandXdgShellV5(QWaylandCompositor *compositor) - : QWaylandShellTemplate<QWaylandXdgShellV5>(compositor, *new QWaylandXdgShellV5Private()) -{ } - -/*! - * Initializes the shell extension. - */ -void QWaylandXdgShellV5::initialize() -{ - Q_D(QWaylandXdgShellV5); - QWaylandShellTemplate::initialize(); - QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer()); - if (!compositor) { - qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandXdgShellV5"; - return; - } - d->init(compositor->display(), 1); - - handleSeatChanged(compositor->defaultSeat(), nullptr); - - connect(compositor, &QWaylandCompositor::defaultSeatChanged, - this, &QWaylandXdgShellV5::handleSeatChanged); -} - -QWaylandClient *QWaylandXdgShellV5::popupClient() const -{ - Q_D(const QWaylandXdgShellV5); - for (QWaylandXdgPopupV5 *popup : d->m_xdgPopups) { - if (popup->surface()->hasContent()) - return popup->surface()->client(); - } - return nullptr; -} - -/*! - * Returns the Wayland interface for the QWaylandXdgShellV5. - */ -const struct wl_interface *QWaylandXdgShellV5::interface() -{ - return QWaylandXdgShellV5Private::interface(); -} - -QByteArray QWaylandXdgShellV5::interfaceName() -{ - return QWaylandXdgShellV5Private::interfaceName(); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgShellV5::ping(WaylandClient client) - * - * Sends a ping event to the \a client. If the client replies to the event, the - * pong signal will be emitted. - */ - -/*! - * Sends a ping event to the \a client. If the client replies to the event, the - * pong signal will be emitted. - */ -uint QWaylandXdgShellV5::ping(QWaylandClient *client) -{ - Q_D(QWaylandXdgShellV5); - - QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer()); - Q_ASSERT(compositor); - - uint32_t serial = compositor->nextSerial(); - - QWaylandXdgShellV5Private::Resource *clientResource = d->resourceMap().value(client->client(), nullptr); - Q_ASSERT(clientResource); - - d->ping(clientResource, serial); - return serial; -} - -// ### remove once QMap has rbegin()/rend() -template <typename Iterator> -std::reverse_iterator<Iterator> make_reverse(Iterator it) -{ - return std::reverse_iterator<Iterator>(std::move(it)); -} - -void QWaylandXdgShellV5::closeAllPopups() -{ - Q_D(QWaylandXdgShellV5); - // Close pop-ups from top-most to bottom-most, lest we get protocol errors: - for (auto rit = make_reverse(d->m_xdgPopups.end()), rend = make_reverse(d->m_xdgPopups.begin()); rit != rend; ++rit) { - (*rit)->sendPopupDone(); - } -} - -/*! - * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgSurfaceRequested(WaylandSurface surface, WaylandResource resource) - * - * This signal is emitted when the client has requested an \c xdg_surface to be associated - * with \a surface. The handler for this signal may create the shell surface for \a resource - * and initialize it within the scope of the signal emission. Otherwise an XdgSurfaceV5 will - * be created automatically. - */ - -/*! - * \fn void QWaylandXdgShellV5::xdgSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource) - * - * This signal is emitted when the client has requested an \c xdg_surface to be associated - * with \a surface. The handler for this signal may create the shell surface for \a resource - * and initialize it within the scope of the signal emission. Otherwise a QWaylandXdgSurfaceV5 - * will be created automatically. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgSurfaceCreated(XdgSurfaceV5 xdgSurface) - * - * This signal is emitted when the client has created an \c xdg_surface. - * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or - * WaylandQuickItem for displaying \a xdgSurface in a QtQuick scene. - */ - -/*! - * \fn void QWaylandXdgShellV5::xdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface) - * - * This signal is emitted when the client has created an \c xdg_surface. - * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or - * QWaylandQuickItem for displaying \a xdgSurface in a QtQuick scene. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgPopupRequested(WaylandSurface surface, WaylandSurface parent, WaylandSeat seat, point position, WaylandResource resource) - * - * This signal is emitted when the client has requested an \c xdg_popup to be associated - * with \a surface. The handler for this signal may create the xdg popup for \a resource and - * initialize it within the scope of the signal emission. Otherwise an XdgPopupV5 will be - * created automatically. - * - * The \a seat is the \c wl_seat that caused the popup to be opened. - * - * \a position is the desired position of the popup, relative to the \a parent. - */ - -/*! - * \fn void QWaylandXdgShellV5::xdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource) - * - * This signal is emitted when the client has requested an \c xdg_surface to be associated - * with \a surface. The handler for this signal may create the xdg poup for \a resource and - * initialize it within the scope of the signal emission. Otherwise a QWaylandXdgPopupV5 will be - * created automatically. - * - * The \a seat is the \c wl_seat that caused the popup to be opened. - * - * \a position is the desired position of the popup, relative to the \a parent. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgShellV5::xdgPopupCreated(XdgPopupV5 xdgPopup) - * - * This signal is emitted when the client has created an \c xdg_popup. - * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or - * WaylandQuickItem for displaying \a xdgPopup in a QtQuick scene. - */ - -/*! - * \fn void QWaylandXdgShellV5::xdgPopupCreated(QWaylandXdgPopupV5 *xdgPopup) - * - * This signal is emitted when the client has created an \c xdg_popup. - * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or - * QWaylandQuickItem for displaying \a xdgPopup in a QtQuick scene. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgShellV5::pong(int serial) - * - * This signal is emitted when the client has responded to a ping event with serial \a serial. - * - * \sa QtWaylandCompositor::XdgShellV5::ping() - */ - -/*! - * \fn void QWaylandXdgShellV5::pong(uint serial) - * - * This signal is emitted when the client has responded to a ping event with serial \a serial. - * - * \sa QWaylandXdgShellV5::ping() - */ - -void QWaylandXdgShellV5::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat) -{ - if (oldSeat != nullptr) { - disconnect(oldSeat, &QWaylandSeat::keyboardFocusChanged, - this, &QWaylandXdgShellV5::handleFocusChanged); - } - - if (newSeat != nullptr) { - connect(newSeat, &QWaylandSeat::keyboardFocusChanged, - this, &QWaylandXdgShellV5::handleFocusChanged); - } -} - -void QWaylandXdgShellV5::handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface) -{ - Q_D(QWaylandXdgShellV5); - - QWaylandXdgSurfaceV5 *newXdgSurface = d->xdgSurfaceFromSurface(newSurface); - QWaylandXdgSurfaceV5 *oldXdgSurface = d->xdgSurfaceFromSurface(oldSurface); - - if (newXdgSurface) - QWaylandXdgSurfaceV5Private::get(newXdgSurface)->handleFocusReceived(); - - if (oldXdgSurface) - QWaylandXdgSurfaceV5Private::get(oldXdgSurface)->handleFocusLost(); -} - -/*! - * \qmltype XdgSurfaceV5 - * \inqmlmodule QtWayland.Compositor - * \since 5.8 - * \obsolete - * \brief Provides a \c xdg_surface that offers desktop-style compositor-specific features to a surface. - * - * This type is part of the \l{XdgShellV5} extension and provides a way to extend - * the functionality of an existing WaylandSurface with features specific to desktop-style - * compositors, such as resizing and moving the surface. - * - * It corresponds to the Wayland interface \c xdg_surface for the unstable xdg-shell protocol v5. - * - * \deprecated - */ - -/*! - * \class QWaylandXdgSurfaceV5 - * \inmodule QtWaylandCompositor - * \since 5.8 - * \obsolete - * \brief The QWaylandXdgSurfaceV5 class provides desktop-style compositor-specific features to an xdg surface. - * - * This class is part of the QWaylandXdgShellV5 extension and provides a way to - * extend the functionality of an existing QWaylandSurface with features - * specific to desktop-style compositors, such as resizing and moving the - * surface. - * - * It corresponds to the Wayland interface xdg_surface. - * - * \deprecated - */ - -/*! - \enum QWaylandXdgSurfaceV5::ResizeEdge - - \value NoneEdge - No edge defined. - \value TopEdge - Top egde. - \value BottomEdge - Bottom edge. - \value LeftEdge - Left edge. - \value TopLeftEdge - Top-left edge. - \value BottomLeftEdge - Bottom-left edge. - \value RightEdge - Right edge. - \value TopRightEdge - Top-right edge. - \value BottomRightEdge - Bottom-right edge. - */ - -/*! - * \fn QWaylandXdgSurfaceV5::setTopLevel() - * - * This signal is emitted when the parent surface is unset, effectively - * making the window top level. - */ - -/*! - * \qmlsignal QtWaylandCompositor::XdgSurfaceV5::setTopLevel() - * - * This signal is emitted when the parent surface is unset, effectively - * making the window top level. - */ - -/*! - * \fn QWaylandXdgSurfaceV5::setTransient() - * - * This signal is emitted when the parent surface is set, effectively - * making the window transient. - */ - -/*! - * \qmlsignal QtWaylandCompositor::XdgSurfaceV5::setTransient() - * - * This signal is emitted when the parent surface is set, effectively - * making the window transient. - */ - -/*! - * Constructs a QWaylandXdgSurfaceV5. - */ -QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5() - : QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV5>(*new QWaylandXdgSurfaceV5Private) -{ -} - -/*! - * Constructs a QWaylandXdgSurfaceV5 for \a surface and initializes it with the - * given \a xdgShell, \a surface, and resource \a res. - */ -QWaylandXdgSurfaceV5::QWaylandXdgSurfaceV5(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface, const QWaylandResource &res) - : QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV5>(*new QWaylandXdgSurfaceV5Private) -{ - initialize(xdgShell, surface, res); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgSurfaceV5::initialize(XdgShellV5 xdgShell, WaylandSurface surface, WaylandResource resource) - * - * Initializes the XdgSurfaceV5, associating it with the given \a xdgShell, \a surface, - * and \a resource. - */ - -/*! - * Initializes the QWaylandXdgSurfaceV5, associating it with the given \a xdgShell, \a surface - * and \a resource. - */ -void QWaylandXdgSurfaceV5::initialize(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface, const QWaylandResource &resource) -{ - Q_D(QWaylandXdgSurfaceV5); - d->m_xdgShell = xdgShell; - d->m_surface = surface; - d->init(resource.resource()); - setExtensionContainer(surface); - d->m_windowGeometry = d->calculateFallbackWindowGeometry(); - connect(surface, &QWaylandSurface::destinationSizeChanged, this, &QWaylandXdgSurfaceV5::handleSurfaceSizeChanged); - connect(surface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandXdgSurfaceV5::handleBufferScaleChanged); - emit shellChanged(); - emit surfaceChanged(); - emit windowGeometryChanged(); - QWaylandCompositorExtension::initialize(); -} - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::showWindowMenu(WaylandSeat seat, point localSurfacePosition) - * - * This signal is emitted when the client wants to show a context menu at \a localSurfacePosition, - * using the Wayland seat \a seat. It's typically emitted in response to the user right-clicking - * the window decorations. - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition) - * - * This signal is emitted when the client wants to show a context menu at \a localSurfacePosition, - * using the Wayland seat \a seat. It's typically emitted in response to the user right-clicking - * the window decorations. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::startMove(WaylandSeat seat) - * - * This signal is emitted when the client wants to start an interactive move of the XdgSurfaceV5, - * typically in response to the window decorations being dragged by \a seat. - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::startMove(QWaylandSeat *seat) - * - * This signal is emitted when the client wants to start an interactive move of the - * QWaylandXdgSurfaceV5, typically in response to the window decorations being dragged by \a seat. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::startResize(WaylandSeat seat, enumeration edges) - * - * This signal is emitted when the client wants to start an interactive resize of the XdgSurfaceV5, - * typically in response to the window decorations being dragged by \a seat on the window borders - * given by \a edges. - * - * \sa QWaylandXdgSurfaceV5::ResizeEdge - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::startResize(QWaylandSeat *seat, ResizeEdge edges) - * - * This signal is emitted when the client wants to start an interactive resize of the - * QWaylandXdgSurfaceV5, typically in response to the window decorations being dragged by - * \a seat on the window borders given by \a edges. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setMaximized() - * - * This signal is emitted when the client wants the \c xdg_surface to be maximized. - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::setMaximized() - * - * This signal is emitted when the client wants the \c xdg_surface to be maximized. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::unsetMaximized() - * - * This signal is emitted when the client doesn't want the \c xdg_surface to be maximized anymore. - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::unsetMaximized() - * - * This signal is emitted when the client doesn't want the \c xdg_surface to be maximized anymore. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setFullscreen(WaylandOutput output) - * - * This signal is emitted when the client wants the \c xdg_surface to be in full screen mode. - * The client may specify an \a output it wishes the \c xdg_surface to be shown on. - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::setFullscreen(QWaylandOutput *output) - * - * This signal is emitted when the client wants the \c xdg_surface to be in full screen mode. - * The client may specify an \a output it wishes the \c xdg_surface to be shown on. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::unsetFullscreen() - * - * This signal is emitted when the client doesn't want the \c xdg_surface to be in full screen mode - * anymore. - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::unsetFullscreen() - * - * This signal is emitted when the client doesn't want the \c xdg_surface to be in full screen mode - * anymore. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::setMinimized() - * - * This signal is emitted when the client wants the \c xdg_surface to be minimized. - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::setMinimized() - * - * This signal is emitted when the client wants the \c xdg_surface to be minimized. - */ - -/*! - * \qmlsignal void QtWaylandCompositor::XdgSurfaceV5::ackConfigure(int serial) - * - * This signal is emitted when the client has received configure events up to and including the - * configure event with serial \a serial and will draw its surface accordingly in the next committed - * buffer. - */ - -/*! - * \fn void QWaylandXdgSurfaceV5::ackConfigure(uint serial) - * - * This signal is emitted when the client has received configure events up to and including the - * configure event with serial \a serial and will draw its surface accordingly in the next committed - * buffer. - */ - -/*! - * \internal - */ -void QWaylandXdgSurfaceV5::initialize() -{ - QWaylandCompositorExtension::initialize(); -} - -QList<int> QWaylandXdgSurfaceV5::statesAsInts() const -{ - QList<int> list; - const auto s = states(); - list.reserve(s.size()); - for (auto state : s) { - list << static_cast<int>(state); - } - return list; -} - -void QWaylandXdgSurfaceV5::handleSurfaceSizeChanged() -{ - Q_D(QWaylandXdgSurfaceV5); - d->updateFallbackWindowGeometry(); -} - -void QWaylandXdgSurfaceV5::handleBufferScaleChanged() -{ - Q_D(QWaylandXdgSurfaceV5); - d->updateFallbackWindowGeometry(); -} - -/*! - * \qmlproperty XdgShellV5 QtWaylandCompositor::XdgSurfaceV5::shell - * - * This property holds the shell associated with this XdgSurfaceV5. - */ - -/*! - * \property QWaylandXdgSurfaceV5::shell - * - * This property holds the shell associated with this QWaylandXdgSurfaceV5. - */ -QWaylandXdgShellV5 *QWaylandXdgSurfaceV5::shell() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_xdgShell; -} - -/*! - * \qmlproperty WaylandSurface QtWaylandCompositor::XdgSurfaceV5::surface - * - * This property holds the surface associated with this XdgSurfaceV5. - */ - -/*! - * \property QWaylandXdgSurfaceV5::surface - * - * This property holds the surface associated with this QWaylandXdgSurfaceV5. - */ -QWaylandSurface *QWaylandXdgSurfaceV5::surface() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_surface; -} - -/*! - * \qmlproperty enumeration QtWaylandCompositor::XdgSurfaceV5::windowType - * - * This property holds the window type of the XdgSurfaceV5. - */ - -Qt::WindowType QWaylandXdgSurfaceV5::windowType() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_windowType; -} - -/*! - * \qmlproperty XdgSurfaceV5 QtWaylandCompositor::XdgSurfaceV5::parentSurface - * - * This property holds the XdgSurfaceV5 parent of this XdgSurfaceV5. - * When a parent surface is set, the parentSurfaceChanged() signal - * is guaranteed to be emitted before setTopLevel() and setTransient(). - * - * \sa QtWaylandCompositor::XdgSurfaceV5::setTopLevel() - * \sa QtWaylandCompositor::XdgSurfaceV5::setTransient() - */ - -/*! - * \property QWaylandXdgSurfaceV5::parentSurface - * - * This property holds the XdgSurfaceV5 parent of this XdgSurfaceV5. - * When a parent surface is set, the parentSurfaceChanged() signal - * is guaranteed to be emitted before setTopLevel() and setTransient(). - * - * \sa QWaylandXdgSurfaceV5::setTopLevel() - * \sa QWaylandXdgSurfaceV5::setTransient() - */ -QWaylandXdgSurfaceV5 *QWaylandXdgSurfaceV5::parentSurface() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_parentSurface; -} - -/*! - * \qmlproperty string QtWaylandCompositor::XdgSurfaceV5::title - * - * This property holds the title of the XdgSurfaceV5. - */ - -/*! - * \property QWaylandXdgSurfaceV5::title - * - * This property holds the title of the QWaylandXdgSurfaceV5. - */ -QString QWaylandXdgSurfaceV5::title() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_title; -} - -/*! - * \property QWaylandXdgSurfaceV5::appId - * - * This property holds the app id of the QWaylandXdgSurfaceV5. - */ -QString QWaylandXdgSurfaceV5::appId() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_appId; -} - -/*! - * \property QWaylandXdgSurfaceV5::windowGeometry - * - * This property holds the window geometry of the QWaylandXdgSurfaceV5. The window - * geometry describes the window's visible bounds from the user's perspective. - * The geometry includes title bars and borders if drawn by the client, but - * excludes drop shadows. It is meant to be used for aligning and tiling - * windows. - */ -QRect QWaylandXdgSurfaceV5::windowGeometry() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_windowGeometry; -} - -/*! - * \property QWaylandXdgSurfaceV5::states - * - * This property holds the last states the client acknowledged for this QWaylandXdgSurfaceV5. - */ -QList<uint> QWaylandXdgSurfaceV5::states() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_lastAckedConfigure.states; -} - -bool QWaylandXdgSurfaceV5::maximized() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_lastAckedConfigure.states.contains(QWaylandXdgSurfaceV5::State::MaximizedState); -} - -bool QWaylandXdgSurfaceV5::fullscreen() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_lastAckedConfigure.states.contains(QWaylandXdgSurfaceV5::State::FullscreenState); -} - -bool QWaylandXdgSurfaceV5::resizing() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_lastAckedConfigure.states.contains(QWaylandXdgSurfaceV5::State::ResizingState); -} - -bool QWaylandXdgSurfaceV5::activated() const -{ - Q_D(const QWaylandXdgSurfaceV5); - return d->m_lastAckedConfigure.states.contains(QWaylandXdgSurfaceV5::State::ActivatedState); -} - -/*! - * Returns the Wayland interface for the QWaylandXdgSurfaceV5. - */ -const wl_interface *QWaylandXdgSurfaceV5::interface() -{ - return QWaylandXdgSurfaceV5Private::interface(); -} - -QByteArray QWaylandXdgSurfaceV5::interfaceName() -{ - return QWaylandXdgSurfaceV5Private::interfaceName(); -} - -/*! - * Returns the surface role for the QWaylandXdgSurfaceV5. - */ -QWaylandSurfaceRole *QWaylandXdgSurfaceV5::role() -{ - return &QWaylandXdgSurfaceV5Private::s_role; -} - -/*! - * Returns the QWaylandXdgSurfaceV5 corresponding to the \a resource. - */ -QWaylandXdgSurfaceV5 *QWaylandXdgSurfaceV5::fromResource(wl_resource *resource) -{ - if (auto p = QtWayland::fromResource<QWaylandXdgSurfaceV5Private *>(resource)) - return p->q_func(); - return nullptr; -} - -QSize QWaylandXdgSurfaceV5::sizeForResize(const QSizeF &size, const QPointF &delta, - QWaylandXdgSurfaceV5::ResizeEdge edge) -{ - qreal width = size.width(); - qreal height = size.height(); - if (edge & LeftEdge) - width -= delta.x(); - else if (edge & RightEdge) - width += delta.x(); - - if (edge & TopEdge) - height -= delta.y(); - else if (edge & BottomEdge) - height += delta.y(); - - QSizeF newSize(qMax(width, 1.0), qMax(height, 1.0)); - return newSize.toSize(); -} - -/*! - * \qmlmethod int QtWaylandCompositor::XdgSurfaceV5::sendConfigure(size size, list<uint> states) - * - * Sends a configure event to the client. \a size contains the pixel size of the surface. - * Known \a states are enumerated in XdgSurfaceV5::State. - */ - -/*! - * Sends a configure event to the client. Parameter \a size contains the pixel size - * of the surface. Known \a states are enumerated in QWaylandXdgSurfaceV5::State. - */ -uint QWaylandXdgSurfaceV5::sendConfigure(const QSize &size, const QList<uint> &states) -{ - if (!size.isValid()) { - qWarning() << "Can't configure xdg surface (v5) with an invalid size" << size; - return 0; - } - Q_D(QWaylandXdgSurfaceV5); - auto statesBytes = QByteArray::fromRawData((char *)states.data(), states.size() * sizeof(State)); - QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(extensionContainer()); - Q_ASSERT(surface); - QWaylandCompositor *compositor = surface->compositor(); - Q_ASSERT(compositor); - uint32_t serial = compositor->nextSerial(); - d->m_pendingConfigures.append(QWaylandXdgSurfaceV5Private::ConfigureEvent{states, size, serial}); - d->send_configure(size.width(), size.height(), statesBytes, serial); - return serial; -} - -uint QWaylandXdgSurfaceV5::sendConfigure(const QSize &size, const QList<QWaylandXdgSurfaceV5::State> &states) -{ - QList<uint> asUints; - asUints.reserve(states.size()); - for (QWaylandXdgSurfaceV5::State state : states) { - asUints << state; - } - return sendConfigure(size, asUints); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgSurfaceV5::sendClose() - * - * Sends a close event to the client. - */ - -/*! - * Sends a close event to the client. - */ -void QWaylandXdgSurfaceV5::sendClose() -{ - Q_D(QWaylandXdgSurfaceV5); - d->send_close(); -} - -uint QWaylandXdgSurfaceV5::sendMaximized(const QSize &size) -{ - Q_D(QWaylandXdgSurfaceV5); - QWaylandXdgSurfaceV5Private::ConfigureEvent conf = d->lastSentConfigure(); - - if (!conf.states.contains(QWaylandXdgSurfaceV5::State::MaximizedState)) - conf.states.append(QWaylandXdgSurfaceV5::State::MaximizedState); - conf.states.removeOne(QWaylandXdgSurfaceV5::State::FullscreenState); - conf.states.removeOne(QWaylandXdgSurfaceV5::State::ResizingState); - - return sendConfigure(size, conf.states); -} - -uint QWaylandXdgSurfaceV5::sendUnmaximized(const QSize &size) -{ - Q_D(QWaylandXdgSurfaceV5); - QWaylandXdgSurfaceV5Private::ConfigureEvent conf = d->lastSentConfigure(); - - conf.states.removeOne(QWaylandXdgSurfaceV5::State::MaximizedState); - conf.states.removeOne(QWaylandXdgSurfaceV5::State::FullscreenState); - conf.states.removeOne(QWaylandXdgSurfaceV5::State::ResizingState); - - return sendConfigure(size, conf.states); -} - -uint QWaylandXdgSurfaceV5::sendFullscreen(const QSize &size) -{ - Q_D(QWaylandXdgSurfaceV5); - QWaylandXdgSurfaceV5Private::ConfigureEvent conf = d->lastSentConfigure(); - - if (!conf.states.contains(QWaylandXdgSurfaceV5::State::FullscreenState)) - conf.states.append(QWaylandXdgSurfaceV5::State::FullscreenState); - conf.states.removeOne(QWaylandXdgSurfaceV5::State::MaximizedState); - conf.states.removeOne(QWaylandXdgSurfaceV5::State::ResizingState); - - return sendConfigure(size, conf.states); -} - -uint QWaylandXdgSurfaceV5::sendResizing(const QSize &maxSize) -{ - Q_D(QWaylandXdgSurfaceV5); - QWaylandXdgSurfaceV5Private::ConfigureEvent conf = d->lastSentConfigure(); - - if (!conf.states.contains(QWaylandXdgSurfaceV5::State::ResizingState)) - conf.states.append(QWaylandXdgSurfaceV5::State::ResizingState); - conf.states.removeOne(QWaylandXdgSurfaceV5::State::MaximizedState); - conf.states.removeOne(QWaylandXdgSurfaceV5::State::FullscreenState); - - return sendConfigure(maxSize, conf.states); -} - -#if QT_CONFIG(wayland_compositor_quick) -QWaylandQuickShellIntegration *QWaylandXdgSurfaceV5::createIntegration(QWaylandQuickShellSurfaceItem *item) -{ - return new QtWayland::XdgShellV5Integration(item); -} -#endif - -/*! - * \qmltype XdgPopupV5 - * \inqmlmodule QtWayland.Compositor - * \since 5.8 - * \obsolete - * \brief Provides a \c xdg_popup interface that implements popup features for the xdg-shell protocol. - * - * This type is part of the \l{XdgShellV5} extension and provides a way to extend - * the functionality of an existing WaylandSurface for handling popup surfaces created by clients - * using xdg-shell. - * - * It corresponds to the Wayland interface \c xdg_popup for the unstable xdg-shell protocol v5. - * - * \deprecated - */ - -/*! - * \class QWaylandXdgPopupV5 - * \inmodule QtWaylandCompositor - * \since 5.8 - * \obsolete - * \brief The QWaylandXdgPopupV5 class provides menus for an xdg surface. - * - * This class is part of the QWaylandXdgShellV5 extension and provides a way to - * extend the functionality of an existing QWaylandSurface with features - * specific to desktop-style menus for an xdg surface. - * - * It corresponds to the Wayland interface xdg_popup. - * - * \deprecated - */ - -/*! - * Constructs a QWaylandXdgPopupV5. - */ -QWaylandXdgPopupV5::QWaylandXdgPopupV5() - : QWaylandShellSurfaceTemplate<QWaylandXdgPopupV5>(*new QWaylandXdgPopupV5Private) -{ -} - -/*! - * Constructs a QWaylandXdgPopupV5, associating it with \a xdgShell at the specified \a position - * for \a surface, and initializes it with the given \a parentSurface and \a resource. - */ -QWaylandXdgPopupV5::QWaylandXdgPopupV5(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface, - QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource) - : QWaylandShellSurfaceTemplate<QWaylandXdgPopupV5>(*new QWaylandXdgPopupV5Private) -{ - initialize(xdgShell, surface, parentSurface, position, resource); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgPopupV5::initialize(XdgShellV5 shell, WaylandSurface surface, WaylandSurface parentSurface, point position, WaylandResource resource) - * - * Initializes the xdg popup, associating it with the given \a shell, \a surface, - * \a parentSurface, \a position and \a resource. - */ - -/*! - * Initializes the QWaylandXdgPopupV5, associating it with the given \a shell, \a surface, - * \a parentSurface, \a position, and \a resource. - */ -void QWaylandXdgPopupV5::initialize(QWaylandXdgShellV5 *shell, QWaylandSurface *surface, QWaylandSurface *parentSurface, - const QPoint& position, const QWaylandResource &resource) -{ - Q_D(QWaylandXdgPopupV5); - d->m_surface = surface; - d->m_parentSurface = parentSurface; - d->m_xdgShell = shell; - d->m_position = position; - d->init(resource.resource()); - setExtensionContainer(surface); - emit shellChanged(); - emit surfaceChanged(); - emit parentSurfaceChanged(); - emit positionChanged(); - QWaylandCompositorExtension::initialize(); -} - -/*! - * \qmlproperty XdgShellV5 QtWaylandCompositor::XdgPopupV5::shell - * - * This property holds the shell associated with this XdgPopupV5. - */ - -/*! - * \property QWaylandXdgPopupV5::shell - * - * This property holds the shell associated with this QWaylandXdgPopupV5. - */ -QWaylandXdgShellV5 *QWaylandXdgPopupV5::shell() const -{ - Q_D(const QWaylandXdgPopupV5); - return d->m_xdgShell; -} - -/*! - * \qmlproperty WaylandSurface QtWaylandCompositor::XdgPopupV5::surface - * - * This property holds the surface associated with this XdgPopupV5. - */ - -/*! - * \property QWaylandXdgPopupV5::surface - * - * This property holds the surface associated with this QWaylandXdgPopupV5. - */ -QWaylandSurface *QWaylandXdgPopupV5::surface() const -{ - Q_D(const QWaylandXdgPopupV5); - return d->m_surface; -} - -/*! - * \qmlproperty WaylandSurface QtWaylandCompositor::XdgPopupV5::parentSurface - * - * This property holds the surface associated with the parent of this XdgPopupV5. - */ - -/*! - * \property QWaylandXdgPopupV5::parentSurface - * - * This property holds the surface associated with the parent of this - * QWaylandXdgPopupV5. - */ -QWaylandSurface *QWaylandXdgPopupV5::parentSurface() const -{ - Q_D(const QWaylandXdgPopupV5); - return d->m_parentSurface; -} - - -/*! - * \qmlproperty point QtWaylandCompositor::XdgPopupV5::position - * - * This property holds the location of the upper left corner of the surface - * relative to the upper left corner of the parent surface, in surface local - * coordinates. - */ - -/*! - * \property QWaylandXdgPopupV5::position - * - * This property holds the location of the upper left corner of the surface - * relative to the upper left corner of the parent surface, in surface local - * coordinates. - */ -QPoint QWaylandXdgPopupV5::position() const -{ - Q_D(const QWaylandXdgPopupV5); - return d->m_position; -} - -/*! - * \internal - */ -void QWaylandXdgPopupV5::initialize() -{ - QWaylandCompositorExtension::initialize(); -} - -/*! - * Returns the Wayland interface for the QWaylandXdgPopupV5. - */ -const wl_interface *QWaylandXdgPopupV5::interface() -{ - return QWaylandXdgPopupV5Private::interface(); -} - -QByteArray QWaylandXdgPopupV5::interfaceName() -{ - return QWaylandXdgPopupV5Private::interfaceName(); -} - -/*! - * Returns the surface role for the QWaylandXdgPopupV5. - */ -QWaylandSurfaceRole *QWaylandXdgPopupV5::role() -{ - return &QWaylandXdgPopupV5Private::s_role; -} - -QWaylandXdgPopupV5 *QWaylandXdgPopupV5::fromResource(wl_resource *resource) -{ - if (auto p = QtWayland::fromResource<QWaylandXdgPopupV5Private *>(resource)) - return p->q_func(); - return nullptr; -} - -void QWaylandXdgPopupV5::sendPopupDone() -{ - Q_D(QWaylandXdgPopupV5); - d->send_popup_done(); -} - -#if QT_CONFIG(wayland_compositor_quick) -QWaylandQuickShellIntegration *QWaylandXdgPopupV5::createIntegration(QWaylandQuickShellSurfaceItem *item) -{ - return new QtWayland::XdgPopupV5Integration(item); -} -#endif - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandxdgshellv5.h b/src/compositor/extensions/qwaylandxdgshellv5.h deleted file mode 100644 index 3c85c2ce..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv5.h +++ /dev/null @@ -1,257 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV5_H -#define QWAYLANDXDGSHELLV5_H - -#include <QtWaylandCompositor/QWaylandCompositorExtension> -#include <QtWaylandCompositor/QWaylandResource> -#include <QtWaylandCompositor/QWaylandShell> -#include <QtWaylandCompositor/QWaylandShellSurface> -#include <QtWaylandCompositor/qwaylandquickchildren.h> - -#include <QtCore/QRect> - -struct wl_resource; - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -class QWaylandXdgShellV5Private; -class QWaylandXdgSurfaceV5; -class QWaylandXdgSurfaceV5Private; -class QWaylandXdgPopupV5; -class QWaylandXdgPopupV5Private; - -class QWaylandSurface; -class QWaylandSurfaceRole; -class QWaylandSeat; -class QWaylandOutput; -class QWaylandClient; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellV5 : public QWaylandShellTemplate<QWaylandXdgShellV5> -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandXdgShellV5) -public: - QWaylandXdgShellV5(); - QWaylandXdgShellV5(QWaylandCompositor *compositor); - - void initialize() override; - QWaylandClient *popupClient() const; - - static const struct wl_interface *interface(); - static QByteArray interfaceName(); - -public Q_SLOTS: - uint ping(QWaylandClient *client); - void closeAllPopups(); - -Q_SIGNALS: - void xdgSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource); - void xdgSurfaceCreated(QWaylandXdgSurfaceV5 *xdgSurface); - void xdgPopupCreated(QWaylandXdgPopupV5 *xdgPopup); - void xdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource); - void pong(uint serial); - -private Q_SLOTS: - void handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat); - void handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface); - -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV5 : public QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV5> -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandXdgSurfaceV5) - Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgSurfaceV5) - Q_PROPERTY(QWaylandXdgShellV5 *shell READ shell NOTIFY shellChanged) - Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged) - Q_PROPERTY(QWaylandXdgSurfaceV5 *parentSurface READ parentSurface NOTIFY parentSurfaceChanged) - Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(QString appId READ appId NOTIFY appIdChanged) - Q_PROPERTY(QRect windowGeometry READ windowGeometry NOTIFY windowGeometryChanged) - Q_MOC_INCLUDE("qwaylandsurface.h") - - Q_PROPERTY(QList<int> states READ statesAsInts NOTIFY statesChanged) - Q_PROPERTY(bool maximized READ maximized NOTIFY maximizedChanged) - Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged) - Q_PROPERTY(bool resizing READ resizing NOTIFY resizingChanged) - Q_PROPERTY(bool activated READ activated NOTIFY activatedChanged) - -public: - enum State : uint { - MaximizedState = 1, - FullscreenState = 2, - ResizingState = 3, - ActivatedState = 4 - }; - Q_ENUM(State) - - enum ResizeEdge : uint { - NoneEdge = 0, - TopEdge = 1, - BottomEdge = 2, - LeftEdge = 4, - TopLeftEdge = 5, - BottomLeftEdge = 6, - RightEdge = 8, - TopRightEdge = 9, - BottomRightEdge = 10 - }; - Q_ENUM(ResizeEdge) - - QWaylandXdgSurfaceV5(); - QWaylandXdgSurfaceV5(QWaylandXdgShellV5* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource); - - 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; - QList<uint> states() const; - bool maximized() const; - bool fullscreen() const; - bool resizing() const; - bool activated() const; - - QWaylandXdgShellV5 *shell() const; - - QWaylandSurface *surface() const; - QWaylandXdgSurfaceV5 *parentSurface() const; - - static const struct wl_interface *interface(); - static QByteArray interfaceName(); - static QWaylandSurfaceRole *role(); - static QWaylandXdgSurfaceV5 *fromResource(::wl_resource *resource); - - Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, ResizeEdge edge); - Q_INVOKABLE uint sendConfigure(const QSize &size, const QList<uint> &states); - Q_INVOKABLE uint sendConfigure(const QSize &size, const QList<State> &states); - Q_INVOKABLE void sendClose(); - - Q_INVOKABLE uint sendMaximized(const QSize &size); - Q_INVOKABLE uint sendUnmaximized(const QSize &size = QSize(0, 0)); - Q_INVOKABLE uint sendFullscreen(const QSize &size); - Q_INVOKABLE uint sendResizing(const QSize &maxSize); - -#if QT_CONFIG(wayland_compositor_quick) - QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override; -#endif - -Q_SIGNALS: - void shellChanged(); - void surfaceChanged(); - void titleChanged(); - void windowGeometryChanged(); - void appIdChanged(); - void parentSurfaceChanged(); - - void statesChanged(); - void maximizedChanged(); - void fullscreenChanged(); - void resizingChanged(); - void activatedChanged(); - - void showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition); - void startMove(QWaylandSeat *seat); - void startResize(QWaylandSeat *seat, ResizeEdge edges); - void setTopLevel(); - void setTransient(); - void setMaximized(); - void unsetMaximized(); - void setFullscreen(QWaylandOutput *output); - void unsetFullscreen(); - void setMinimized(); - void ackConfigure(uint serial); - -private: - void initialize() override; - QList<int> statesAsInts() const; - -private Q_SLOTS: - void handleSurfaceSizeChanged(); - void handleBufferScaleChanged(); -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV5 : public QWaylandShellSurfaceTemplate<QWaylandXdgPopupV5> -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandXdgPopupV5) - Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgPopupV5) - Q_PROPERTY(QWaylandXdgShellV5 *shell READ shell NOTIFY shellChanged) - Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged) - Q_PROPERTY(QWaylandSurface *parentSurface READ parentSurface NOTIFY parentSurfaceChanged) - Q_PROPERTY(QPoint position READ position NOTIFY positionChanged) - -public: - QWaylandXdgPopupV5(); - QWaylandXdgPopupV5(QWaylandXdgShellV5 *xdgShell, QWaylandSurface *surface, QWaylandSurface *parentSurface, - const QPoint &position, const QWaylandResource &resource); - - Qt::WindowType windowType() const override { return Qt::WindowType::Popup; } - - Q_INVOKABLE void initialize(QWaylandXdgShellV5 *shell, QWaylandSurface *surface, - QWaylandSurface *parentSurface, const QPoint &position, const QWaylandResource &resource); - - QWaylandXdgShellV5 *shell() const; - - QWaylandSurface *surface() const; - QWaylandSurface *parentSurface() const; - QPoint position() const; - - static const struct wl_interface *interface(); - static QByteArray interfaceName(); - static QWaylandSurfaceRole *role(); - static QWaylandXdgPopupV5 *fromResource(::wl_resource *resource); - - Q_INVOKABLE void sendPopupDone(); - -#if QT_CONFIG(wayland_compositor_quick) - QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override; -#endif - -Q_SIGNALS: - void shellChanged(); - void surfaceChanged(); - void parentSurfaceChanged(); - void positionChanged(); - -private: - void initialize() override; -}; - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE - -#endif /*QWAYLANDXDGSHELLV5_H*/ diff --git a/src/compositor/extensions/qwaylandxdgshellv5_p.h b/src/compositor/extensions/qwaylandxdgshellv5_p.h deleted file mode 100644 index e223aa71..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv5_p.h +++ /dev/null @@ -1,177 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV5_P_H -#define QWAYLANDXDGSHELLV5_P_H - -#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> -#include <QtWaylandCompositor/private/qwaylandshell_p.h> -#include <QtWaylandCompositor/private/qwayland-server-xdg-shell-unstable-v5_p.h> - -#include <QtWaylandCompositor/QWaylandXdgShellV5> - -#include <QtCore/QSet> - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellV5Private - : public QWaylandShellPrivate - , public QtWaylandServer::xdg_shell_v5 -{ - Q_DECLARE_PUBLIC(QWaylandXdgShellV5) -public: - QWaylandXdgShellV5Private(); - void ping(Resource *resource, uint32_t serial); - void registerSurface(QWaylandXdgSurfaceV5 *xdgSurface); - void unregisterXdgSurface(QWaylandXdgSurfaceV5 *xdgSurface); - void registerXdgPopup(QWaylandXdgPopupV5 *xdgPopup); - void unregisterXdgPopup(QWaylandXdgPopupV5 *xdgPopup); - static QWaylandXdgShellV5Private *get(QWaylandXdgShellV5 *xdgShell) { return xdgShell->d_func(); } - bool isValidPopupParent(QWaylandSurface *parentSurface) const; - QWaylandXdgPopupV5 *topmostPopupForClient(struct wl_client* client) const; - - QSet<uint32_t> m_pings; - QMultiMap<struct wl_client *, QWaylandXdgSurfaceV5 *> m_xdgSurfaces; - QMultiMap<struct wl_client *, QWaylandXdgPopupV5 *> m_xdgPopups; - - QWaylandXdgSurfaceV5 *xdgSurfaceFromSurface(QWaylandSurface *surface) const; - -protected: - void xdg_shell_destroy(Resource *resource) override; - void xdg_shell_get_xdg_surface(Resource *resource, uint32_t id, - 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) override; - void xdg_shell_pong(Resource *resource, uint32_t serial) override; -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV5Private - : public QWaylandCompositorExtensionPrivate - , public QtWaylandServer::xdg_surface_v5 -{ - Q_DECLARE_PUBLIC(QWaylandXdgSurfaceV5) -public: - QWaylandXdgSurfaceV5Private(); - static QWaylandXdgSurfaceV5Private *get(QWaylandXdgSurfaceV5 *xdgSurface) { return xdgSurface->d_func(); } - - struct ConfigureEvent { - QList<uint> states; - QSize size; - uint serial; - }; - - void handleFocusLost(); - void handleFocusReceived(); - QRect calculateFallbackWindowGeometry() const; - void updateFallbackWindowGeometry(); - - void setWindowType(Qt::WindowType windowType); - -private: - QWaylandXdgShellV5 *m_xdgShell = nullptr; - QWaylandSurface *m_surface = nullptr; - QWaylandXdgSurfaceV5 *m_parentSurface = nullptr; - - Qt::WindowType m_windowType = Qt::WindowType::Window; - - QString m_title; - QString m_appId; - QRect m_windowGeometry; - bool m_unsetWindowGeometry = true; - - QList<ConfigureEvent> m_pendingConfigures; - ConfigureEvent m_lastAckedConfigure; - ConfigureEvent lastSentConfigure() const { return m_pendingConfigures.empty() ? m_lastAckedConfigure : m_pendingConfigures.first(); } - - void xdg_surface_destroy_resource(Resource *resource) override; - - void xdg_surface_destroy(Resource *resource) override; - void xdg_surface_move(Resource *resource, struct ::wl_resource *seat, - uint32_t serial) override; - void xdg_surface_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, - 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) 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) 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) override; - - static QWaylandSurfaceRole s_role; -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV5Private - : public QWaylandCompositorExtensionPrivate - , public QtWaylandServer::xdg_popup_v5 -{ - Q_DECLARE_PUBLIC(QWaylandXdgPopupV5) - -public: - QWaylandXdgPopupV5Private(); - static QWaylandXdgPopupV5Private *get(QWaylandXdgPopupV5 *xdgPopup) { return xdgPopup->d_func(); } - - QWaylandSurface *m_surface = nullptr; - QWaylandSurface *m_parentSurface = nullptr; - QWaylandXdgShellV5 *m_xdgShell = nullptr; - QPoint m_position; - - void xdg_popup_destroy_resource(Resource *resource) override; - void xdg_popup_destroy(xdg_popup_v5::Resource *resource) override; - - static QWaylandSurfaceRole s_role; -}; - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE - -#endif // QWAYLANDXDGSHELLV5_P_H diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp deleted file mode 100644 index 375f0e9f..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv5integration_p.h" - -#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> -#include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandSeat> -#include <QtWaylandCompositor/private/qwaylandxdgshellv5_p.h> -#include <QMouseEvent> -#include <QGuiApplication> - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -namespace QtWayland { - -static void handlePopupCreated(QWaylandQuickShellSurfaceItem *parentItem, QWaylandXdgPopupV5 *popup) -{ - if (parentItem->surface() == popup->parentSurface()) - QWaylandQuickShellSurfaceItemPrivate::get(parentItem)->maybeCreateAutoPopup(popup); -} - -XdgShellV5Integration::XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item) - : QWaylandQuickShellIntegration(item) - , m_item(item) - , m_xdgSurface(qobject_cast<QWaylandXdgSurfaceV5 *>(item->shellSurface())) - , grabberState(GrabberState::Default) -{ - m_item->setSurface(m_xdgSurface->surface()); - connect(m_xdgSurface, &QWaylandXdgSurfaceV5::startMove, this, &XdgShellV5Integration::handleStartMove); - connect(m_xdgSurface, &QWaylandXdgSurfaceV5::startResize, this, &XdgShellV5Integration::handleStartResize); - connect(m_xdgSurface, &QWaylandXdgSurfaceV5::setTopLevel, this, &XdgShellV5Integration::handleSetTopLevel); - connect(m_xdgSurface, &QWaylandXdgSurfaceV5::setTransient, this, &XdgShellV5Integration::handleSetTransient); - connect(m_xdgSurface, &QWaylandXdgSurfaceV5::setMaximized, this, &XdgShellV5Integration::handleSetMaximized); - connect(m_xdgSurface, &QWaylandXdgSurfaceV5::unsetMaximized, this, &XdgShellV5Integration::handleUnsetMaximized); - connect(m_xdgSurface, &QWaylandXdgSurfaceV5::maximizedChanged, this, &XdgShellV5Integration::handleMaximizedChanged); - connect(m_xdgSurface, &QWaylandXdgSurfaceV5::activatedChanged, this, &XdgShellV5Integration::handleActivatedChanged); - connect(m_xdgSurface->surface(), &QWaylandSurface::destinationSizeChanged, this, &XdgShellV5Integration::handleSurfaceSizeChanged); - connect(m_xdgSurface->shell(), &QWaylandXdgShellV5::xdgPopupCreated, this, [item](QWaylandXdgPopupV5 *popup){ - handlePopupCreated(item, popup); - }); -} - -XdgShellV5Integration::~XdgShellV5Integration() -{ - m_item->setSurface(nullptr); -} - -bool XdgShellV5Integration::eventFilter(QObject *object, QEvent *event) -{ - if (event->type() == QEvent::MouseMove) { - QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); - return filterMouseMoveEvent(mouseEvent); - } else if (event->type() == QEvent::MouseButtonRelease) { - QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); - return filterMouseReleaseEvent(mouseEvent); - } - return QWaylandQuickShellIntegration::eventFilter(object, event); -} - -bool XdgShellV5Integration::filterMouseMoveEvent(QMouseEvent *event) -{ - if (grabberState == GrabberState::Resize) { - Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event)); - if (!resizeState.initialized) { - resizeState.initialMousePos = event->scenePosition(); - resizeState.initialized = true; - return true; - } - QPointF delta = m_item->mapToSurface(event->scenePosition() - resizeState.initialMousePos); - QSize newSize = m_xdgSurface->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges); - m_xdgSurface->sendResizing(newSize); - } else if (grabberState == GrabberState::Move) { - Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event)); - QQuickItem *moveItem = m_item->moveItem(); - if (!moveState.initialized) { - moveState.initialOffset = moveItem->mapFromItem(nullptr, event->scenePosition()); - moveState.initialized = true; - return true; - } - if (!moveItem->parentItem()) - return true; - QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->scenePosition()); - moveItem->setPosition(parentPos - moveState.initialOffset); - } - return false; -} - -bool XdgShellV5Integration::filterMouseReleaseEvent(QMouseEvent *event) -{ - Q_UNUSED(event); - - if (grabberState == GrabberState::Resize) { - m_xdgSurface->sendUnmaximized(); - grabberState = GrabberState::Default; - return true; - } else if (grabberState == GrabberState::Move) { - grabberState = GrabberState::Default; - return true; - } - return false; -} - -void XdgShellV5Integration::handleStartMove(QWaylandSeat *seat) -{ - grabberState = GrabberState::Move; - moveState.seat = seat; - moveState.initialized = false; -} - -void XdgShellV5Integration::handleStartResize(QWaylandSeat *seat, QWaylandXdgSurfaceV5::ResizeEdge edges) -{ - grabberState = GrabberState::Resize; - resizeState.seat = seat; - resizeState.resizeEdges = edges; - resizeState.initialWindowSize = m_xdgSurface->windowGeometry().size(); - resizeState.initialPosition = m_item->moveItem()->position(); - resizeState.initialSurfaceSize = m_item->surface()->destinationSize(); - resizeState.initialized = false; -} - -void XdgShellV5Integration::handleSetTopLevel() -{ - if (m_xdgSurface->shell()->focusPolicy() == QWaylandShell::AutomaticFocus) - m_item->takeFocus(); -} - -void XdgShellV5Integration::handleSetTransient() -{ - if (m_xdgSurface->shell()->focusPolicy() == QWaylandShell::AutomaticFocus) - m_item->takeFocus(); -} - -void XdgShellV5Integration::handleSetMaximized() -{ - if (!m_item->view()->isPrimary()) - return; - - maximizeState.initialWindowSize = m_xdgSurface->windowGeometry().size(); - maximizeState.initialPosition = m_item->moveItem()->position(); - - QWaylandOutput *output = m_item->view()->output(); - m_xdgSurface->sendMaximized(output->availableGeometry().size() / output->scaleFactor()); -} - -void XdgShellV5Integration::handleUnsetMaximized() -{ - if (!m_item->view()->isPrimary()) - return; - - m_xdgSurface->sendUnmaximized(maximizeState.initialWindowSize); -} - -void XdgShellV5Integration::handleMaximizedChanged() -{ - if (m_xdgSurface->maximized()) { - QWaylandOutput *output = m_item->view()->output(); - m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft()); - } else { - m_item->moveItem()->setPosition(maximizeState.initialPosition); - } -} - -void XdgShellV5Integration::handleActivatedChanged() -{ - if (m_xdgSurface->activated()) - m_item->raise(); -} - -void XdgShellV5Integration::handleSurfaceSizeChanged() -{ - if (grabberState == GrabberState::Resize) { - qreal dx = 0; - qreal dy = 0; - if (resizeState.resizeEdges & QWaylandXdgSurfaceV5::ResizeEdge::TopEdge) - dy = resizeState.initialSurfaceSize.height() - m_item->surface()->destinationSize().height(); - if (resizeState.resizeEdges & QWaylandXdgSurfaceV5::ResizeEdge::LeftEdge) - dx = resizeState.initialSurfaceSize.width() - m_item->surface()->destinationSize().width(); - QPointF offset = m_item->mapFromSurface({dx, dy}); - m_item->moveItem()->setPosition(resizeState.initialPosition + offset); - } -} - -XdgPopupV5Integration::XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item) - : QWaylandQuickShellIntegration (item) - , m_item(item) - , m_xdgPopup(qobject_cast<QWaylandXdgPopupV5 *>(item->shellSurface())) - , m_xdgShell(QWaylandXdgPopupV5Private::get(m_xdgPopup)->m_xdgShell) -{ - item->setSurface(m_xdgPopup->surface()); - if (item->view()->output()) { - QPoint position = item->mapFromSurface(m_xdgPopup->position()).toPoint(); - item->moveItem()->setPosition(position); - } else { - qWarning() << "XdgPopupV5Integration popup item without output" << item; - } - - QWaylandClient *client = m_xdgPopup->surface()->client(); - auto shell = m_xdgShell; - QWaylandQuickShellEventFilter::startFilter(client, [shell]() { shell->closeAllPopups(); }); - - connect(m_xdgPopup, &QWaylandXdgPopupV5::destroyed, this, &XdgPopupV5Integration::handlePopupDestroyed); - connect(m_xdgPopup->shell(), &QWaylandXdgShellV5::xdgPopupCreated, this, [item](QWaylandXdgPopupV5 *popup) { - handlePopupCreated(item, popup); - }); -} - -XdgPopupV5Integration::~XdgPopupV5Integration() -{ - m_item->setSurface(nullptr); -} - -void XdgPopupV5Integration::handlePopupDestroyed() -{ - QWaylandXdgShellV5Private *shellPrivate = QWaylandXdgShellV5Private::get(m_xdgShell); - auto popups = shellPrivate->m_xdgPopups; - if (popups.isEmpty()) - QWaylandQuickShellEventFilter::cancelFilter(); -} - -} - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h b/src/compositor/extensions/qwaylandxdgshellv5integration_p.h deleted file mode 100644 index 4a0c3d21..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv5integration_p.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV5INTEGRATION_H -#define QWAYLANDXDGSHELLV5INTEGRATION_H - -#include <QtWaylandCompositor/private/qwaylandquickshellsurfaceitem_p.h> -#include <QtWaylandCompositor/QWaylandXdgSurfaceV5> - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -namespace QtWayland { - -class XdgShellV5Integration : public QWaylandQuickShellIntegration -{ - Q_OBJECT -public: - XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item); - ~XdgShellV5Integration() override; - -protected: - bool eventFilter(QObject *object, QEvent *event) override; - -private Q_SLOTS: - void handleStartMove(QWaylandSeat *seat); - void handleStartResize(QWaylandSeat *seat, QWaylandXdgSurfaceV5::ResizeEdge edges); - void handleSetTopLevel(); - void handleSetTransient(); - void handleSetMaximized(); - void handleUnsetMaximized(); - void handleMaximizedChanged(); - void handleActivatedChanged(); - void handleSurfaceSizeChanged(); - -private: - enum class GrabberState { - Default, - Resize, - Move - }; - QWaylandQuickShellSurfaceItem *m_item = nullptr; - QWaylandXdgSurfaceV5 *m_xdgSurface = nullptr; - - GrabberState grabberState; - struct { - QWaylandSeat *seat = nullptr; - QPointF initialOffset; - bool initialized = false; - } moveState; - - struct { - QWaylandSeat *seat = nullptr; - QWaylandXdgSurfaceV5::ResizeEdge resizeEdges; - QSizeF initialWindowSize; - QPointF initialMousePos; - QPointF initialPosition; - QSize initialSurfaceSize; - bool initialized = false; - } resizeState; - - struct { - QSize initialWindowSize; - QPointF initialPosition; - } maximizeState; - - bool filterMouseMoveEvent(QMouseEvent *event); - bool filterMouseReleaseEvent(QMouseEvent *event); -}; - -class XdgPopupV5Integration : public QWaylandQuickShellIntegration -{ - Q_OBJECT -public: - XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item); - ~XdgPopupV5Integration() override; - -private Q_SLOTS: - void handlePopupDestroyed(); - -private: - QWaylandQuickShellSurfaceItem *m_item = nullptr; - QWaylandXdgPopupV5 *m_xdgPopup = nullptr; - QWaylandXdgShellV5 *m_xdgShell = nullptr; -}; - -} - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE - -#endif // QWAYLANDXDGSHELLV5INTEGRATION_H diff --git a/src/compositor/extensions/qwaylandxdgshellv6.cpp b/src/compositor/extensions/qwaylandxdgshellv6.cpp deleted file mode 100644 index 1dbd0006..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv6.cpp +++ /dev/null @@ -1,2045 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv6.h" -#include "qwaylandxdgshellv6_p.h" - -#if QT_CONFIG(wayland_compositor_quick) -#include "qwaylandxdgshellv6integration_p.h" -#endif -#include <QtWaylandCompositor/private/qwaylandutils_p.h> - -#include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandSeat> -#include <QtWaylandCompositor/QWaylandSurface> -#include <QtWaylandCompositor/QWaylandSurfaceRole> -#include <QtWaylandCompositor/QWaylandResource> - -#include <QtCore/QObject> - -#include <algorithm> - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -QWaylandXdgShellV6Private::QWaylandXdgShellV6Private() -{ -} - -void QWaylandXdgShellV6Private::ping(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t serial) -{ - m_pings.insert(serial); - send_ping(resource->handle, serial); -} - -void QWaylandXdgShellV6Private::registerXdgSurface(QWaylandXdgSurfaceV6 *xdgSurface) -{ - m_xdgSurfaces.insert(xdgSurface->surface()->client()->client(), xdgSurface); -} - -void QWaylandXdgShellV6Private::unregisterXdgSurface(QWaylandXdgSurfaceV6 *xdgSurface) -{ - auto xdgSurfacePrivate = QWaylandXdgSurfaceV6Private::get(xdgSurface); - if (!m_xdgSurfaces.remove(xdgSurfacePrivate->resource()->client(), xdgSurface)) - qWarning("%s Unexpected state. Can't find registered xdg surface\n", Q_FUNC_INFO); -} - -Qt::Edges QWaylandXdgShellV6Private::convertToEdges(uint xdgEdges) -{ - return Qt::Edges(((xdgEdges & 0b1100) >> 1) | ((xdgEdges & 0b0010) << 2) | (xdgEdges & 0b0001)); -} - -QWaylandXdgSurfaceV6 *QWaylandXdgShellV6Private::xdgSurfaceFromSurface(QWaylandSurface *surface) -{ - for (QWaylandXdgSurfaceV6 *xdgSurface : qAsConst(m_xdgSurfaces)) { - if (surface == xdgSurface->surface()) - return xdgSurface; - } - return nullptr; -} - -void QWaylandXdgShellV6Private::zxdg_shell_v6_destroy(Resource *resource) -{ - if (!m_xdgSurfaces.values(resource->client()).empty()) - wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_DEFUNCT_SURFACES, - "xdg_shell was destroyed before children"); - - wl_resource_destroy(resource->handle); -} - -void QWaylandXdgShellV6Private::zxdg_shell_v6_create_positioner(QtWaylandServer::zxdg_shell_v6::Resource *resource, uint32_t id) -{ - QWaylandResource positionerResource(wl_resource_create(resource->client(), &zxdg_positioner_v6_interface, - wl_resource_get_version(resource->handle), id)); - - new QWaylandXdgPositionerV6(positionerResource); -} - -void QWaylandXdgShellV6Private::zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, wl_resource *surfaceResource) -{ - Q_Q(QWaylandXdgShellV6); - QWaylandSurface *surface = QWaylandSurface::fromResource(surfaceResource); - - if (surface->role() != nullptr) { - wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_ROLE, - "wl_surface@%d, already has role %s\n", - wl_resource_get_id(surface->resource()), - surface->role()->name().constData()); - return; - } - - if (surface->hasContent()) { - //TODO: According to the spec, this is a client error, but there's no appropriate error code - qWarning() << "get_xdg_surface requested on a zxdg_surface_v6 with content"; - } - - QWaylandResource xdgSurfaceResource(wl_resource_create(resource->client(), &zxdg_surface_v6_interface, - wl_resource_get_version(resource->handle), id)); - - QWaylandXdgSurfaceV6 *xdgSurface = new QWaylandXdgSurfaceV6(q, surface, xdgSurfaceResource); - - registerXdgSurface(xdgSurface); - emit q->xdgSurfaceCreated(xdgSurface); -} - -void QWaylandXdgShellV6Private::zxdg_shell_v6_pong(Resource *resource, uint32_t serial) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgShellV6); - if (m_pings.remove(serial)) - emit q->pong(serial); - else - qWarning("Received an unexpected pong!"); -} - -/*! - * \qmltype XdgShellV6 - * \inqmlmodule QtWayland.Compositor - * \since 5.10 - * \obsolete - * \brief Provides an extension for desktop-style user interfaces. - * - * The XdgShellV6 extension provides a way to associate a XdgToplevelV6 or XdgPopupV6 - * with a regular Wayland surface. Using the XdgToplevelV6 interface, the client - * can request that the surface is resized, moved, and so on. - * - * XdgShellV6 corresponds to the Wayland interface, \c zxdg_shell_v6. - * - * To provide the functionality of the shell extension in a compositor, create - * an instance of the XdgShellV6 component and add it to the list of extensions - * supported by the compositor: - * - * \qml \QtMinorVersion - * import QtWayland.Compositor 1.\1 - * - * WaylandCompositor { - * XdgShellV6 { - * // ... - * } - * } - * \endqml - */ - -/*! - * \class QWaylandXdgShellV6 - * \inmodule QtWaylandCompositor - * \since 5.10 - * \obsolete - * \brief The QWaylandXdgShellV6 class is an extension for desktop-style user interfaces. - * - * The QWaylandXdgShellV6 extension provides a way to associate a QWaylandXdgToplevelV6 or - * QWaylandXdgPopupV6 with a regular Wayland surface. Using the QWaylandXdgToplevelV6 interface, - * the client can request that the surface is resized, moved, and so on. - * - * QWaylandXdgShellV6 corresponds to the Wayland interface, \c zxdg_shell_v6. - */ - -/*! - * Constructs a QWaylandXdgShellV6 object. - */ -QWaylandXdgShellV6::QWaylandXdgShellV6() - : QWaylandShellTemplate<QWaylandXdgShellV6>(*new QWaylandXdgShellV6Private()) -{ -} - -/*! - * Constructs a QWaylandXdgShellV6 object for the provided \a compositor. - */ -QWaylandXdgShellV6::QWaylandXdgShellV6(QWaylandCompositor *compositor) - : QWaylandShellTemplate<QWaylandXdgShellV6>(compositor, *new QWaylandXdgShellV6Private()) -{ -} - -/*! - * Initializes the shell extension. - */ -void QWaylandXdgShellV6::initialize() -{ - Q_D(QWaylandXdgShellV6); - QWaylandShellTemplate::initialize(); - QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer()); - if (!compositor) { - qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandXdgShellV6"; - return; - } - d->init(compositor->display(), 1); - - handleSeatChanged(compositor->defaultSeat(), nullptr); - - connect(compositor, &QWaylandCompositor::defaultSeatChanged, - this, &QWaylandXdgShellV6::handleSeatChanged); -} - -/*! - * Returns the Wayland interface for the QWaylandXdgShellV6. - */ -const struct wl_interface *QWaylandXdgShellV6::interface() -{ - return QWaylandXdgShellV6Private::interface(); -} - -QByteArray QWaylandXdgShellV6::interfaceName() -{ - return QWaylandXdgShellV6Private::interfaceName(); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgShellV6::ping(WaylandClient client) - * - * Sends a ping event to \a client. If the client replies to the event the - * \l pong signal will be emitted. - */ - -/*! - * Sends a ping event to \a client. If the client replies to the event the - * \l pong signal will be emitted. - */ -uint QWaylandXdgShellV6::ping(QWaylandClient *client) -{ - Q_D(QWaylandXdgShellV6); - - QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer()); - Q_ASSERT(compositor); - - uint32_t serial = compositor->nextSerial(); - - QWaylandXdgShellV6Private::Resource *clientResource = d->resourceMap().value(client->client(), nullptr); - Q_ASSERT(clientResource); - - d->ping(clientResource, serial); - return serial; -} - -void QWaylandXdgShellV6::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat) -{ - if (oldSeat != nullptr) { - disconnect(oldSeat, &QWaylandSeat::keyboardFocusChanged, - this, &QWaylandXdgShellV6::handleFocusChanged); - } - - if (newSeat != nullptr) { - connect(newSeat, &QWaylandSeat::keyboardFocusChanged, - this, &QWaylandXdgShellV6::handleFocusChanged); - } -} - -void QWaylandXdgShellV6::handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface) -{ - Q_D(QWaylandXdgShellV6); - - QWaylandXdgSurfaceV6 *newXdgSurface = d->xdgSurfaceFromSurface(newSurface); - QWaylandXdgSurfaceV6 *oldXdgSurface = d->xdgSurfaceFromSurface(oldSurface); - - if (newXdgSurface) - QWaylandXdgSurfaceV6Private::get(newXdgSurface)->handleFocusReceived(); - - if (oldXdgSurface) - QWaylandXdgSurfaceV6Private::get(oldXdgSurface)->handleFocusLost(); -} - -QWaylandXdgSurfaceV6Private::QWaylandXdgSurfaceV6Private() -{ -} - -void QWaylandXdgSurfaceV6Private::setWindowType(Qt::WindowType windowType) -{ - if (m_windowType == windowType) - return; - - m_windowType = windowType; - - Q_Q(QWaylandXdgSurfaceV6); - emit q->windowTypeChanged(); -} - -void QWaylandXdgSurfaceV6Private::handleFocusLost() -{ - if (m_toplevel) - QWaylandXdgToplevelV6Private::get(m_toplevel)->handleFocusLost(); -} - -void QWaylandXdgSurfaceV6Private::handleFocusReceived() -{ - if (m_toplevel) - QWaylandXdgToplevelV6Private::get(m_toplevel)->handleFocusReceived(); -} - -QRect QWaylandXdgSurfaceV6Private::calculateFallbackWindowGeometry() const -{ - // TODO: The unset window geometry should include subsurfaces as well, so this solution - // won't work too well on those kinds of clients. - return QRect(QPoint(), m_surface->destinationSize()); -} - -void QWaylandXdgSurfaceV6Private::updateFallbackWindowGeometry() -{ - Q_Q(QWaylandXdgSurfaceV6); - if (!m_unsetWindowGeometry) - return; - - const QRect unsetGeometry = calculateFallbackWindowGeometry(); - if (unsetGeometry == m_windowGeometry) - return; - - m_windowGeometry = unsetGeometry; - emit q->windowGeometryChanged(); -} - -void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_destroy_resource(QtWaylandServer::zxdg_surface_v6::Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgSurfaceV6); - QWaylandXdgShellV6Private::get(m_xdgShell)->unregisterXdgSurface(q); - delete q; -} - -void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_destroy(QtWaylandServer::zxdg_surface_v6::Resource *resource) -{ - wl_resource_destroy(resource->handle); -} - -void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_get_toplevel(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id) -{ - Q_Q(QWaylandXdgSurfaceV6); - - if (m_toplevel || m_popup) { - wl_resource_post_error(resource->handle, ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED, - "zxdg_surface_v6 already has a role object"); - return; - } - - if (!m_surface->setRole(QWaylandXdgToplevelV6::role(), resource->handle, ZXDG_SHELL_V6_ERROR_ROLE)) - return; - - QWaylandResource topLevelResource(wl_resource_create(resource->client(), &zxdg_toplevel_v6_interface, - wl_resource_get_version(resource->handle), id)); - - m_toplevel = new QWaylandXdgToplevelV6(q, topLevelResource); - emit q->toplevelCreated(); - emit m_xdgShell->toplevelCreated(m_toplevel, q); -} - -void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_get_popup(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t id, wl_resource *parentResource, wl_resource *positionerResource) -{ - Q_Q(QWaylandXdgSurfaceV6); - - if (m_toplevel || m_popup) { - wl_resource_post_error(resource->handle, ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED, - "zxdg_surface_v6 already has a role object"); - return; - } - - QWaylandXdgSurfaceV6 *parent = QWaylandXdgSurfaceV6::fromResource(parentResource); - if (!parent) { - wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POPUP_PARENT, - "zxdg_surface_v6.get_popup with invalid popup parent"); - return; - } - - QWaylandXdgPositionerV6 *positioner = QWaylandXdgPositionerV6::fromResource(positionerResource); - if (!positioner) { - wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER, - "zxdg_surface_v6.get_popup without positioner"); - return; - } - - if (!positioner->m_data.isComplete()) { - QWaylandXdgPositionerV6Data p = positioner->m_data; - wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER, - "zxdg_surface_v6.get_popup with invalid positioner (size: %dx%d, anchorRect: %dx%d)", - p.size.width(), p.size.height(), p.anchorRect.width(), p.anchorRect.height()); - return; - } - - QRect anchorBounds(QPoint(0, 0), parent->windowGeometry().size()); - if (!anchorBounds.contains(positioner->m_data.anchorRect)) { - // TODO: this is a protocol error and should ideally be handled like this: - //wl_resource_post_error(resource->handle, ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER, - // "zxdg_positioner_v6 anchor rect extends beyound its parent's window geometry"); - //return; - // However, our own clients currently do this, so we'll settle for a gentle warning instead. - qCWarning(qLcWaylandCompositor) << "Ignoring client protocol error: zxdg_positioner_v6 anchor" - << "rect extends beyond its parent's window geometry"; - } - - if (!m_surface->setRole(QWaylandXdgPopupV6::role(), resource->handle, ZXDG_SHELL_V6_ERROR_ROLE)) - return; - - QWaylandResource popupResource(wl_resource_create(resource->client(), &zxdg_popup_v6_interface, - wl_resource_get_version(resource->handle), id)); - - m_popup = new QWaylandXdgPopupV6(q, parent, positioner, popupResource); - emit q->popupCreated(); - emit m_xdgShell->popupCreated(m_popup, q); -} - -void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_ack_configure(QtWaylandServer::zxdg_surface_v6::Resource *resource, uint32_t serial) -{ - if (m_toplevel) { - QWaylandXdgToplevelV6Private::get(m_toplevel)->handleAckConfigure(serial); - } else if (m_popup) { - QWaylandXdgPopupV6Private::get(m_popup)->handleAckConfigure(serial); - } else { - wl_resource_post_error(resource->handle, ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED, - "ack_configure requested on an unconstructed zxdg_surface_v6"); - } -} - -void QWaylandXdgSurfaceV6Private::zxdg_surface_v6_set_window_geometry(QtWaylandServer::zxdg_surface_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) -{ - Q_Q(QWaylandXdgSurfaceV6); - - if (!q->surface()->role()) { - wl_resource_post_error(resource->handle, ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED, - "set_window_geometry requested on an unconstructed zxdg_surface_v6"); - return; - } - - if (width <= 0 || height <= 0) { - // The protocol spec says "setting an invalid size will raise an error". But doesn't tell - // which error to raise, and there's no fitting error in the zxdg_surface_v6_error enum. - // So until this is fixed, just output a warning and return. - qWarning() << "Invalid (non-positive) dimensions received in set_window_geometry"; - return; - } - - m_unsetWindowGeometry = false; - - QRect geometry(x, y, width, height); - - if (m_windowGeometry == geometry) - return; - - m_windowGeometry = geometry; - emit q->windowGeometryChanged(); -} - -/*! - * \qmltype XdgSurfaceV6 - * \inqmlmodule QtWayland.Compositor - * \since 5.10 - * \obsolete - * \brief XdgSurfaceV6 provides desktop-style compositor-specific features to an xdg surface. - * - * This type is part of the \l{XdgShellV6} extension and provides a way to - * extend the functionality of an existing \l{WaylandSurface} with features - * specific to desktop-style compositors, such as resizing and moving the - * surface. - * - * It corresponds to the Wayland interface \c zxdg_surface_v6. - */ - -/*! - * \class QWaylandXdgSurfaceV6 - * \inmodule QtWaylandCompositor - * \since 5.10 - * \obsolete - * \brief The QWaylandXdgSurfaceV6 class provides desktop-style compositor-specific features to an xdg surface. - * - * This class is part of the QWaylandXdgShellV6 extension and provides a way to - * extend the functionality of an existing QWaylandSurface with features - * specific to desktop-style compositors, such as resizing and moving the - * surface. - * - * It corresponds to the Wayland interface \c zxdg_surface_v6. - */ - -/*! - * Constructs a QWaylandXdgSurfaceV6. - */ -QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6() - : QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV6>(*new QWaylandXdgSurfaceV6Private) -{ -} - -/*! - * Constructs a QWaylandXdgSurfaceV6 for \a surface and initializes it with the - * given \a xdgShell, \a surface, and resource \a res. - */ -QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *xdgShell, QWaylandSurface *surface, const QWaylandResource &res) - : QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV6>(*new QWaylandXdgSurfaceV6Private) -{ - initialize(xdgShell, surface, res); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgSurfaceV6::initialize(object xdgShell, object surface, object client, int id) - * - * Initializes the XdgSurface, associating it with the given \a xdgShell, \a surface, - * \a client, and \a id. - */ - -/*! - * Initializes the QWaylandXdgSurfaceV6, associating it with the given \a xdgShell, \a surface - * and \a resource. - */ -void QWaylandXdgSurfaceV6::initialize(QWaylandXdgShellV6 *xdgShell, QWaylandSurface *surface, const QWaylandResource &resource) -{ - Q_D(QWaylandXdgSurfaceV6); - d->m_xdgShell = xdgShell; - d->m_surface = surface; - d->init(resource.resource()); - setExtensionContainer(surface); - d->m_windowGeometry = d->calculateFallbackWindowGeometry(); - connect(surface, &QWaylandSurface::destinationSizeChanged, this, &QWaylandXdgSurfaceV6::handleSurfaceSizeChanged); - connect(surface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandXdgSurfaceV6::handleBufferScaleChanged); - emit shellChanged(); - emit surfaceChanged(); - QWaylandCompositorExtension::initialize(); -} - -/*! - * \qmlproperty enum QtWaylandCompositor::XdgSurfaceV6::windowType - * - * This property holds the window type of the XdgSurfaceV6. - */ -Qt::WindowType QWaylandXdgSurfaceV6::windowType() const -{ - Q_D(const QWaylandXdgSurfaceV6); - return d->m_windowType; -} - -/*! - * \qmlproperty rect QtWaylandCompositor::XdgSurfaceV6::windowGeometry - * - * This property holds the window geometry of the QWaylandXdgSurfaceV6. The window - * geometry describes the window's visible bounds from the user's perspective. - * The geometry includes title bars and borders if drawn by the client, but - * excludes drop shadows. It is meant to be used for aligning and tiling - * windows. - */ - -/*! - * \property QWaylandXdgSurfaceV6::windowGeometry - * - * This property holds the window geometry of the QWaylandXdgSurfaceV6. The window - * geometry describes the window's visible bounds from the user's perspective. - * The geometry includes title bars and borders if drawn by the client, but - * excludes drop shadows. It is meant to be used for aligning and tiling - * windows. - */ -QRect QWaylandXdgSurfaceV6::windowGeometry() const -{ - Q_D(const QWaylandXdgSurfaceV6); - return d->m_windowGeometry; -} - -/*! - * \internal - */ -void QWaylandXdgSurfaceV6::initialize() -{ - QWaylandCompositorExtension::initialize(); -} - -void QWaylandXdgSurfaceV6::handleSurfaceSizeChanged() -{ - Q_D(QWaylandXdgSurfaceV6); - d->updateFallbackWindowGeometry(); -} - -void QWaylandXdgSurfaceV6::handleBufferScaleChanged() -{ - Q_D(QWaylandXdgSurfaceV6); - d->updateFallbackWindowGeometry(); -} - -/*! - * \qmlproperty XdgShellV6 QtWaylandCompositor::XdgSurfaceV6::shell - * - * This property holds the shell associated with this XdgSurface. - */ - -/*! - * \property QWaylandXdgSurfaceV6::shell - * - * This property holds the shell associated with this QWaylandXdgSurfaceV6. - */ -QWaylandXdgShellV6 *QWaylandXdgSurfaceV6::shell() const -{ - Q_D(const QWaylandXdgSurfaceV6); - return d->m_xdgShell; -} - -/*! - * \qmlproperty WaylandSurface QtWaylandCompositor::XdgSurfaceV6::surface - * - * This property holds the surface associated with this XdgSurfaceV6. - */ - -/*! - * \property QWaylandXdgSurfaceV6::surface - * - * This property holds the surface associated with this QWaylandXdgSurfaceV6. - */ -QWaylandSurface *QWaylandXdgSurfaceV6::surface() const -{ - Q_D(const QWaylandXdgSurfaceV6); - return d->m_surface; -} - -/*! - * \qmlproperty XdgToplevelV6 QtWaylandCompositor::XdgSurfaceV6::toplevel - * - * This property holds the properties and methods that are specific to the - * toplevel XdgSurfaceV6. - * - * \sa popup, XdgShellV6::toplevelCreated - */ - -/*! - * \property QWaylandXdgSurfaceV6::toplevel - * - * This property holds the properties and methods that are specific to the - * toplevel QWaylandXdgSurfaceV6. - * - * \sa QWaylandXdgSurfaceV6::popup, QWaylandXdgShellV6::toplevelCreated - */ -QWaylandXdgToplevelV6 *QWaylandXdgSurfaceV6::toplevel() const -{ - Q_D(const QWaylandXdgSurfaceV6); - return d->m_toplevel; -} - -/*! - * \qmlproperty XdgPopupV6 QtWaylandCompositor::XdgSurfaceV6::popup - * - * This property holds the properties and methods that are specific to the - * popup XdgSurfaceV6. - * - * \sa toplevel, XdgShellV6::popupCreated - */ - -/*! - * \property QWaylandXdgSurfaceV6::popup - * - * This property holds the properties and methods that are specific to the - * popup QWaylandXdgSurfaceV6. - * - * \sa QWaylandXdgSurfaceV6::toplevel, QWaylandXdgShellV6::popupCreated - */ -QWaylandXdgPopupV6 *QWaylandXdgSurfaceV6::popup() const -{ - Q_D(const QWaylandXdgSurfaceV6); - return d->m_popup; -} - -/*! - * Returns the Wayland interface for the QWaylandXdgSurfaceV6. - */ -const wl_interface *QWaylandXdgSurfaceV6::interface() -{ - return QWaylandXdgSurfaceV6Private::interface(); -} - -/*! - * \internal - */ -QByteArray QWaylandXdgSurfaceV6::interfaceName() -{ - return QWaylandXdgSurfaceV6Private::interfaceName(); -} - -/*! - * Returns the QWaylandXdgSurfaceV6 corresponding to the \a resource. - */ -QWaylandXdgSurfaceV6 *QWaylandXdgSurfaceV6::fromResource(wl_resource *resource) -{ - if (auto p = QtWayland::fromResource<QWaylandXdgSurfaceV6Private *>(resource)) - return p->q_func(); - return nullptr; -} - -#if QT_CONFIG(wayland_compositor_quick) -QWaylandQuickShellIntegration *QWaylandXdgSurfaceV6::createIntegration(QWaylandQuickShellSurfaceItem *item) -{ - Q_D(const QWaylandXdgSurfaceV6); - - if (d->m_toplevel) - return new QtWayland::XdgToplevelV6Integration(item); - - if (d->m_popup) - return new QtWayland::XdgPopupV6Integration(item); - - return nullptr; -} -#endif - -/*! - * \qmltype XdgToplevelV6 - * \inqmlmodule QtWayland.Compositor - * \since 5.10 - * \obsolete - * \brief XdgToplevelV6 represents the toplevel window specific parts of an xdg surface. - * - * This type is part of the \l{XdgShellV6} extension and provides a way to - * extend the functionality of an XdgSurfaceV6 with features - * specific to desktop-style windows. - * - * It corresponds to the Wayland interface \c zxdg_toplevel_v6. - */ - -/*! - * \class QWaylandXdgToplevelV6 - * \inmodule QtWaylandCompositor - * \since 5.10 - * \obsolete - * \brief The QWaylandXdgToplevelV6 class represents the toplevel window specific parts of an xdg surface. - * - * This class is part of the QWaylandXdgShellV6 extension and provides a way to - * extend the functionality of an QWaylandXdgSurfaceV6 with features - * specific to desktop-style windows. - * - * It corresponds to the Wayland interface \c zxdg_toplevel_v6. - */ - -/*! - * Constructs a QWaylandXdgToplevelV6 for the given \a xdgSurface and \a resource. - */ -QWaylandXdgToplevelV6::QWaylandXdgToplevelV6(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandResource &resource) - : QObject(*new QWaylandXdgToplevelV6Private(xdgSurface, resource)) -{ - QList<QWaylandXdgToplevelV6::State> states; - sendConfigure({0, 0}, states); -} - -/*! - * \qmlproperty XdgToplevelV6 QtWaylandCompositor::XdgToplevelV6::parentToplevel - * - * This property holds the XdgToplevelV6 parent of this XdgToplevelV6. - */ - -/*! - * \property QWaylandXdgToplevelV6::parentToplevel - * - * This property holds the XdgToplevelV6 parent of this XdgToplevelV6. - * - */ -QWaylandXdgToplevelV6 *QWaylandXdgToplevelV6::parentToplevel() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_parentToplevel; -} - -/*! - * \qmlproperty string QtWaylandCompositor::XdgToplevelV6::title - * - * This property holds the title of the XdgToplevelV6. - */ - -/*! - * \property QWaylandXdgToplevelV6::title - * - * This property holds the title of the QWaylandXdgToplevelV6. - */ -QString QWaylandXdgToplevelV6::title() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_title; -} - -/*! - * \qmlproperty string QtWaylandCompositor::XdgToplevelV6::appId - * - * This property holds the app id of the XdgToplevelV6. - */ - -/*! - * \property QWaylandXdgToplevelV6::appId - * - * This property holds the app id of the QWaylandXdgToplevelV6. - */ -QString QWaylandXdgToplevelV6::appId() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_appId; -} - -/*! - * \qmlproperty size QtWaylandCompositor::XdgToplevelV6::maxSize - * - * This property holds the maximum size of the XdgToplevelV6 as requested by the client. - * - * The compositor is free to ignore this value and request a larger size. - */ - -/*! - * \property QWaylandXdgToplevelV6::maxSize - * - * This property holds the maximum size of the QWaylandXdgToplevelV6. - * - * The compositor is free to ignore this value and request a larger size. - */ -QSize QWaylandXdgToplevelV6::maxSize() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_maxSize; -} - -/*! - * \qmlproperty size QtWaylandCompositor::XdgToplevelV6::minSize - * - * This property holds the minimum size of the XdgToplevelV6 as requested by the client. - * - * The compositor is free to ignore this value and request a smaller size. - */ - -/*! - * \property QWaylandXdgToplevelV6::minSize - * - * This property holds the minimum size of the QWaylandXdgToplevelV6. - * - * The compositor is free to ignore this value and request a smaller size. - */ -QSize QWaylandXdgToplevelV6::minSize() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_minSize; -} - -/*! - * \property QWaylandXdgToplevelV6::states - * - * This property holds the last states the client acknowledged for this QWaylandToplevelV6. - */ -QList<QWaylandXdgToplevelV6::State> QWaylandXdgToplevelV6::states() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_lastAckedConfigure.states; -} - -/*! - * \qmlproperty bool QtWaylandCompositor::XdgToplevelV6::maximized - * - * This property holds whether the client has acknowledged that it should be maximized. - */ - -/*! - * \property QWaylandXdgToplevelV6::maximized - * - * This property holds whether the client has acknowledged that it should be maximized. - */ -bool QWaylandXdgToplevelV6::maximized() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevelV6::State::MaximizedState); -} - -/*! - * \qmlproperty bool QtWaylandCompositor::XdgToplevelV6::fullscreen - * - * This property holds whether the client has acknowledged that it should be fullscreen. - */ - -/*! - * \property QWaylandXdgToplevelV6::fullscreen - * - * This property holds whether the client has acknowledged that it should be fullscreen. - */ -bool QWaylandXdgToplevelV6::fullscreen() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevelV6::State::FullscreenState); -} - -/*! - * \qmlproperty bool QtWaylandCompositor::XdgToplevelV6::resizing - * - * This property holds whether the client has acknowledged that it is being resized. - */ - -/*! - * \property QWaylandXdgToplevelV6::resizing - * - * This property holds whether the client has acknowledged that it is being resized. - */ -bool QWaylandXdgToplevelV6::resizing() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevelV6::State::ResizingState); -} - -/*! - * \qmlproperty bool QtWaylandCompositor::XdgToplevelV6::activated - * - * This property holds whether toplevel is drawing itself as having input focus. - */ - -/*! - * \property QWaylandXdgToplevelV6::activated - * - * This property holds whether toplevel is drawing itself as having input focus. - */ -bool QWaylandXdgToplevelV6::activated() const -{ - Q_D(const QWaylandXdgToplevelV6); - return d->m_lastAckedConfigure.states.contains(QWaylandXdgToplevelV6::State::ActivatedState); -} - -/*! - * \qmlmethod size QtWaylandCompositor::XdgToplevelV6::sizeForResize(size size, point delta, uint edges) - * - * Convenience for computing the new size given the current \a size, a \a delta, and - * the \a edges active in the drag. - */ - -/*! - * Convenience for computing the new size given the current \a size, a \a delta, and - * the \a edges active in the drag. - */ -QSize QWaylandXdgToplevelV6::sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const -{ - qreal width = size.width(); - qreal height = size.height(); - if (edges & Qt::LeftEdge) - width -= delta.x(); - else if (edges & Qt::RightEdge) - width += delta.x(); - - if (edges & Qt::TopEdge) - height -= delta.y(); - else if (edges & Qt::BottomEdge) - height += delta.y(); - - QSize newSize = QSize(width, height) - .expandedTo(minSize()) - .expandedTo({1, 1}); // We don't want to send a size of (0,0) as that means that the client decides - - if (maxSize().isValid()) - newSize = newSize.boundedTo(maxSize()); - - return newSize; -} - -/*! - * Sends a configure event to the client. Parameter \a size contains the pixel size - * of the surface. A size of zero means the client is free to decide the size. - * Known \a states are enumerated in QWaylandXdgToplevelV6::State. - */ -uint QWaylandXdgToplevelV6::sendConfigure(const QSize &size, const QList<QWaylandXdgToplevelV6::State> &states) -{ - if (!size.isValid()) { - qWarning() << "Can't configure zxdg_toplevel_v6 with an invalid size" << size; - return 0; - } - Q_D(QWaylandXdgToplevelV6); - auto statesBytes = QByteArray::fromRawData(reinterpret_cast<const char *>(states.data()), - states.size() * static_cast<int>(sizeof(State))); - uint32_t serial = d->m_xdgSurface->surface()->compositor()->nextSerial(); - d->m_pendingConfigures.append(QWaylandXdgToplevelV6Private::ConfigureEvent{states, size, serial}); - d->send_configure(size.width(), size.height(), statesBytes); - QWaylandXdgSurfaceV6Private::get(d->m_xdgSurface)->send_configure(serial); - return serial; -} - -/*! - * \qmlmethod int QtWaylandCompositor::XdgToplevelV6::sendConfigure(size size, list<int> states) - * - * Sends a configure event to the client. \a size contains the pixel size of the surface. - * A size of zero means the client is free to decide the size. - * Known \a states are enumerated in XdgToplevelV6::State. - */ -uint QWaylandXdgToplevelV6::sendConfigure(const QSize &size, const QList<int> &states) -{ - QList<State> s; - for (auto state : states) - s << State(state); - return sendConfigure(size, s); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendClose() - * - * Sends a close event to the client. The client may choose to ignore the event. - */ - -/*! - * Sends a close event to the client. The client may choose to ignore the event. - */ -void QWaylandXdgToplevelV6::sendClose() -{ - Q_D(QWaylandXdgToplevelV6); - d->send_close(); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendMaximized(size size) - * - * Convenience for sending a configure event with the maximized state set, and - * fullscreen and resizing removed. The activated state is left in its current state. - * - * \a size is the new size of the window. - */ - -/*! - * Convenience for sending a configure event with the maximized state set, and - * fullscreen and resizing removed. The activated state is left in its current state. - * - * \a size is the new size of the window. - */ -uint QWaylandXdgToplevelV6::sendMaximized(const QSize &size) -{ - Q_D(QWaylandXdgToplevelV6); - QWaylandXdgToplevelV6Private::ConfigureEvent conf = d->lastSentConfigure(); - - if (!conf.states.contains(QWaylandXdgToplevelV6::State::MaximizedState)) - conf.states.append(QWaylandXdgToplevelV6::State::MaximizedState); - conf.states.removeOne(QWaylandXdgToplevelV6::State::FullscreenState); - conf.states.removeOne(QWaylandXdgToplevelV6::State::ResizingState); - - return sendConfigure(size, conf.states); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendUnmaximized(size size) - * - * Convenience for sending a configure event with the maximized, fullscreen and - * resizing states removed, and fullscreen and resizing removed. The activated - * state is left in its current state. - * - * \a size is the new size of the window. If \a size is zero, the client decides the size. - */ - -/*! - * Convenience for sending a configure event with the maximized, fullscreen and - * resizing states removed, and fullscreen and resizing removed. The activated - * state is left in its current state. - * - * \a size is the new size of the window. If \a size is zero, the client decides the size. - */ -uint QWaylandXdgToplevelV6::sendUnmaximized(const QSize &size) -{ - Q_D(QWaylandXdgToplevelV6); - QWaylandXdgToplevelV6Private::ConfigureEvent conf = d->lastSentConfigure(); - - conf.states.removeOne(QWaylandXdgToplevelV6::State::MaximizedState); - conf.states.removeOne(QWaylandXdgToplevelV6::State::FullscreenState); - conf.states.removeOne(QWaylandXdgToplevelV6::State::ResizingState); - - return sendConfigure(size, conf.states); - -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendFullscreen(size size) - * - * Convenience for sending a configure event with the fullscreen state set, and - * maximized and resizing removed. The activated state is left in its current state. - * - * \sa sendUnmaximized - * - * \a size is the new size of the window. - */ - -/*! - * Convenience for sending a configure event with the fullscreen state set, and - * maximized and resizing removed. The activated state is left in its current state. - * - * \sa sendUnmaximized - * - * \a size is the new size of the window. - */ -uint QWaylandXdgToplevelV6::sendFullscreen(const QSize &size) -{ - Q_D(QWaylandXdgToplevelV6); - QWaylandXdgToplevelV6Private::ConfigureEvent conf = d->lastSentConfigure(); - - if (!conf.states.contains(QWaylandXdgToplevelV6::State::FullscreenState)) - conf.states.append(QWaylandXdgToplevelV6::State::FullscreenState); - conf.states.removeOne(QWaylandXdgToplevelV6::State::MaximizedState); - conf.states.removeOne(QWaylandXdgToplevelV6::State::ResizingState); - - return sendConfigure(size, conf.states); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgToplevelV6::sendResizing(size maxSize) - * - * Convenience for sending a configure event with the resizing state set, and - * maximized and fullscreen removed. The activated state is left in its current state. - * - * \a maxSize is the new size of the window. - */ - -/*! - * Convenience for sending a configure event with the resizing state set, and - * maximized and fullscreen removed. The activated state is left in its current state. - * - * \a maxSize is the new size of the window. - */ -uint QWaylandXdgToplevelV6::sendResizing(const QSize &maxSize) -{ - Q_D(QWaylandXdgToplevelV6); - QWaylandXdgToplevelV6Private::ConfigureEvent conf = d->lastSentConfigure(); - - if (!conf.states.contains(QWaylandXdgToplevelV6::State::ResizingState)) - conf.states.append(QWaylandXdgToplevelV6::State::ResizingState); - conf.states.removeOne(QWaylandXdgToplevelV6::State::MaximizedState); - conf.states.removeOne(QWaylandXdgToplevelV6::State::FullscreenState); - - return sendConfigure(maxSize, conf.states); -} - -/*! - * Returns the surface role for the QWaylandToplevelV6. - */ -QWaylandSurfaceRole *QWaylandXdgToplevelV6::role() -{ - return &QWaylandXdgToplevelV6Private::s_role; -} - - -/*! - * \qmlsignal QtWaylandCompositor::XdgShellV6::xdgSurfaceCreated(XdgSurfaceV6 xdgSurface) - * - * This signal is emitted when the client has created a \c zxdg_surface_v6. - * Note that \a xdgSurface is not mapped, i.e. according to the \c xdg-shell - * protocol it should not be displayed, until it has received a role object. - * - * \sa toplevelCreated(), popupCreated() - */ - -/*! - * \fn void QWaylandXdgShellV6::xdgSurfaceCreated(QWaylandXdgSurfaceV6 *xdgSurface) - * - * This signal is emitted when the client has created a \c zxdg_surface_v6. - * Note that \a xdgSurface is not mapped, i.e. according to the \c xdg-shell - * protocol it should not be displayed, until it has received a role object. - * - * \sa toplevelCreated(), popupCreated() - */ - -/*! - * \qmlsignal QtWaylandCompositor::XdgShellV6::toplevelCreated(XdgToplevelV6 toplevel, XdgSurfaceV6 xdgSurface) - * - * This signal is emitted when the client has created a \c zxdg_toplevel_v6. - * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or - * WaylandQuickItem for displaying \a toplevel in a QtQuick scene. - * - * \a xdgSurface is the XdgSurfaceV6 \a toplevel is the role object for. - */ - -/*! - * \fn void QWaylandXdgShellV6::toplevelCreated(QWaylandXdgToplevelV6 *toplevel, QWaylandXdgSurfaceV6 *xdgSurface) - * - * This signal is emitted when the client has created a \c zxdg_toplevel_v6. - * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or - * QWaylandQuickItem for displaying \a toplevel in a QtQuick scene. - * - * \a xdgSurface is the XdgSurfaceV6 \a toplevel is the role object for. - */ - -/*! - * \qmlsignal QtWaylandCompositor::XdgShellV6::popupCreated(XdgPopupV6 popup, XdgSurfaceV6 xdgSurface) - * - * This signal is emitted when the client has created a \c zxdg_popup_v6. - * A common use case is to let the handler of this signal instantiate a ShellSurfaceItem or - * WaylandQuickItem for displaying \a popup in a QtQuick scene. - * - * \a xdgSurface is the XdgSurfaceV6 \a popup is the role object for. - */ - -/*! - * \fn void QWaylandXdgShellV6::popupCreated(QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *xdgSurface) - * - * This signal is emitted when the client has created a \c zxdg_popup_v6. - * A common use case is to let the handler of this signal instantiate a QWaylandShellSurfaceItem or - * QWaylandQuickItem for displaying \a popup in a QtQuick scene. - * - * \a xdgSurface is the XdgSurfaceV6 \a popup is the role object for. - */ - -/*! - * \qmlsignal QtWaylandCompositor::XdgShellV6::pong(int serial) - * - * This signal is emitted when the client has responded to a ping event with serial, \a serial. - * - * \sa ping() - */ - -/*! - * \fn void QWaylandXdgShellV6::pong(uint serial) - * - * This signal is emitted when the client has responded to a ping event with serial, \a serial. - * - * \sa QWaylandXdgShellV6::ping() - */ - -QList<int> QWaylandXdgToplevelV6::statesAsInts() const -{ - QList<int> list; - const auto s = states(); - list.reserve(s.size()); - for (auto state : s) { - list << static_cast<int>(state); - } - return list; -} - -QWaylandSurfaceRole QWaylandXdgToplevelV6Private::s_role("zxdg_toplevel_v6"); - -QWaylandXdgToplevelV6Private::QWaylandXdgToplevelV6Private(QWaylandXdgSurfaceV6 *xdgSurface, const QWaylandResource &resource) - : m_xdgSurface(xdgSurface) -{ - init(resource.resource()); -} - -void QWaylandXdgToplevelV6Private::handleAckConfigure(uint serial) -{ - Q_Q(QWaylandXdgToplevelV6); - ConfigureEvent config; - Q_FOREVER { - if (m_pendingConfigures.empty()) { - qWarning("Toplevel received an unexpected ack_configure!"); - return; - } - - // This won't work unless there always is a toplevel.configure for each xdgsurface.configure - config = m_pendingConfigures.takeFirst(); - - if (config.serial == serial) - break; - } - - QList<uint> changedStates; - std::set_symmetric_difference( - m_lastAckedConfigure.states.begin(), m_lastAckedConfigure.states.end(), - config.states.begin(), config.states.end(), - std::back_inserter(changedStates)); - - m_lastAckedConfigure = config; - - for (uint state : changedStates) { - switch (state) { - case state_maximized: - emit q->maximizedChanged(); - break; - case state_fullscreen: - emit q->fullscreenChanged(); - break; - case state_resizing: - emit q->resizingChanged(); - break; - case state_activated: - emit q->activatedChanged(); - break; - } - } - - if (!changedStates.empty()) - emit q->statesChanged(); -} - -void QWaylandXdgToplevelV6Private::handleFocusLost() -{ - Q_Q(QWaylandXdgToplevelV6); - QWaylandXdgToplevelV6Private::ConfigureEvent current = lastSentConfigure(); - current.states.removeOne(QWaylandXdgToplevelV6::State::ActivatedState); - q->sendConfigure(current.size, current.states); -} - -void QWaylandXdgToplevelV6Private::handleFocusReceived() -{ - Q_Q(QWaylandXdgToplevelV6); - QWaylandXdgToplevelV6Private::ConfigureEvent current = lastSentConfigure(); - if (!current.states.contains(QWaylandXdgToplevelV6::State::ActivatedState)) { - current.states.push_back(QWaylandXdgToplevelV6::State::ActivatedState); - q->sendConfigure(current.size, current.states); - } -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_destroy_resource(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgToplevelV6); - delete q; -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_destroy(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - wl_resource_destroy(resource->handle); - //TODO: Should the xdg surface be desroyed as well? Or is it allowed to recreate a new toplevel for it? -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_parent(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *parent) -{ - Q_UNUSED(resource); - QWaylandXdgToplevelV6 *parentToplevel = nullptr; - if (parent) { - parentToplevel = static_cast<QWaylandXdgToplevelV6Private *>( - QWaylandXdgToplevelV6Private::Resource::fromResource(parent)->zxdg_toplevel_v6_object)->q_func(); - } - - Q_Q(QWaylandXdgToplevelV6); - - if (m_parentToplevel != parentToplevel) { - m_parentToplevel = parentToplevel; - emit q->parentToplevelChanged(); - } - - if (m_parentToplevel && m_xdgSurface->windowType() != Qt::WindowType::SubWindow) { - // There's a parent now, which means the surface is transient - QWaylandXdgSurfaceV6Private::get(m_xdgSurface)->setWindowType(Qt::WindowType::SubWindow); - } else if (!m_parentToplevel && m_xdgSurface->windowType() != Qt::WindowType::Window) { - // When the surface has no parent it is toplevel - QWaylandXdgSurfaceV6Private::get(m_xdgSurface)->setWindowType(Qt::WindowType::Window); - } -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_title(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, const QString &title) -{ - Q_UNUSED(resource); - if (title == m_title) - return; - Q_Q(QWaylandXdgToplevelV6); - m_title = title; - emit q->titleChanged(); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_app_id(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, const QString &app_id) -{ - Q_UNUSED(resource); - if (app_id == m_appId) - return; - Q_Q(QWaylandXdgToplevelV6); - m_appId = app_id; - emit q->appIdChanged(); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_show_window_menu(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *seatResource, uint32_t serial, int32_t x, int32_t y) -{ - Q_UNUSED(resource); - Q_UNUSED(serial); - QPoint position(x, y); - auto seat = QWaylandSeat::fromSeatResource(seatResource); - Q_Q(QWaylandXdgToplevelV6); - emit q->showWindowMenu(seat, position); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_move(Resource *resource, wl_resource *seatResource, uint32_t serial) -{ - Q_UNUSED(resource); - Q_UNUSED(serial); - Q_Q(QWaylandXdgToplevelV6); - QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource); - emit q->startMove(seat); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_resize(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *seatResource, uint32_t serial, uint32_t edges) -{ - Q_UNUSED(resource); - Q_UNUSED(serial); - Q_Q(QWaylandXdgToplevelV6); - QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource); - emit q->startResize(seat, QWaylandXdgShellV6Private::convertToEdges(edges)); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_max_size(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, int32_t width, int32_t height) -{ - Q_UNUSED(resource); - - QSize maxSize(width, height); - if (width == 0 && height == 0) - maxSize = QSize(); // Wayland size of zero means unspecified which best translates to invalid - - if (m_maxSize == maxSize) - return; - - if (width < 0 || height < 0) { - // The spec says raise a protocol error, but there's no matching error defined - qWarning() << "Received a zxdg_toplevel_v6.set_max_size request with a negative size"; - return; - } - - if (m_minSize.isValid() && maxSize.isValid() && - (maxSize.width() < m_minSize.width() || maxSize.height() < m_minSize.height())) { - // The spec says raise a protocol error, but there's no matching error defined - qWarning() << "Received a zxdg_toplevel_v6.set_max_size request with a size smaller than the minimium size"; - return; - } - - m_maxSize = maxSize; - - Q_Q(QWaylandXdgToplevelV6); - emit q->maxSizeChanged(); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_min_size(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, int32_t width, int32_t height) -{ - Q_UNUSED(resource); - - QSize minSize(width, height); - if (width == 0 && height == 0) - minSize = QSize(); // Wayland size of zero means unspecified - - if (m_minSize == minSize) - return; - - if (width < 0 || height < 0) { - // The spec says raise a protocol error, but there's no matching error defined - qWarning() << "Received a zxdg_toplevel_v6.set_min_size request with a negative size"; - return; - } - - if (m_maxSize.isValid() && minSize.isValid() && - (minSize.width() > m_maxSize.width() || minSize.height() > m_maxSize.height())) { - // The spec says raise a protocol error, but there's no matching error defined - qWarning() << "Received a zxdg_toplevel_v6.set_min_size request with a size larger than the maximum size"; - return; - } - - m_minSize = minSize; - - Q_Q(QWaylandXdgToplevelV6); - emit q->minSizeChanged(); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgToplevelV6); - emit q->setMaximized(); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_unset_maximized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgToplevelV6); - emit q->unsetMaximized(); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource, wl_resource *output_res) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgToplevelV6); - QWaylandOutput *output = output_res ? QWaylandOutput::fromResource(output_res) : nullptr; - emit q->setFullscreen(output); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_unset_fullscreen(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgToplevelV6); - emit q->unsetFullscreen(); -} - -void QWaylandXdgToplevelV6Private::zxdg_toplevel_v6_set_minimized(QtWaylandServer::zxdg_toplevel_v6::Resource *resource) -{ - Q_UNUSED(resource); - Q_Q(QWaylandXdgToplevelV6); - emit q->setMinimized(); -} - -/*! - * \qmltype XdgPopupV6 - * \inqmlmodule QtWayland.Compositor - * \since 5.10 - * \obsolete - * \brief XdgPopupV6 represents the popup specific parts of and xdg surface. - * - * This type is part of the \l{XdgShellV6} extension and provides a way to extend - * extend the functionality of an \l{XdgSurfaceV6} with features - * specific to desktop-style menus for an xdg surface. - * - * It corresponds to the Wayland interface \c zxdg_popup_v6. - */ - -/*! - * \class QWaylandXdgPopupV6 - * \inmodule QtWaylandCompositor - * \since 5.10 - * \obsolete - * \brief The QWaylandXdgPopupV6 class represents the popup specific parts of an xdg surface. - * - * This class is part of the QWaylandXdgShellV6 extension and provides a way to - * extend the functionality of a QWaylandXdgSurfaceV6 with features - * specific to desktop-style menus for an xdg surface. - * - * It corresponds to the Wayland interface \c zxdg_popup_v6. - */ - -/*! - * Constructs a QWaylandXdgPopupV6. - */ -QWaylandXdgPopupV6::QWaylandXdgPopupV6(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parentXdgSurface, - QWaylandXdgPositionerV6 *positioner, QWaylandResource &resource) - : QObject(*new QWaylandXdgPopupV6Private(xdgSurface, parentXdgSurface, positioner, resource)) -{ -} - -/*! - * \qmlproperty XdgSurfaceV6 QtWaylandCompositor::XdgPopupV6::xdgSurface - * - * This property holds the XdgSurfaceV6 associated with this XdgPopupV6. - */ - -/*! - * \property QWaylandXdgPopupV6::xdgSurface - * - * This property holds the QWaylandXdgSurfaceV6 associated with this QWaylandXdgPopupV6. - */ -QWaylandXdgSurfaceV6 *QWaylandXdgPopupV6::xdgSurface() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_xdgSurface; -} - -/*! - * \qmlproperty XdgSurfaceV6 QtWaylandCompositor::XdgPopupV6::parentXdgSurface - * - * This property holds the XdgSurfaceV6 associated with the parent of this XdgPopupV6. - */ - -/*! - * \property QWaylandXdgPopupV6::parentXdgSurface - * - * This property holds the QWaylandXdgSurfaceV6 associated with the parent of this - * QWaylandXdgPopupV6. - */ -QWaylandXdgSurfaceV6 *QWaylandXdgPopupV6::parentXdgSurface() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_parentXdgSurface; -} - -/*! - * \qmlproperty rect QtWaylandCompositor::XdgPopupV6::configuredGeometry - * - * The window geometry the popup received in the configure event. Relative to the - * upper left corner of the parent surface. - */ - -/*! - * \property QWaylandXdgPopupV6::configuredGeometry - * - * The window geometry the popup received in the configure event. Relative to the - * upper left corner of the parent surface. - */ -QRect QWaylandXdgPopupV6::configuredGeometry() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_geometry; -} - -/*! - * \qmlproperty rect QtWaylandCompositor::XdgPopupV6::anchorRect - * - * The anchor rectangle relative to the parent window geometry that the child - * surface should be placed relative to. - */ - -/*! - * \property QWaylandXdgPopupV6::anchorRect - * - * Returns the anchor rectangle relative to the parent window geometry that the child - * surface should be placed relative to. - */ -QRect QWaylandXdgPopupV6::anchorRect() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_positionerData.anchorRect; -} - -/*! - * \qmlproperty enumeration QtWaylandCompositor::XdgPopupV6::anchorEdges - * - * This property holds the set of edges on the anchor rect that the child surface should be placed - * relative to. If no edges are specified in a direction, the anchor point should be - * centered between the edges. - * - * The possible values are: - * \value Qt.TopEdge The top edge of the rectangle. - * \value Qt.LeftEdge The left edge of the rectangle. - * \value Qt.RightEdge The right edge of the rectangle. - * \value Qt.BottomEdge The bottom edge of the rectangle. - */ - -/*! - * \property QWaylandXdgPopupV6::anchorEdges - * - * Returns the set of edges on the anchor rect that the child surface should be placed - * relative to. If no edges are specified in a direction, the anchor point should be - * centered between the edges. - */ -Qt::Edges QWaylandXdgPopupV6::anchorEdges() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_positionerData.anchorEdges; -} - -/*! - * \qmlproperty rect QtWaylandCompositor::XdgPopupV6::gravityEdges - * - * Specifies in what direction the surface should be positioned, relative to the anchor - * point. - * - * The possible values are: - * \value Qt.TopEdge The surface should slide towards the top of the screen. - * \value Qt.LeftEdge The surface should slide towards the left of the screen. - * \value Qt.RightEdge The surface should slide towards the right of the screen. - * \value Qt.BottomEdge The surface should slide towards the bottom of the screen. - */ - -/*! - * \property QWaylandXdgPopupV6::gravityEdges - * - * Specifies in what direction the surface should be positioned, relative to the anchor - * point. - */ -Qt::Edges QWaylandXdgPopupV6::gravityEdges() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_positionerData.gravityEdges; -} - -/*! - * \qmlproperty enumeration QtWaylandCompositor::XdgPopupV6::slideConstraints - * - * This property holds the orientations in which the child should slide to fit within the screen. - * - * Possible values: - * \value Qt.Horizontal Horizontal - * \value Qt.Vertical Vertical - */ - -/*! - * \property QWaylandXdgPopupV6::slideConstraints - * - * This property holds the orientations in which the child should slide to fit within the screen. - */ -Qt::Orientations QWaylandXdgPopupV6::slideConstraints() const -{ - Q_D(const QWaylandXdgPopupV6); - const uint flags = d->m_positionerData.constraintAdjustments; - - Qt::Orientations constraints = {}; - - if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X) - constraints |= Qt::Horizontal; - if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y) - constraints |= Qt::Vertical; - - return constraints; -} - -/*! - * \qmlproperty enumeration QtWaylandCompositor::XdgPopupV6::flipConstraints - * - * This property holds the orientations in which the child should flip to fit within the screen. - * - * Possible values: - * \value Qt.Horizontal Horizontal - * \value Qt.Vertical Vertical - */ - -/*! - * \property QWaylandXdgPopupV6::flipConstraints - * - * This property holds the orientations in which the child should flip to fit within the screen. - */ -Qt::Orientations QWaylandXdgPopupV6::flipConstraints() const -{ - Q_D(const QWaylandXdgPopupV6); - const uint flags = d->m_positionerData.constraintAdjustments; - - Qt::Orientations constraints = {}; - - if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X) - constraints |= Qt::Horizontal; - if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y) - constraints |= Qt::Vertical; - - return constraints; -} - -/*! - * \qmlproperty enumeration QtWaylandCompositor::XdgPopupV6::resizeConstraints - * - * This property holds the orientations in which the child should resize to fit within the screen. - * - * Possible values: - * \value Qt.Horizontal Horizontal - * \value Qt.Vertical Vertical - */ - -/*! - * \property QWaylandXdgPopupV6::resizeConstraints - * - * This property holds the orientations in which the child should resize to fit within the screen. - */ -Qt::Orientations QWaylandXdgPopupV6::resizeConstraints() const -{ - Q_D(const QWaylandXdgPopupV6); - const uint flags = d->m_positionerData.constraintAdjustments; - - Qt::Orientations constraints = {}; - - if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X) - constraints |= Qt::Horizontal; - if (flags & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y) - constraints |= Qt::Vertical; - - return constraints; -} - -/*! - * \qmlproperty point QtWaylandCompositor::XdgPopupV6::offset - * - * The position relative to the position of the anchor on the anchor rectangle and - * the anchor on the surface. - */ - -/*! - * \property QWaylandXdgPopupV6::offset - * - * Returns the surface position relative to the position of the anchor on the anchor - * rectangle and the anchor on the surface. - */ -QPoint QWaylandXdgPopupV6::offset() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_positionerData.offset; -} - -/*! - * \qmlproperty size QtWaylandCompositor::XdgPopupV6::positionerSize - * - * The size requested for the window geometry by the positioner object. - */ - -/*! - * \property QWaylandXdgPopupV6::positionerSize - * - * Returns the size requested for the window geometry by the positioner object. - */ -QSize QWaylandXdgPopupV6::positionerSize() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_positionerData.size; -} - -/*! - * \qmlproperty point QtWaylandCompositor::XdgPopupV6::unconstrainedPosition - * - * The position of the surface relative to the parent window geometry if the surface - * is not constrained. I.e. when not moved to fit inside the screen or similar. - */ - -/*! - * \property QWaylandXdgPopupV6::unconstrainedPosition - * - * The position of the surface relative to the parent window geometry if the surface - * is not constrained. I.e. when not moved to fit inside the screen or similar. - */ -QPoint QWaylandXdgPopupV6::unconstrainedPosition() const -{ - Q_D(const QWaylandXdgPopupV6); - return d->m_positionerData.unconstrainedPosition(); -} - -/*! - * \qmlmethod int QtWaylandCompositor::XdgPopupV6::sendConfigure(rect geometry) - * - * Sends a configure event to the client. \a geometry contains the window geometry - * relative to the upper left corner of the window geometry of the parent surface. - * - * This implicitly sends a configure event to the corresponding XdgSurfaceV6 as well. - */ - -/*! - * Sends a configure event to the client. \a geometry contains the window geometry - * relative to the upper left corner of the window geometry of the parent surface. - * - * This implicitly sends a configure event to the corresponding QWaylandXdgSurfaceV6 - * as well. - */ -uint QWaylandXdgPopupV6::sendConfigure(const QRect &geometry) -{ - Q_D(QWaylandXdgPopupV6); - return d->sendConfigure(geometry); -} - -/*! - * \qmlmethod void QtWaylandCompositor::XdgPopupV6::sendPopupDone() - * \since 5.14 - * - * Dismiss the popup. According to the \c xdg-shell-unstable-v6 protocol this should make the - * client destroy the popup. - */ - -/*! - * \since 5.14 - * - * Dismiss the popup. According to the \c xdg-shell-unstable-v6 protocol this should make the - * client destroy the popup. - */ -void QWaylandXdgPopupV6::sendPopupDone() -{ - Q_D(QWaylandXdgPopupV6); - d->send_popup_done(); -} - -/*! - * Returns the surface role for the QWaylandPopupV6. - */ -QWaylandSurfaceRole *QWaylandXdgPopupV6::role() -{ - return &QWaylandXdgPopupV6Private::s_role; -} - -QWaylandXdgPopupV6Private::QWaylandXdgPopupV6Private(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parentXdgSurface, - QWaylandXdgPositionerV6 *positioner, const QWaylandResource &resource) - : m_xdgSurface(xdgSurface) - , m_parentXdgSurface(parentXdgSurface) - , m_positionerData(positioner->m_data) -{ - Q_ASSERT(m_positionerData.isComplete()); - init(resource.resource()); - - QWaylandXdgSurfaceV6Private::get(m_xdgSurface)->setWindowType(Qt::WindowType::Popup); - - //TODO: Need an API for sending a different initial configure - sendConfigure(QRect(m_positionerData.unconstrainedPosition(), m_positionerData.size)); -} - -void QWaylandXdgPopupV6Private::handleAckConfigure(uint serial) -{ - Q_Q(QWaylandXdgPopupV6); - ConfigureEvent config; - Q_FOREVER { - if (m_pendingConfigures.empty()) { - qWarning("Popup received an unexpected ack_configure!"); - return; - } - - // This won't work unless there always is a popup.configure for each xdgsurface.configure - config = m_pendingConfigures.takeFirst(); - - if (config.serial == serial) - break; - } - - if (m_geometry == config.geometry) - return; - - m_geometry = config.geometry; - emit q->configuredGeometryChanged(); -} - -uint QWaylandXdgPopupV6Private::sendConfigure(const QRect &geometry) -{ - uint32_t serial = m_xdgSurface->surface()->compositor()->nextSerial(); - m_pendingConfigures.append(QWaylandXdgPopupV6Private::ConfigureEvent{geometry, serial}); - send_configure(geometry.x(), geometry.y(), geometry.width(), geometry.height()); - QWaylandXdgSurfaceV6Private::get(m_xdgSurface)->send_configure(serial); - return serial; -} - -void QWaylandXdgPopupV6Private::zxdg_popup_v6_destroy(QtWaylandServer::zxdg_popup_v6::Resource *resource) -{ - Q_UNUSED(resource); - qWarning() << Q_FUNC_INFO << "Not implemented"; //TODO -} - -void QWaylandXdgPopupV6Private::zxdg_popup_v6_grab(QtWaylandServer::zxdg_popup_v6::Resource *resource, wl_resource *seat, uint32_t serial) -{ - Q_UNUSED(resource); - Q_UNUSED(serial); - Q_UNUSED(seat); - qWarning() << Q_FUNC_INFO << "Not implemented"; //TODO - //switch keyboard focus - //eventually send configure with activated. -} - -QWaylandSurfaceRole QWaylandXdgPopupV6Private::s_role("zxdg_popup_v6"); - -QWaylandXdgPositionerV6Data::QWaylandXdgPositionerV6Data() - : offset(0, 0) -{} - -bool QWaylandXdgPositionerV6Data::isComplete() const -{ - return size.width() > 0 && size.height() > 0 && anchorRect.size().width() > 0 && anchorRect.size().height() > 0; -} - -QPoint QWaylandXdgPositionerV6Data::anchorPoint() const -{ - int yPosition = 0; - if (anchorEdges & Qt::TopEdge) - yPosition = anchorRect.top(); - else if (anchorEdges & Qt::BottomEdge) - yPosition = anchorRect.bottom() + 1; - else - yPosition = anchorRect.top() + anchorRect.height() / 2; - - int xPosition = 0; - if (anchorEdges & Qt::LeftEdge) - xPosition = anchorRect.left(); - else if (anchorEdges & Qt::RightEdge) - xPosition = anchorRect.right() + 1; - else - xPosition = anchorRect.left() + anchorRect.width() / 2; - - return QPoint(xPosition, yPosition); -} - -QPoint QWaylandXdgPositionerV6Data::unconstrainedPosition() const -{ - int gravityOffsetY = 0; - if (gravityEdges & Qt::TopEdge) - gravityOffsetY = -size.height(); - else if (!(gravityEdges & Qt::BottomEdge)) - gravityOffsetY = -size.height() / 2; - - int gravityOffsetX = 0; - if (gravityEdges & Qt::LeftEdge) - gravityOffsetX = -size.width(); - else if (!(gravityEdges & Qt::RightEdge)) - gravityOffsetX = -size.width() / 2; - - QPoint gravityOffset(gravityOffsetX, gravityOffsetY); - return anchorPoint() + gravityOffset + offset; -} - -QWaylandXdgPositionerV6::QWaylandXdgPositionerV6(const QWaylandResource &resource) -{ - init(resource.resource()); -} - -void QWaylandXdgPositionerV6::zxdg_positioner_v6_destroy_resource(QtWaylandServer::zxdg_positioner_v6::Resource *resource) -{ - Q_UNUSED(resource); - delete this; -} - -void QWaylandXdgPositionerV6::zxdg_positioner_v6_destroy(QtWaylandServer::zxdg_positioner_v6::Resource *resource) -{ - wl_resource_destroy(resource->handle); -} - -void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_size(QtWaylandServer::zxdg_positioner_v6::Resource *resource, int32_t width, int32_t height) -{ - if (width <= 0 || height <= 0) { - wl_resource_post_error(resource->handle, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, - "zxdg_positioner_v6.set_size requested with non-positive dimensions"); - return; - } - - QSize size(width, height); - m_data.size = size; -} - -void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_anchor_rect(QtWaylandServer::zxdg_positioner_v6::Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) -{ - if (width <= 0 || height <= 0) { - wl_resource_post_error(resource->handle, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, - "zxdg_positioner_v6.set_anchor_rect requested with non-positive dimensions"); - return; - } - - QRect anchorRect(x, y, width, height); - m_data.anchorRect = anchorRect; -} - -void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_anchor(QtWaylandServer::zxdg_positioner_v6::Resource *resource, uint32_t anchor) -{ - Qt::Edges anchorEdges = QWaylandXdgShellV6Private::convertToEdges(anchor); - - if ((anchorEdges & Qt::BottomEdge && anchorEdges & Qt::TopEdge) || - (anchorEdges & Qt::LeftEdge && anchorEdges & Qt::RightEdge)) { - wl_resource_post_error(resource->handle, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, - "zxdg_positioner_v6.set_anchor requested with parallel edges"); - return; - } - - m_data.anchorEdges = anchorEdges; -} - -void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_gravity(QtWaylandServer::zxdg_positioner_v6::Resource *resource, uint32_t gravity) -{ - Qt::Edges gravityEdges = QWaylandXdgShellV6Private::convertToEdges(gravity); - - if ((gravityEdges & Qt::BottomEdge && gravityEdges & Qt::TopEdge) || - (gravityEdges & Qt::LeftEdge && gravityEdges & Qt::RightEdge)) { - wl_resource_post_error(resource->handle, ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT, - "zxdg_positioner_v6.set_gravity requested with parallel edges"); - return; - } - - m_data.gravityEdges = gravityEdges; -} - -void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_constraint_adjustment(QtWaylandServer::zxdg_positioner_v6::Resource *resource, uint32_t constraint_adjustment) -{ - Q_UNUSED(resource); - m_data.constraintAdjustments = constraint_adjustment; -} - -void QWaylandXdgPositionerV6::zxdg_positioner_v6_set_offset(QtWaylandServer::zxdg_positioner_v6::Resource *resource, int32_t x, int32_t y) -{ - Q_UNUSED(resource); - m_data.offset = QPoint(x, y); -} - -QWaylandXdgPositionerV6 *QWaylandXdgPositionerV6::fromResource(wl_resource *resource) -{ - return QtWayland::fromResource<QWaylandXdgPositionerV6 *>(resource); -} - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandxdgshellv6.h b/src/compositor/extensions/qwaylandxdgshellv6.h deleted file mode 100644 index 5f355937..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv6.h +++ /dev/null @@ -1,269 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV6_H -#define QWAYLANDXDGSHELLV6_H - -#include <QtWaylandCompositor/QWaylandCompositorExtension> -#include <QtWaylandCompositor/QWaylandResource> -#include <QtWaylandCompositor/QWaylandShell> -#include <QtWaylandCompositor/QWaylandShellSurface> -#include <QtWaylandCompositor/qwaylandquickchildren.h> - -#include <QtCore/QRect> - -struct wl_resource; - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -class QWaylandClient; -class QWaylandOutput; -class QWaylandSeat; -class QWaylandSurface; -class QWaylandSurfaceRole; -class QWaylandXdgShellV6Private; -class QWaylandXdgSurfaceV6; -class QWaylandXdgSurfaceV6Private; -class QWaylandXdgToplevelV6; -class QWaylandXdgToplevelV6Private; -class QWaylandXdgPopupV6; -class QWaylandXdgPopupV6Private; -class QWaylandXdgPositionerV6; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellV6 : public QWaylandShellTemplate<QWaylandXdgShellV6> -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandXdgShellV6) -public: - QWaylandXdgShellV6(); - QWaylandXdgShellV6(QWaylandCompositor *compositor); - - void initialize() override; - - static const struct wl_interface *interface(); - static QByteArray interfaceName(); - -public Q_SLOTS: - uint ping(QWaylandClient *client); - -Q_SIGNALS: - void xdgSurfaceCreated(QWaylandXdgSurfaceV6 *xdgSurface); - void toplevelCreated(QWaylandXdgToplevelV6 *toplevel, QWaylandXdgSurfaceV6 *xdgSurface); - void popupCreated(QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *xdgSurface); - void pong(uint serial); - -private Q_SLOTS: - void handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat); - void handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface); -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV6 : public QWaylandShellSurfaceTemplate<QWaylandXdgSurfaceV6> -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandXdgSurfaceV6) - Q_WAYLAND_COMPOSITOR_DECLARE_QUICK_CHILDREN(QWaylandXdgSurfaceV6) - Q_PROPERTY(QWaylandXdgShellV6 *shell READ shell NOTIFY shellChanged) - Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged) - Q_PROPERTY(QWaylandXdgToplevelV6 *toplevel READ toplevel NOTIFY toplevelCreated) - Q_PROPERTY(QWaylandXdgPopupV6 *popup READ popup NOTIFY popupCreated) - Q_PROPERTY(QRect windowGeometry READ windowGeometry NOTIFY windowGeometryChanged) - Q_MOC_INCLUDE("qwaylandsurface.h") - -public: - QWaylandXdgSurfaceV6(); - QWaylandXdgSurfaceV6(QWaylandXdgShellV6* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource); - - Q_INVOKABLE void initialize(QWaylandXdgShellV6* xdgShell, QWaylandSurface *surface, const QWaylandResource &resource); - - Qt::WindowType windowType() const override; - - QWaylandXdgShellV6 *shell() const; - QWaylandSurface *surface() const; - QWaylandXdgToplevelV6 *toplevel() const; - QWaylandXdgPopupV6 *popup() const; - QRect windowGeometry() const; - - static const struct wl_interface *interface(); - static QByteArray interfaceName(); - static QWaylandXdgSurfaceV6 *fromResource(::wl_resource *resource); - -#if QT_CONFIG(wayland_compositor_quick) - QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) override; -#endif - -Q_SIGNALS: - void shellChanged(); - void surfaceChanged(); - void toplevelCreated(); - void popupCreated(); - void windowGeometryChanged(); - -private: - void initialize() override; - -private Q_SLOTS: - void handleSurfaceSizeChanged(); - void handleBufferScaleChanged(); -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevelV6 : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandXdgToplevelV6) - Q_PROPERTY(QWaylandXdgToplevelV6 *parentToplevel READ parentToplevel NOTIFY parentToplevelChanged) - Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(QString appId READ appId NOTIFY appIdChanged) - Q_PROPERTY(QSize maxSize READ maxSize NOTIFY maxSizeChanged) - Q_PROPERTY(QSize minSize READ minSize NOTIFY minSizeChanged) - Q_PROPERTY(QList<int> states READ statesAsInts NOTIFY statesChanged) - Q_PROPERTY(bool maximized READ maximized NOTIFY maximizedChanged) - Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged) - Q_PROPERTY(bool resizing READ resizing NOTIFY resizingChanged) - Q_PROPERTY(bool activated READ activated NOTIFY activatedChanged) -public: - enum State : uint { - MaximizedState = 1, - FullscreenState = 2, - ResizingState = 3, - ActivatedState = 4 - }; - Q_ENUM(State) - - QWaylandXdgToplevelV6(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandResource &resource); - - QWaylandXdgToplevelV6 *parentToplevel() const; - - QString title() const; - QString appId() const; - QSize maxSize() const; - QSize minSize() const; - QList<QWaylandXdgToplevelV6::State> states() const; - bool maximized() const; - bool fullscreen() const; - bool resizing() const; - bool activated() const; - - Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const; - uint sendConfigure(const QSize &size, const QList<State> &states); - Q_INVOKABLE uint sendConfigure(const QSize &size, const QList<int> &states); - Q_INVOKABLE void sendClose(); - Q_INVOKABLE uint sendMaximized(const QSize &size); - Q_INVOKABLE uint sendUnmaximized(const QSize &size = QSize(0, 0)); - Q_INVOKABLE uint sendFullscreen(const QSize &size); - Q_INVOKABLE uint sendResizing(const QSize &maxSize); - - static QWaylandSurfaceRole *role(); - -Q_SIGNALS: - void parentToplevelChanged(); - void titleChanged(); - void appIdChanged(); - void maxSizeChanged(); - void minSizeChanged(); - void startMove(QWaylandSeat *seat); - void startResize(QWaylandSeat *seat, Qt::Edges edges); - void statesChanged(); - void maximizedChanged(); - void fullscreenChanged(); - void resizingChanged(); - void activatedChanged(); - - void showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition); - void setMaximized(); - void unsetMaximized(); - void setFullscreen(QWaylandOutput *output); - void unsetFullscreen(); - void setMinimized(); - -private: - QList<int> statesAsInts() const; -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV6 : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandXdgPopupV6) - Q_PROPERTY(QWaylandXdgSurfaceV6 *xdgSurface READ xdgSurface CONSTANT) - Q_PROPERTY(QWaylandXdgSurfaceV6 *parentXdgSurface READ parentXdgSurface CONSTANT) - Q_PROPERTY(QRect configuredGeometry READ configuredGeometry NOTIFY configuredGeometryChanged) - - // Positioner properties - Q_PROPERTY(QRect anchorRect READ anchorRect CONSTANT) - Q_PROPERTY(Qt::Edges anchorEdges READ anchorEdges CONSTANT) - Q_PROPERTY(Qt::Edges gravityEdges READ gravityEdges CONSTANT) - Q_PROPERTY(Qt::Orientations slideConstraints READ slideConstraints CONSTANT) - Q_PROPERTY(Qt::Orientations flipConstraints READ flipConstraints CONSTANT) - Q_PROPERTY(Qt::Orientations resizeConstraints READ resizeConstraints CONSTANT) - Q_PROPERTY(QPoint offset READ offset CONSTANT) - Q_PROPERTY(QSize positionerSize READ positionerSize CONSTANT) - Q_PROPERTY(QPoint unconstrainedPosition READ unconstrainedPosition CONSTANT) -public: - QWaylandXdgSurfaceV6 *xdgSurface() const; - QWaylandXdgSurfaceV6 *parentXdgSurface() const; - QRect configuredGeometry() const; - - // Positioner properties - QRect anchorRect() const; - Qt::Edges anchorEdges() const ; - Qt::Edges gravityEdges() const ; - Qt::Orientations slideConstraints() const; - Qt::Orientations flipConstraints() const; - Qt::Orientations resizeConstraints() const; - QPoint offset() const; - QSize positionerSize() const; - QPoint unconstrainedPosition() const; - - Q_INVOKABLE uint sendConfigure(const QRect &geometry); - Q_REVISION(14) Q_INVOKABLE void sendPopupDone(); - - static QWaylandSurfaceRole *role(); - -Q_SIGNALS: - void configuredGeometryChanged(); - -private: - QWaylandXdgPopupV6(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parentXdgSurface, - QWaylandXdgPositionerV6 *positioner, QWaylandResource &resource); - friend class QWaylandXdgSurfaceV6Private; -}; - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE - -#endif // QWAYLANDXDGSHELLV6_H diff --git a/src/compositor/extensions/qwaylandxdgshellv6_p.h b/src/compositor/extensions/qwaylandxdgshellv6_p.h deleted file mode 100644 index b7c96db6..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv6_p.h +++ /dev/null @@ -1,250 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV6_P_H -#define QWAYLANDXDGSHELLV6_P_H - -#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> -#include <QtWaylandCompositor/private/qwaylandshell_p.h> -#include <QtWaylandCompositor/private/qwayland-server-xdg-shell-unstable-v6.h> - -#include <QtWaylandCompositor/QWaylandXdgShellV6> - -#include <QtCore/QSet> - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -struct Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPositionerV6Data { - QSize size; - QRect anchorRect; - Qt::Edges anchorEdges = {}; - Qt::Edges gravityEdges = {}; - uint constraintAdjustments = ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE; - QPoint offset; - QWaylandXdgPositionerV6Data(); - bool isComplete() const; - QPoint anchorPoint() const; - QPoint unconstrainedPosition() const; -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgShellV6Private - : public QWaylandShellPrivate - , public QtWaylandServer::zxdg_shell_v6 -{ - Q_DECLARE_PUBLIC(QWaylandXdgShellV6) -public: - QWaylandXdgShellV6Private(); - void ping(Resource *resource, uint32_t serial); - void registerXdgSurface(QWaylandXdgSurfaceV6 *xdgSurface); - void unregisterXdgSurface(QWaylandXdgSurfaceV6 *xdgSurface); - static QWaylandXdgShellV6Private *get(QWaylandXdgShellV6 *xdgShell) { return xdgShell->d_func(); } - static Qt::Edges convertToEdges(uint xdgEdges); - - QSet<uint32_t> m_pings; - QMultiMap<struct wl_client *, QWaylandXdgSurfaceV6 *> m_xdgSurfaces; - - QWaylandXdgSurfaceV6 *xdgSurfaceFromSurface(QWaylandSurface *surface); - -protected: - void zxdg_shell_v6_destroy(Resource *resource) override; - void zxdg_shell_v6_create_positioner(Resource *resource, uint32_t id) override; - void zxdg_shell_v6_get_xdg_surface(Resource *resource, uint32_t id, - struct ::wl_resource *surface) override; - void zxdg_shell_v6_pong(Resource *resource, uint32_t serial) override; -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgSurfaceV6Private - : public QWaylandCompositorExtensionPrivate - , public QtWaylandServer::zxdg_surface_v6 -{ - Q_DECLARE_PUBLIC(QWaylandXdgSurfaceV6) -public: - QWaylandXdgSurfaceV6Private(); - void setWindowType(Qt::WindowType windowType); - void handleFocusLost(); - void handleFocusReceived(); - static QWaylandXdgSurfaceV6Private *get(QWaylandXdgSurfaceV6 *xdgSurface) { return xdgSurface->d_func(); } - - QRect calculateFallbackWindowGeometry() const; - void updateFallbackWindowGeometry(); - -private: - QWaylandXdgShellV6 *m_xdgShell = nullptr; - QWaylandSurface *m_surface = nullptr; - - QWaylandXdgToplevelV6 *m_toplevel = nullptr; - QWaylandXdgPopupV6 *m_popup = nullptr; - QRect m_windowGeometry; - bool m_unsetWindowGeometry = true; - QMargins m_windowMargins; - Qt::WindowType m_windowType = Qt::WindowType::Window; - - void zxdg_surface_v6_destroy_resource(Resource *resource) override; - void zxdg_surface_v6_destroy(Resource *resource) override; - void zxdg_surface_v6_get_toplevel(Resource *resource, uint32_t id) override; - void zxdg_surface_v6_get_popup(Resource *resource, uint32_t id, struct ::wl_resource *parent, struct ::wl_resource *positioner) override; - void zxdg_surface_v6_ack_configure(Resource *resource, uint32_t serial) override; - void zxdg_surface_v6_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgToplevelV6Private : public QObjectPrivate, public QtWaylandServer::zxdg_toplevel_v6 -{ - Q_DECLARE_PUBLIC(QWaylandXdgToplevelV6) -public: - struct ConfigureEvent { - ConfigureEvent() = default; - ConfigureEvent(const QList<QWaylandXdgToplevelV6::State> - &incomingStates, - const QSize &incomingSize, uint incomingSerial) - : states(incomingStates), size(incomingSize), serial(incomingSerial) - { } - QList<QWaylandXdgToplevelV6::State> states; - QSize size = {0, 0}; - uint serial = 0; - }; - - QWaylandXdgToplevelV6Private(QWaylandXdgSurfaceV6 *xdgSurface, const QWaylandResource& resource); - ConfigureEvent lastSentConfigure() const { return m_pendingConfigures.empty() ? m_lastAckedConfigure : m_pendingConfigures.last(); } - void handleAckConfigure(uint serial); //TODO: move? - void handleFocusLost(); - void handleFocusReceived(); - - static QWaylandXdgToplevelV6Private *get(QWaylandXdgToplevelV6 *toplevel) { return toplevel->d_func(); } - -protected: - - void zxdg_toplevel_v6_destroy_resource(Resource *resource) override; - - void zxdg_toplevel_v6_destroy(Resource *resource) override; - void zxdg_toplevel_v6_set_parent(Resource *resource, struct ::wl_resource *parent) override; - void zxdg_toplevel_v6_set_title(Resource *resource, const QString &title) override; - void zxdg_toplevel_v6_set_app_id(Resource *resource, const QString &app_id) override; - void zxdg_toplevel_v6_show_window_menu(Resource *resource, struct ::wl_resource *seat, uint32_t serial, int32_t x, int32_t y) override; - void zxdg_toplevel_v6_move(Resource *resource, struct ::wl_resource *seatResource, uint32_t serial) override; - void zxdg_toplevel_v6_resize(Resource *resource, struct ::wl_resource *seat, uint32_t serial, uint32_t edges) override; - void zxdg_toplevel_v6_set_max_size(Resource *resource, int32_t width, int32_t height) override; - void zxdg_toplevel_v6_set_min_size(Resource *resource, int32_t width, int32_t height) override; - void zxdg_toplevel_v6_set_maximized(Resource *resource) override; - void zxdg_toplevel_v6_unset_maximized(Resource *resource) override; - void zxdg_toplevel_v6_set_fullscreen(Resource *resource, struct ::wl_resource *output) override; - void zxdg_toplevel_v6_unset_fullscreen(Resource *resource) override; - void zxdg_toplevel_v6_set_minimized(Resource *resource) override; - -public: - QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; - QWaylandXdgToplevelV6 *m_parentToplevel = nullptr; - QList<ConfigureEvent> m_pendingConfigures; - ConfigureEvent m_lastAckedConfigure; - QString m_title; - QString m_appId; - QSize m_maxSize; - QSize m_minSize; - - static QWaylandSurfaceRole s_role; -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPopupV6Private : public QObjectPrivate, public QtWaylandServer::zxdg_popup_v6 -{ - Q_DECLARE_PUBLIC(QWaylandXdgPopupV6) -public: - struct ConfigureEvent { - QRect geometry; - uint serial; - }; - - QWaylandXdgPopupV6Private(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parentXdgSurface, - QWaylandXdgPositionerV6 *positioner, const QWaylandResource& resource); - - void handleAckConfigure(uint serial); - - static QWaylandXdgPopupV6Private *get(QWaylandXdgPopupV6 *popup) { return popup->d_func(); } - - static QWaylandSurfaceRole s_role; - -private: - uint sendConfigure(const QRect &geometry); - -protected: - void zxdg_popup_v6_destroy(Resource *resource) override; - void zxdg_popup_v6_grab(Resource *resource, struct ::wl_resource *seat, uint32_t serial) override; - -private: - QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; - QWaylandXdgSurfaceV6 *m_parentXdgSurface = nullptr; - QWaylandXdgPositionerV6Data m_positionerData; - QRect m_geometry; - QList<ConfigureEvent> m_pendingConfigures; -}; - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandXdgPositionerV6 : public QtWaylandServer::zxdg_positioner_v6 -{ -public: - QWaylandXdgPositionerV6(const QWaylandResource& resource); - static QWaylandXdgPositionerV6 *fromResource(wl_resource *resource); - -protected: - void zxdg_positioner_v6_destroy_resource(Resource *resource) override; //TODO: do something special here? - - void zxdg_positioner_v6_destroy(Resource *resource) override; - void zxdg_positioner_v6_set_size(Resource *resource, int32_t width, int32_t height) override; - void zxdg_positioner_v6_set_anchor_rect(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; - void zxdg_positioner_v6_set_anchor(Resource *resource, uint32_t anchor) override; - void zxdg_positioner_v6_set_gravity(Resource *resource, uint32_t gravity) override; - void zxdg_positioner_v6_set_constraint_adjustment(Resource *resource, uint32_t constraint_adjustment) override; - void zxdg_positioner_v6_set_offset(Resource *resource, int32_t x, int32_t y) override; - -public: - QWaylandXdgPositionerV6Data m_data; -}; - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE - -#endif // QWAYLANDXDGSHELLV6_P_H diff --git a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp b/src/compositor/extensions/qwaylandxdgshellv6integration.cpp deleted file mode 100644 index f4a8a399..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp +++ /dev/null @@ -1,316 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandxdgshellv6integration_p.h" - -#include <QtWaylandCompositor/QWaylandXdgSurfaceV6> -#include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandSeat> - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -namespace QtWayland { - -static void handlePopupCreated(QWaylandQuickShellSurfaceItem *parentItem, QWaylandXdgPopupV6 *popup) -{ - if (parentItem->shellSurface() == popup->parentXdgSurface()) - QWaylandQuickShellSurfaceItemPrivate::get(parentItem)->maybeCreateAutoPopup(popup->xdgSurface()); -} - -XdgToplevelV6Integration::XdgToplevelV6Integration(QWaylandQuickShellSurfaceItem *item) - : QWaylandQuickShellIntegration(item) - , m_item(item) - , m_xdgSurface(qobject_cast<QWaylandXdgSurfaceV6 *>(item->shellSurface())) - , m_toplevel(m_xdgSurface->toplevel()) - , grabberState(GrabberState::Default) -{ - Q_ASSERT(m_toplevel); - - m_item->setSurface(m_xdgSurface->surface()); - - connect(m_toplevel, &QWaylandXdgToplevelV6::startMove, this, &XdgToplevelV6Integration::handleStartMove); - connect(m_toplevel, &QWaylandXdgToplevelV6::startResize, this, &XdgToplevelV6Integration::handleStartResize); - connect(m_toplevel, &QWaylandXdgToplevelV6::setMaximized, this, &XdgToplevelV6Integration::handleSetMaximized); - connect(m_toplevel, &QWaylandXdgToplevelV6::unsetMaximized, this, &XdgToplevelV6Integration::handleUnsetMaximized); - connect(m_toplevel, &QWaylandXdgToplevelV6::maximizedChanged, this, &XdgToplevelV6Integration::handleMaximizedChanged); - connect(m_toplevel, &QWaylandXdgToplevelV6::setFullscreen, this, &XdgToplevelV6Integration::handleSetFullscreen); - connect(m_toplevel, &QWaylandXdgToplevelV6::unsetFullscreen, this, &XdgToplevelV6Integration::handleUnsetFullscreen); - connect(m_toplevel, &QWaylandXdgToplevelV6::fullscreenChanged, this, &XdgToplevelV6Integration::handleFullscreenChanged); - connect(m_toplevel, &QWaylandXdgToplevelV6::activatedChanged, this, &XdgToplevelV6Integration::handleActivatedChanged); - connect(m_xdgSurface->shell(), &QWaylandXdgShellV6::popupCreated, this, [item](QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *){ - handlePopupCreated(item, popup); - }); - connect(m_xdgSurface->surface(), &QWaylandSurface::destinationSizeChanged, this, &XdgToplevelV6Integration::handleSurfaceSizeChanged); - connect(m_toplevel, &QObject::destroyed, this, &XdgToplevelV6Integration::handleToplevelDestroyed); -} - -bool XdgToplevelV6Integration::eventFilter(QObject *object, QEvent *event) -{ - if (event->type() == QEvent::MouseMove) { - QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); - return filterMouseMoveEvent(mouseEvent); - } else if (event->type() == QEvent::MouseButtonRelease) { - QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); - return filterMouseReleaseEvent(mouseEvent); - } - return QWaylandQuickShellIntegration::eventFilter(object, event); -} - -bool XdgToplevelV6Integration::filterMouseMoveEvent(QMouseEvent *event) -{ - if (grabberState == GrabberState::Resize) { - Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event)); - if (!resizeState.initialized) { - resizeState.initialMousePos = event->scenePosition(); - resizeState.initialized = true; - return true; - } - QPointF delta = m_item->mapToSurface(event->scenePosition() - resizeState.initialMousePos); - QSize newSize = m_toplevel->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges); - m_toplevel->sendResizing(newSize); - } else if (grabberState == GrabberState::Move) { - Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event)); - QQuickItem *moveItem = m_item->moveItem(); - if (!moveState.initialized) { - moveState.initialOffset = moveItem->mapFromItem(nullptr, event->scenePosition()); - moveState.initialized = true; - return true; - } - if (!moveItem->parentItem()) - return true; - QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->scenePosition()); - moveItem->setPosition(parentPos - moveState.initialOffset); - } - return false; -} - -bool XdgToplevelV6Integration::filterMouseReleaseEvent(QMouseEvent *event) -{ - Q_UNUSED(event); - - if (grabberState != GrabberState::Default) { - grabberState = GrabberState::Default; - return true; - } - return false; -} - -void XdgToplevelV6Integration::handleStartMove(QWaylandSeat *seat) -{ - grabberState = GrabberState::Move; - moveState.seat = seat; - moveState.initialized = false; -} - -void XdgToplevelV6Integration::handleStartResize(QWaylandSeat *seat, Qt::Edges edges) -{ - grabberState = GrabberState::Resize; - resizeState.seat = seat; - resizeState.resizeEdges = edges; - resizeState.initialWindowSize = m_xdgSurface->windowGeometry().size(); - resizeState.initialPosition = m_item->moveItem()->position(); - resizeState.initialSurfaceSize = m_item->surface()->destinationSize(); - resizeState.initialized = false; -} - -void XdgToplevelV6Integration::handleSetMaximized() -{ - if (!m_item->view()->isPrimary()) - return; - - QList<QWaylandXdgToplevelV6::State> states = m_toplevel->states(); - - if (!states.contains(QWaylandXdgToplevelV6::State::FullscreenState) && !states.contains(QWaylandXdgToplevelV6::State::MaximizedState)) { - windowedGeometry.initialWindowSize = m_xdgSurface->windowGeometry().size(); - windowedGeometry.initialPosition = m_item->moveItem()->position(); - } - - // Any prior output-resize handlers are irrelevant at this point. - disconnect(nonwindowedState.sizeChangedConnection); - nonwindowedState.output = m_item->view()->output(); - nonwindowedState.sizeChangedConnection = connect(nonwindowedState.output, &QWaylandOutput::availableGeometryChanged, this, &XdgToplevelV6Integration::handleMaximizedSizeChanged); - handleMaximizedSizeChanged(); -} - -void XdgToplevelV6Integration::handleMaximizedSizeChanged() -{ - // Insurance against handleToplevelDestroyed() not managing to disconnect this - // handler in time. - if (m_toplevel == nullptr) - return; - - m_toplevel->sendMaximized(nonwindowedState.output->availableGeometry().size() / nonwindowedState.output->scaleFactor()); -} - -void XdgToplevelV6Integration::handleUnsetMaximized() -{ - if (!m_item->view()->isPrimary()) - return; - - // If no prior windowed size was recorded, send a 0x0 configure event - // to allow the client to choose its preferred size. - if (windowedGeometry.initialWindowSize.isValid()) - m_toplevel->sendUnmaximized(windowedGeometry.initialWindowSize); - else - m_toplevel->sendUnmaximized(); -} - -void XdgToplevelV6Integration::handleMaximizedChanged() -{ - if (m_toplevel->maximized()) { - QWaylandOutput *output = m_item->view()->output(); - m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft()); - } else { - m_item->moveItem()->setPosition(windowedGeometry.initialPosition); - } -} - -void XdgToplevelV6Integration::handleSetFullscreen() -{ - if (!m_item->view()->isPrimary()) - return; - - QList<QWaylandXdgToplevelV6::State> states = m_toplevel->states(); - - if (!states.contains(QWaylandXdgToplevelV6::State::FullscreenState) && !states.contains(QWaylandXdgToplevelV6::State::MaximizedState)) { - windowedGeometry.initialWindowSize = m_xdgSurface->windowGeometry().size(); - windowedGeometry.initialPosition = m_item->moveItem()->position(); - } - - // Any prior output-resize handlers are irrelevant at this point. - disconnect(nonwindowedState.sizeChangedConnection); - nonwindowedState.output = m_item->view()->output(); - nonwindowedState.sizeChangedConnection = connect(nonwindowedState.output, &QWaylandOutput::geometryChanged, this, &XdgToplevelV6Integration::handleFullscreenSizeChanged); - handleFullscreenSizeChanged(); -} - -void XdgToplevelV6Integration::handleFullscreenSizeChanged() -{ - // Insurance against handleToplevelDestroyed() not managing to disconnect this - // handler in time. - if (m_toplevel == nullptr) - return; - - m_toplevel->sendFullscreen(nonwindowedState.output->geometry().size() / nonwindowedState.output->scaleFactor()); -} - -void XdgToplevelV6Integration::handleUnsetFullscreen() -{ - if (!m_item->view()->isPrimary()) - return; - - // If no prior windowed size was recorded, send a 0x0 configure event - // to allow the client to choose its preferred size. - if (windowedGeometry.initialWindowSize.isValid()) - m_toplevel->sendUnmaximized(windowedGeometry.initialWindowSize); - else - m_toplevel->sendUnmaximized(); -} - -void XdgToplevelV6Integration::handleFullscreenChanged() -{ - if (m_toplevel->fullscreen()) { - QWaylandOutput *output = m_item->view()->output(); - m_item->moveItem()->setPosition(output->position() + output->geometry().topLeft()); - } else { - m_item->moveItem()->setPosition(windowedGeometry.initialPosition); - } -} - -void XdgToplevelV6Integration::handleActivatedChanged() -{ - if (m_toplevel->activated()) - m_item->raise(); -} - -void XdgToplevelV6Integration::handleSurfaceSizeChanged() -{ - if (grabberState == GrabberState::Resize) { - qreal dx = 0; - qreal dy = 0; - if (resizeState.resizeEdges & Qt::TopEdge) - dy = resizeState.initialSurfaceSize.height() - m_item->surface()->destinationSize().height(); - if (resizeState.resizeEdges & Qt::LeftEdge) - dx = resizeState.initialSurfaceSize.width() - m_item->surface()->destinationSize().width(); - QPointF offset = m_item->mapFromSurface({dx, dy}); - m_item->moveItem()->setPosition(resizeState.initialPosition + offset); - } -} - -void XdgToplevelV6Integration::handleToplevelDestroyed() -{ - // Disarm any handlers that might fire on the now-stale toplevel pointer - nonwindowedState.output = nullptr; - disconnect(nonwindowedState.sizeChangedConnection); -} - -XdgPopupV6Integration::XdgPopupV6Integration(QWaylandQuickShellSurfaceItem *item) - : m_item(item) - , m_xdgSurface(qobject_cast<QWaylandXdgSurfaceV6 *>(item->shellSurface())) - , m_popup(m_xdgSurface->popup()) -{ - Q_ASSERT(m_popup); - - m_item->setSurface(m_xdgSurface->surface()); - handleGeometryChanged(); - - connect(m_popup, &QWaylandXdgPopupV6::configuredGeometryChanged, this, &XdgPopupV6Integration::handleGeometryChanged); - connect(m_xdgSurface->shell(), &QWaylandXdgShellV6::popupCreated, this, [item](QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *){ - handlePopupCreated(item, popup); - }); -} - -void XdgPopupV6Integration::handleGeometryChanged() -{ - if (m_item->view()->output()) { - const QPoint windowOffset = m_popup->parentXdgSurface()->windowGeometry().topLeft(); - const QPoint surfacePosition = m_popup->unconstrainedPosition() + windowOffset; - const QPoint itemPosition = m_item->mapFromSurface(surfacePosition).toPoint(); - //TODO: positioner size or other size...? - //TODO check positioner constraints etc... sliding, flipping - m_item->moveItem()->setPosition(itemPosition); - } else { - qWarning() << "XdgPopupV6Integration popup item without output" << m_item; - } -} - -} - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandxdgshellv6integration_p.h b/src/compositor/extensions/qwaylandxdgshellv6integration_p.h deleted file mode 100644 index 9513362f..00000000 --- a/src/compositor/extensions/qwaylandxdgshellv6integration_p.h +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtWaylandCompositor module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDXDGSHELLV6INTEGRATION_H -#define QWAYLANDXDGSHELLV6INTEGRATION_H - -#include <QtWaylandCompositor/private/qwaylandquickshellsurfaceitem_p.h> -#include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> -#include <QtWaylandCompositor/QWaylandXdgToplevelV6> - -QT_BEGIN_NAMESPACE - -#if QT_DEPRECATED_SINCE(5, 15) - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -class QWaylandXdgSurfaceV6; - -namespace QtWayland { - -class XdgToplevelV6Integration : public QWaylandQuickShellIntegration -{ - Q_OBJECT -public: - XdgToplevelV6Integration(QWaylandQuickShellSurfaceItem *item); - -protected: - bool eventFilter(QObject *object, QEvent *event) override; - -private Q_SLOTS: - void handleStartMove(QWaylandSeat *seat); - void handleStartResize(QWaylandSeat *seat, Qt::Edges edges); - void handleSetMaximized(); - void handleUnsetMaximized(); - void handleMaximizedChanged(); - void handleSetFullscreen(); - void handleUnsetFullscreen(); - void handleFullscreenChanged(); - void handleActivatedChanged(); - void handleSurfaceSizeChanged(); - void handleToplevelDestroyed(); - void handleMaximizedSizeChanged(); - void handleFullscreenSizeChanged(); - -private: - QWaylandQuickShellSurfaceItem *m_item = nullptr; - QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; - QWaylandXdgToplevelV6 *m_toplevel = nullptr; - - enum class GrabberState { - Default, - Resize, - Move - }; - GrabberState grabberState; - - struct { - QWaylandSeat *seat = nullptr; - QPointF initialOffset; - bool initialized = false; - } moveState; - - struct { - QWaylandSeat *seat = nullptr; - Qt::Edges resizeEdges; - QSizeF initialWindowSize; - QPointF initialMousePos; - QPointF initialPosition; - QSize initialSurfaceSize; - bool initialized = false; - } resizeState; - - struct { - QSize initialWindowSize; - QPointF initialPosition; - } windowedGeometry; - - struct { - QWaylandOutput *output = nullptr; - QMetaObject::Connection sizeChangedConnection; // Depending on whether maximized or fullscreen, - // will be hooked to geometry-changed or available- - // geometry-changed. - } nonwindowedState; - - bool filterMouseMoveEvent(QMouseEvent *event); - bool filterMouseReleaseEvent(QMouseEvent *event); -}; - -class XdgPopupV6Integration : public QWaylandQuickShellIntegration -{ - Q_OBJECT -public: - XdgPopupV6Integration(QWaylandQuickShellSurfaceItem *item); - -private Q_SLOTS: - void handleGeometryChanged(); - -private: - QWaylandQuickShellSurfaceItem *m_item = nullptr; - QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr; - QWaylandXdgPopupV6 *m_popup = nullptr; -}; - -} - -#endif // QT_DEPRECATED_SINCE(5, 15) - -QT_END_NAMESPACE - -#endif // QWAYLANDXDGSHELLV6INTEGRATION_H diff --git a/src/imports/compositor/plugins.qmltypes b/src/imports/compositor/plugins.qmltypes index c96e2483..8f062211 100644 --- a/src/imports/compositor/plugins.qmltypes +++ b/src/imports/compositor/plugins.qmltypes @@ -7,7 +7,10 @@ import QtQuick.tooling 1.2 // 'qmlplugindump -nonrelocatable QtWayland.Compositor 1.14' Module { - dependencies: ["QtQuick 2.0", "QtQuick.Window 2.11"] + dependencies: [ + "QtQuick 2.15", + "QtQuick.Window 2.15" + ] Component { name: "QWaylandClient" prototype: "QObject" @@ -293,7 +296,7 @@ Module { "QtWayland.Compositor/WaylandQuickItem 1.0", "QtWayland.Compositor/WaylandQuickItem 1.13" ] - exportMetaObjectRevisions: [0, 13] + exportMetaObjectRevisions: [0, 65293] Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true } Property { name: "surface"; type: "QWaylandSurface"; isPointer: true } Property { name: "paintEnabled"; type: "bool" } @@ -301,7 +304,6 @@ Module { Property { name: "origin"; type: "QWaylandSurface::Origin"; isReadonly: true } Property { name: "inputEventsEnabled"; type: "bool" } Property { name: "focusOnClick"; type: "bool" } - Property { name: "sizeFollowsSurface"; type: "bool" } Property { name: "subsurfaceHandler"; type: "QObject"; isPointer: true } Property { name: "output"; type: "QWaylandOutput"; isPointer: true } Property { name: "bufferLocked"; type: "bool" } @@ -339,7 +341,7 @@ Module { } Method { name: "mapFromSurface" - revision: 13 + revision: 65293 type: "QPointF" Parameter { name: "point"; type: "QPointF" } } @@ -379,10 +381,9 @@ Module { "QtWayland.Compositor/WaylandSurface 1.0", "QtWayland.Compositor/WaylandSurface 1.13" ] - exportMetaObjectRevisions: [0, 13] + exportMetaObjectRevisions: [0, 65293] Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } Property { name: "useTextureAlpha"; type: "bool" } - Property { name: "clientRenderingEnabled"; type: "bool" } } Component { name: "QWaylandQuickXdgOutputV1" @@ -502,16 +503,15 @@ Module { } } Property { name: "client"; type: "QWaylandClient"; isReadonly: true; isPointer: true } - Property { name: "sourceGeometry"; revision: 13; type: "QRectF"; isReadonly: true } - Property { name: "destinationSize"; revision: 13; type: "QSize"; isReadonly: true } - Property { name: "bufferSize"; revision: 13; type: "QSize"; isReadonly: true } - Property { name: "size"; type: "QSize"; isReadonly: true } + Property { name: "sourceGeometry"; revision: 65293; type: "QRectF"; isReadonly: true } + Property { name: "destinationSize"; revision: 65293; type: "QSize"; isReadonly: true } + Property { name: "bufferSize"; revision: 65293; type: "QSize"; isReadonly: true } Property { name: "bufferScale"; type: "int"; isReadonly: true } Property { name: "contentOrientation"; type: "Qt::ScreenOrientation"; isReadonly: true } Property { name: "origin"; type: "QWaylandSurface::Origin"; isReadonly: true } Property { name: "hasContent"; type: "bool"; isReadonly: true } Property { name: "cursorSurface"; type: "bool" } - Property { name: "inhibitsIdle"; revision: 14; type: "bool"; isReadonly: true } + Property { name: "inhibitsIdle"; revision: 65294; type: "bool"; isReadonly: true } Signal { name: "damaged" Parameter { name: "rect"; type: "QRegion" } @@ -525,9 +525,9 @@ Module { name: "childAdded" Parameter { name: "child"; type: "QWaylandSurface"; isPointer: true } } - Signal { name: "sourceGeometryChanged"; revision: 13 } - Signal { name: "destinationSizeChanged"; revision: 13 } - Signal { name: "bufferSizeChanged"; revision: 13 } + Signal { name: "sourceGeometryChanged"; revision: 65293 } + Signal { name: "destinationSizeChanged"; revision: 65293 } + Signal { name: "bufferSizeChanged"; revision: 65293 } Signal { name: "offsetForNextFrame" Parameter { name: "offset"; type: "QPoint" } @@ -549,7 +549,7 @@ Module { name: "dragStarted" Parameter { name: "drag"; type: "QWaylandDrag"; isPointer: true } } - Signal { name: "inhibitsIdleChanged"; revision: 14 } + Signal { name: "inhibitsIdleChanged"; revision: 65294 } Signal { name: "configure" Parameter { name: "hasBuffer"; type: "bool" } @@ -577,15 +577,6 @@ Module { exportMetaObjectRevisions: [0] Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } } - Component { name: "QWaylandWlScaler"; prototype: "QWaylandCompositorExtension" } - Component { - name: "QWaylandWlScalerQuickExtension" - defaultProperty: "data" - prototype: "QWaylandWlScaler" - exports: ["QtWayland.Compositor/WlScaler 1.13"] - exportMetaObjectRevisions: [0] - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - } Component { name: "QWaylandWlShell" prototype: "QWaylandShell" @@ -764,58 +755,7 @@ Module { type: "uint" Parameter { name: "geometry"; type: "QRect" } } - Method { name: "sendPopupDone"; revision: 14 } - } - Component { - name: "QWaylandXdgPopupV5" - defaultProperty: "data" - prototype: "QWaylandShellSurface" - exports: ["QtWayland.Compositor/XdgPopupV5 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - Property { name: "shell"; type: "QWaylandXdgShellV5"; isReadonly: true; isPointer: true } - Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } - Property { name: "parentSurface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } - Property { name: "position"; type: "QPoint"; isReadonly: true } - Method { - name: "initialize" - Parameter { name: "shell"; type: "QWaylandXdgShellV5"; isPointer: true } - Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } - Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true } - Parameter { name: "position"; type: "QPoint" } - Parameter { name: "resource"; type: "QWaylandResource" } - } - Method { name: "sendPopupDone" } - } - Component { - name: "QWaylandXdgPopupV6" - prototype: "QObject" - exports: ["QtWayland.Compositor/XdgPopupV6 1.1"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isReadonly: true; isPointer: true } - Property { - name: "parentXdgSurface" - type: "QWaylandXdgSurfaceV6" - isReadonly: true - isPointer: true - } - Property { name: "configuredGeometry"; type: "QRect"; isReadonly: true } - Property { name: "anchorRect"; type: "QRect"; isReadonly: true } - Property { name: "anchorEdges"; type: "Qt::Edges"; isReadonly: true } - Property { name: "gravityEdges"; type: "Qt::Edges"; isReadonly: true } - Property { name: "slideConstraints"; type: "Qt::Orientations"; isReadonly: true } - Property { name: "flipConstraints"; type: "Qt::Orientations"; isReadonly: true } - Property { name: "resizeConstraints"; type: "Qt::Orientations"; isReadonly: true } - Property { name: "offset"; type: "QPoint"; isReadonly: true } - Property { name: "positionerSize"; type: "QSize"; isReadonly: true } - Property { name: "unconstrainedPosition"; type: "QPoint"; isReadonly: true } - Method { - name: "sendConfigure" - type: "uint" - Parameter { name: "geometry"; type: "QRect" } - } - Method { name: "sendPopupDone"; revision: 14 } + Method { name: "sendPopupDone"; revision: 65294 } } Component { name: "QWaylandXdgShell" @@ -853,87 +793,6 @@ Module { Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } } Component { - name: "QWaylandXdgShellV5" - prototype: "QWaylandShell" - exports: ["QtWayland.Compositor/XdgShellV5Base 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Signal { - name: "xdgSurfaceRequested" - Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } - Parameter { name: "resource"; type: "QWaylandResource" } - } - Signal { - name: "xdgSurfaceCreated" - Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV5"; isPointer: true } - } - Signal { - name: "xdgPopupCreated" - Parameter { name: "xdgPopup"; type: "QWaylandXdgPopupV5"; isPointer: true } - } - Signal { - name: "xdgPopupRequested" - Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } - Parameter { name: "parent"; type: "QWaylandSurface"; isPointer: true } - Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } - Parameter { name: "position"; type: "QPoint" } - Parameter { name: "resource"; type: "QWaylandResource" } - } - Signal { - name: "pong" - Parameter { name: "serial"; type: "uint" } - } - Method { - name: "ping" - type: "uint" - Parameter { name: "client"; type: "QWaylandClient"; isPointer: true } - } - Method { name: "closeAllPopups" } - } - Component { - name: "QWaylandXdgShellV5QuickExtension" - defaultProperty: "data" - prototype: "QWaylandXdgShellV5" - exports: ["QtWayland.Compositor/XdgShellV5 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - } - Component { - name: "QWaylandXdgShellV6" - prototype: "QWaylandShell" - Signal { - name: "xdgSurfaceCreated" - Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true } - } - Signal { - name: "toplevelCreated" - Parameter { name: "toplevel"; type: "QWaylandXdgToplevelV6"; isPointer: true } - Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true } - } - Signal { - name: "popupCreated" - Parameter { name: "popup"; type: "QWaylandXdgPopupV6"; isPointer: true } - Parameter { name: "xdgSurface"; type: "QWaylandXdgSurfaceV6"; isPointer: true } - } - Signal { - name: "pong" - Parameter { name: "serial"; type: "uint" } - } - Method { - name: "ping" - type: "uint" - Parameter { name: "client"; type: "QWaylandClient"; isPointer: true } - } - } - Component { - name: "QWaylandXdgShellV6QuickExtension" - defaultProperty: "data" - prototype: "QWaylandXdgShellV6" - exports: ["QtWayland.Compositor/XdgShellV6 1.1"] - exportMetaObjectRevisions: [0] - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - } - Component { name: "QWaylandXdgSurface" defaultProperty: "data" prototype: "QWaylandShellSurface" @@ -955,149 +814,6 @@ Module { } } Component { - name: "QWaylandXdgSurfaceV5" - defaultProperty: "data" - prototype: "QWaylandShellSurface" - exports: ["QtWayland.Compositor/XdgSurfaceV5 1.0"] - exportMetaObjectRevisions: [0] - Enum { - name: "State" - values: { - "MaximizedState": 1, - "FullscreenState": 2, - "ResizingState": 3, - "ActivatedState": 4 - } - } - Enum { - name: "ResizeEdge" - values: { - "NoneEdge": 0, - "TopEdge": 1, - "BottomEdge": 2, - "LeftEdge": 4, - "TopLeftEdge": 5, - "BottomLeftEdge": 6, - "RightEdge": 8, - "TopRightEdge": 9, - "BottomRightEdge": 10 - } - } - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - Property { name: "shell"; type: "QWaylandXdgShellV5"; isReadonly: true; isPointer: true } - Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } - Property { - name: "parentSurface" - type: "QWaylandXdgSurfaceV5" - isReadonly: true - isPointer: true - } - Property { name: "title"; type: "string"; isReadonly: true } - Property { name: "appId"; type: "string"; isReadonly: true } - Property { name: "windowGeometry"; type: "QRect"; isReadonly: true } - Property { name: "states"; type: "QList<int>"; isReadonly: true } - Property { name: "maximized"; type: "bool"; isReadonly: true } - Property { name: "fullscreen"; type: "bool"; isReadonly: true } - Property { name: "resizing"; type: "bool"; isReadonly: true } - Property { name: "activated"; type: "bool"; isReadonly: true } - Signal { - name: "showWindowMenu" - Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } - Parameter { name: "localSurfacePosition"; type: "QPoint" } - } - Signal { - name: "startMove" - Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } - } - Signal { - name: "startResize" - Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } - Parameter { name: "edges"; type: "ResizeEdge" } - } - Signal { name: "setTopLevel" } - Signal { name: "setTransient" } - Signal { name: "setMaximized" } - Signal { name: "unsetMaximized" } - Signal { - name: "setFullscreen" - Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true } - } - Signal { name: "unsetFullscreen" } - Signal { name: "setMinimized" } - Signal { - name: "ackConfigure" - Parameter { name: "serial"; type: "uint" } - } - Method { - name: "initialize" - Parameter { name: "xdgShell"; type: "QWaylandXdgShellV5"; isPointer: true } - Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } - Parameter { name: "resource"; type: "QWaylandResource" } - } - Method { - name: "sizeForResize" - type: "QSize" - Parameter { name: "size"; type: "QSizeF" } - Parameter { name: "delta"; type: "QPointF" } - Parameter { name: "edge"; type: "ResizeEdge" } - } - Method { - name: "sendConfigure" - type: "uint" - Parameter { name: "size"; type: "QSize" } - Parameter { name: "states"; type: "QList<uint>" } - } - Method { - name: "sendConfigure" - type: "uint" - Parameter { name: "size"; type: "QSize" } - Parameter { name: "states"; type: "QList<State>" } - } - Method { name: "sendClose" } - Method { - name: "sendMaximized" - type: "uint" - Parameter { name: "size"; type: "QSize" } - } - Method { - name: "sendUnmaximized" - type: "uint" - Parameter { name: "size"; type: "QSize" } - } - Method { name: "sendUnmaximized"; type: "uint" } - Method { - name: "sendFullscreen" - type: "uint" - Parameter { name: "size"; type: "QSize" } - } - Method { - name: "sendResizing" - type: "uint" - Parameter { name: "maxSize"; type: "QSize" } - } - } - Component { - name: "QWaylandXdgSurfaceV6" - defaultProperty: "data" - prototype: "QWaylandShellSurface" - exports: ["QtWayland.Compositor/XdgSurfaceV6 1.1"] - exportMetaObjectRevisions: [0] - Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } - Property { name: "shell"; type: "QWaylandXdgShellV6"; isReadonly: true; isPointer: true } - Property { name: "surface"; type: "QWaylandSurface"; isReadonly: true; isPointer: true } - Property { name: "toplevel"; type: "QWaylandXdgToplevelV6"; isReadonly: true; isPointer: true } - Property { name: "popup"; type: "QWaylandXdgPopupV6"; isReadonly: true; isPointer: true } - Property { name: "windowGeometry"; type: "QRect"; isReadonly: true } - Signal { name: "toplevelCreated" } - Signal { name: "popupCreated" } - Method { - name: "initialize" - Parameter { name: "xdgShell"; type: "QWaylandXdgShellV6"; isPointer: true } - Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } - Parameter { name: "resource"; type: "QWaylandResource" } - } - } - Component { name: "QWaylandXdgToplevel" prototype: "QObject" exports: ["QtWayland.Compositor/XdgToplevel 1.3"] @@ -1195,95 +911,7 @@ Module { } } Component { - name: "QWaylandXdgToplevelV6" - prototype: "QObject" - exports: ["QtWayland.Compositor/XdgToplevelV6 1.1"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "State" - values: { - "MaximizedState": 1, - "FullscreenState": 2, - "ResizingState": 3, - "ActivatedState": 4 - } - } - Property { - name: "parentToplevel" - type: "QWaylandXdgToplevelV6" - isReadonly: true - isPointer: true - } - Property { name: "title"; type: "string"; isReadonly: true } - Property { name: "appId"; type: "string"; isReadonly: true } - Property { name: "maxSize"; type: "QSize"; isReadonly: true } - Property { name: "minSize"; type: "QSize"; isReadonly: true } - Property { name: "states"; type: "QList<int>"; isReadonly: true } - Property { name: "maximized"; type: "bool"; isReadonly: true } - Property { name: "fullscreen"; type: "bool"; isReadonly: true } - Property { name: "resizing"; type: "bool"; isReadonly: true } - Property { name: "activated"; type: "bool"; isReadonly: true } - Signal { - name: "startMove" - Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } - } - Signal { - name: "startResize" - Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } - Parameter { name: "edges"; type: "Qt::Edges" } - } - Signal { - name: "showWindowMenu" - Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } - Parameter { name: "localSurfacePosition"; type: "QPoint" } - } - Signal { name: "setMaximized" } - Signal { name: "unsetMaximized" } - Signal { - name: "setFullscreen" - Parameter { name: "output"; type: "QWaylandOutput"; isPointer: true } - } - Signal { name: "unsetFullscreen" } - Signal { name: "setMinimized" } - Method { - name: "sizeForResize" - type: "QSize" - Parameter { name: "size"; type: "QSizeF" } - Parameter { name: "delta"; type: "QPointF" } - Parameter { name: "edges"; type: "Qt::Edges" } - } - Method { - name: "sendConfigure" - type: "uint" - Parameter { name: "size"; type: "QSize" } - Parameter { name: "states"; type: "QList<int>" } - } - Method { name: "sendClose" } - Method { - name: "sendMaximized" - type: "uint" - Parameter { name: "size"; type: "QSize" } - } - Method { - name: "sendUnmaximized" - type: "uint" - Parameter { name: "size"; type: "QSize" } - } - Method { name: "sendUnmaximized"; type: "uint" } - Method { - name: "sendFullscreen" - type: "uint" - Parameter { name: "size"; type: "QSize" } - } - Method { - name: "sendResizing" - type: "uint" - Parameter { name: "maxSize"; type: "QSize" } - } - } - Component { - prototype: "QQuickItem" + prototype: "QWaylandQuickItem" name: "QtWayland.Compositor/WaylandCursorItem 1.0" exports: ["QtWayland.Compositor/WaylandCursorItem 1.0"] exportMetaObjectRevisions: [0] @@ -1292,65 +920,9 @@ Module { Property { name: "seat"; type: "QObject"; isPointer: true } Property { name: "hotspotX"; type: "int" } Property { name: "hotspotY"; type: "int" } - Property { name: "compositor"; type: "QWaylandCompositor"; isReadonly: true; isPointer: true } - Property { name: "surface"; type: "QWaylandSurface"; isPointer: true } - Property { name: "paintEnabled"; type: "bool" } - Property { name: "touchEventsEnabled"; type: "bool" } - Property { name: "origin"; type: "QWaylandSurface::Origin"; isReadonly: true } - Property { name: "inputEventsEnabled"; type: "bool" } - Property { name: "focusOnClick"; type: "bool" } - Property { name: "sizeFollowsSurface"; type: "bool" } - Property { name: "subsurfaceHandler"; type: "QObject"; isPointer: true } - Property { name: "output"; type: "QWaylandOutput"; isPointer: true } - Property { name: "bufferLocked"; type: "bool" } - Property { name: "allowDiscardFrontBuffer"; type: "bool" } - Signal { name: "surfaceDestroyed" } - Signal { - name: "mouseMove" - Parameter { name: "windowPosition"; type: "QPointF" } - } - Signal { name: "mouseRelease" } - Method { - name: "takeFocus" - Parameter { name: "device"; type: "QWaylandSeat"; isPointer: true } - } - Method { name: "takeFocus" } - Method { - name: "setPaintEnabled" - Parameter { name: "paintEnabled"; type: "bool" } - } - Method { name: "raise" } - Method { name: "lower" } - Method { - name: "sendMouseMoveEvent" - Parameter { name: "position"; type: "QPointF" } - Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } - } - Method { - name: "sendMouseMoveEvent" - Parameter { name: "position"; type: "QPointF" } - } - Method { - name: "mapToSurface" - type: "QPointF" - Parameter { name: "point"; type: "QPointF" } - } - Method { - name: "mapFromSurface" - revision: 13 - type: "QPointF" - Parameter { name: "point"; type: "QPointF" } - } - Method { - name: "inputMethodQuery" - type: "QVariant" - Parameter { name: "query"; type: "Qt::InputMethodQuery" } - Parameter { name: "argument"; type: "QVariant" } - } - Method { name: "setPrimary" } } Component { - prototype: "QQuickWindowQmlImpl" + prototype: "QQuickWindow" name: "QtWayland.Compositor/WaylandOutputWindow 1.0" exports: ["QtWayland.Compositor/WaylandOutputWindow 1.0"] exportMetaObjectRevisions: [0] diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp index aa8209f7..de3a34a7 100644 --- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp +++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp @@ -49,11 +49,8 @@ #include <QtWaylandCompositor/QWaylandResource> #include <QtWaylandCompositor/QWaylandQtWindowManager> -#include <QtWaylandCompositor/QWaylandWlScaler> #include <QtWaylandCompositor/QWaylandWlShell> #include <QtWaylandCompositor/QWaylandTextInputManager> -#include <QtWaylandCompositor/QWaylandXdgShellV5> -#include <QtWaylandCompositor/QWaylandXdgShellV6> #include <QtWaylandCompositor/QWaylandXdgShell> #include <QtWaylandCompositor/QWaylandXdgDecorationManagerV1> #include <QtWaylandCompositor/QWaylandIdleInhibitManagerV1> @@ -70,12 +67,7 @@ Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(QWaylandQuickCompositor) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandQtWindowManager) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandIdleInhibitManagerV1) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandIviApplication) -#if QT_DEPRECATED_SINCE(5, 13) -Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWlScaler) -#endif Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWlShell) -Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShellV5) -Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShellV6) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShell) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgDecorationManagerV1) Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgOutputManagerV1) @@ -162,21 +154,8 @@ public: qmlRegisterType<QWaylandWlShellQuickExtension>(uri, 1, 0, "WlShell"); qmlRegisterType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurface"); qmlRegisterType<QWaylandQuickShellSurfaceItem>(uri, 1, 0, "ShellSurfaceItem"); -#if QT_DEPRECATED_SINCE(5, 15) - qmlRegisterUncreatableType<QWaylandXdgShellV5>(uri, 1, 0, "XdgShellV5Base", QObject::tr("Cannot create instance of XdgShellV5Base")); - qmlRegisterType<QWaylandXdgShellV5QuickExtension>(uri, 1, 0, "XdgShellV5"); - qmlRegisterType<QWaylandXdgSurfaceV5>(uri, 1, 0, "XdgSurfaceV5"); - qmlRegisterType<QWaylandXdgPopupV5>(uri, 1, 0, "XdgPopupV5"); -#endif qmlRegisterType<QWaylandTextInputManagerQuickExtension>(uri, 1, 0, "TextInputManager"); -#if QT_DEPRECATED_SINCE(5, 15) - qmlRegisterType<QWaylandXdgShellV6QuickExtension>(uri, 1, 1, "XdgShellV6"); - qmlRegisterType<QWaylandXdgSurfaceV6>(uri, 1, 1, "XdgSurfaceV6"); - qmlRegisterUncreatableType<QWaylandXdgToplevelV6>(uri, 1, 1, "XdgToplevelV6", QObject::tr("Cannot create instance of XdgShellToplevelV6")); - qmlRegisterUncreatableType<QWaylandXdgPopupV6>(uri, 1, 1, "XdgPopupV6", QObject::tr("Cannot create instance of XdgShellPopupV6")); -#endif - qmlRegisterType<QWaylandXdgShellQuickExtension>(uri, 1, 3, "XdgShell"); qmlRegisterType<QWaylandXdgSurface>(uri, 1, 3, "XdgSurface"); qmlRegisterUncreatableType<QWaylandXdgToplevel>(uri, 1, 3, "XdgToplevel", QObject::tr("Cannot create instance of XdgShellToplevel")); @@ -184,10 +163,6 @@ public: qmlRegisterType<QWaylandXdgDecorationManagerV1QuickExtension>(uri, 1, 3, "XdgDecorationManagerV1"); -#if QT_DEPRECATED_SINCE(5, 13) - qmlRegisterType<QWaylandWlScalerQuickExtension>(uri, 1, 13, "WlScaler"); -#endif - qmlRegisterType<QWaylandIdleInhibitManagerV1QuickExtension>(uri, 1, 14, "IdleInhibitManagerV1"); qmlRegisterType<QWaylandXdgOutputManagerV1QuickExtension>(uri, 1, 14, "XdgOutputManagerV1"); diff --git a/sync.profile b/sync.profile index 95ddb557..cab4a252 100644 --- a/sync.profile +++ b/sync.profile @@ -67,7 +67,6 @@ "^qwayland-server-viewporter.h", "^qwayland-server-xdg-decoration-unstable-v1.h", "^qwayland-server-xdg-output-unstable-v1.h", - "^qwayland-server-xdg-shell-unstable-v6.h", "^qwayland-server-xdg-shell.h", "^wayland-hardware-integration-server-protocol.h", "^wayland-idle-inhibit-unstable-v1-server-protocol.h", @@ -84,7 +83,6 @@ "^wayland-xdg-decoration-unstable-v1-server-protocol.h", "^wayland-xdg-output-unstable-v1-server-protocol.h", "^wayland-xdg-shell-server-protocol.h", - "^wayland-xdg-shell-unstable-v6-server-protocol.h", ], "$basedir/src/plugins/hardwareintegration/compositor/linux-dmabuf-unstable-v1" => [ "^qwayland-server-linux-dmabuf-unstable-v1.h", diff --git a/tests/auto/compositor/compositor/tst_compositor.cpp b/tests/auto/compositor/compositor/tst_compositor.cpp index 0904a499..a44aef2f 100644 --- a/tests/auto/compositor/compositor/tst_compositor.cpp +++ b/tests/auto/compositor/compositor/tst_compositor.cpp @@ -40,7 +40,6 @@ #include <QtGui/QScreen> #include <QtWaylandCompositor/QWaylandXdgShell> -#include <QtWaylandCompositor/private/qwaylandxdgshellv6_p.h> #include <QtWaylandCompositor/private/qwaylandkeyboard_p.h> #include <QtWaylandCompositor/QWaylandIviApplication> #include <QtWaylandCompositor/QWaylandIviSurface> @@ -101,9 +100,6 @@ private slots: void sendsIviConfigure(); void destroysIviSurfaces(); - void convertsXdgEdgesToQtEdges(); - void xdgShellV6Positioner(); - void viewporterGlobal(); void viewportDestination(); void viewportSource(); @@ -1320,50 +1316,6 @@ void tst_WaylandCompositor::destroysIviSurfaces() QTRY_VERIFY(destroySpy.count() == 1); } -void tst_WaylandCompositor::convertsXdgEdgesToQtEdges() -{ - const uint wlLeft = ZXDG_POSITIONER_V6_ANCHOR_LEFT; - QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlLeft), Qt::LeftEdge); - - const uint wlRight = ZXDG_POSITIONER_V6_ANCHOR_RIGHT; - QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlRight), Qt::RightEdge); - - const uint wlTop = ZXDG_POSITIONER_V6_ANCHOR_TOP; - QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlTop), Qt::TopEdge); - - const uint wlBottom = ZXDG_POSITIONER_V6_ANCHOR_BOTTOM; - QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlBottom), Qt::BottomEdge); - - QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlBottom | wlLeft), Qt::Edges(Qt::BottomEdge | Qt::LeftEdge)); - QCOMPARE(QWaylandXdgShellV6Private::convertToEdges(wlTop | wlRight), Qt::Edges(Qt::TopEdge | Qt::RightEdge)); -} - -void tst_WaylandCompositor::xdgShellV6Positioner() -{ - QWaylandXdgPositionerV6Data p; - QVERIFY(!p.isComplete()); - - p.size = QSize(100, 50); - p.anchorRect = QRect(QPoint(1, 2), QSize(800, 600)); - QVERIFY(p.isComplete()); - - p.anchorEdges = Qt::TopEdge | Qt::LeftEdge; - p.gravityEdges = Qt::BottomEdge | Qt::RightEdge; - QCOMPARE(p.unconstrainedPosition(), QPoint(1, 2)); - - p.anchorEdges = Qt::RightEdge; - QCOMPARE(p.unconstrainedPosition(), QPoint(1 + 800, 2 + 600 / 2)); - - p.gravityEdges = Qt::BottomEdge; - QCOMPARE(p.unconstrainedPosition(), QPoint(1 + 800 - 100 / 2, 2 + 600 / 2)); - - p.gravityEdges = Qt::TopEdge; - QCOMPARE(p.unconstrainedPosition(), QPoint(1 + 800 - 100 / 2, 2 + 600 / 2 - 50)); - - p.offset = QPoint(4, 8); - QCOMPARE(p.unconstrainedPosition(), QPoint(1 + 800 - 100 / 2 + 4, 2 + 600 / 2 - 50 + 8)); -} - class ViewporterTestCompositor: public TestCompositor { Q_OBJECT public: diff --git a/tests/manual/keymap/keymapcompositor.qml b/tests/manual/keymap/keymapcompositor.qml index 77111c81..87e20cf7 100644 --- a/tests/manual/keymap/keymapcompositor.qml +++ b/tests/manual/keymap/keymapcompositor.qml @@ -91,7 +91,4 @@ WaylandCompositor { WlShell { onWlShellSurfaceCreated: chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } ); } - XdgShellV5 { - onXdgSurfaceCreated: chromeComponent.createObject(surfaceArea, { "shellSurface": xdgSurface } ); - } } diff --git a/tests/manual/wlscaler/CMakeLists.txt b/tests/manual/wlscaler/CMakeLists.txt deleted file mode 100644 index 57984af3..00000000 --- a/tests/manual/wlscaler/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Generated from wlscaler.pro. - -##################################################################### -## wlscaler Binary: -##################################################################### - -qt_add_manual_test(wlscaler - GUI - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Qml -) - -# Resources: -set(qml_resource_files - "main.qml" -) - -qt_add_resource(wlscaler "qml" - PREFIX - "/" - FILES - ${qml_resource_files} -) - - -#### Keys ignored in scope 1:.:.:wlscaler.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/wlscaler/main.cpp b/tests/manual/wlscaler/main.cpp deleted file mode 100644 index b836e378..00000000 --- a/tests/manual/wlscaler/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtGui/QGuiApplication> -#include <QtQml/QQmlApplicationEngine> - -int main(int argc, char* argv[]) -{ - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); - return app.exec(); -} diff --git a/tests/manual/wlscaler/main.qml b/tests/manual/wlscaler/main.qml deleted file mode 100644 index ddadf480..00000000 --- a/tests/manual/wlscaler/main.qml +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 -import QtQuick.Window 2.2 -import QtWayland.Compositor 1.13 - -WaylandCompositor { - id: comp - WaylandOutput { - id: output - compositor: comp - sizeFollowsWindow: true - window: Window { - id: win - width: 500 - height: 500 - visible: true - title: "wlscaler-compositor - " + comp.socketName - Repeater { - model: shellSurfaces - ShellSurfaceItem { - shellSurface: modelData - onSurfaceDestroyed: shellSurfaces.remove(index); - autoCreatePopupItems: true - } - } - } - } - - WlScaler {} - - ListModel { id: shellSurfaces } - - XdgShell { - onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface}); - } - - // Including legacy shell extensions as well, as clients using wl-scaler - // probably use outdated shells as well. - - WlShell { - onWlShellSurfaceCreated: shellSurfaces.append({shellSurface: shellSurface}); - } - - XdgShellV5 { - onXdgSurfaceCreated: shellSurfaces.append({shellSurface: xdgSurface}); - } - - XdgShellV6 { - onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface}); - } -} diff --git a/tests/manual/wlscaler/qml.qrc b/tests/manual/wlscaler/qml.qrc deleted file mode 100644 index 6b2d0a78..00000000 --- a/tests/manual/wlscaler/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>main.qml</file> -</qresource> -</RCC> diff --git a/tests/manual/wlscaler/wlscaler.pro b/tests/manual/wlscaler/wlscaler.pro deleted file mode 100644 index e4ba825f..00000000 --- a/tests/manual/wlscaler/wlscaler.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app - -QT += gui qml - -SOURCES += main.cpp - -RESOURCES += qml.qrc |