Initial commit
This commit is contained in:
		
						commit
						ea3e4b3139
					
				
					 17 changed files with 885 additions and 0 deletions
				
			
		
							
								
								
									
										23
									
								
								src/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
remove_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS)
 | 
			
		||||
 | 
			
		||||
ecm_add_qtwayland_client_protocol(LAYER_SHELL_SOURCES PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml BASENAME xdg-shell)
 | 
			
		||||
ecm_add_qtwayland_client_protocol(LAYER_SHELL_SOURCES PROTOCOL wlr-layer-shell-unstable-v1.xml BASENAME wlr-layer-shell-unstable-v1)
 | 
			
		||||
 | 
			
		||||
add_library(layer-shell SHARED qwaylandlayersurface.cpp qwaylandlayershellintegration.cpp qwaylandlayershell.cpp qwaylandlayershellintegrationplugin.cpp ${LAYER_SHELL_SOURCES})
 | 
			
		||||
target_link_libraries(layer-shell Qt5::WaylandClient Wayland::Client Qt5::XkbCommonSupportPrivate Qt::WaylandClientPrivate)
 | 
			
		||||
target_include_directories(layer-shell PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>/LayerShellQt")
 | 
			
		||||
 | 
			
		||||
add_library(LayerShellQtInterface SHARED interfaces/window.cpp interfaces/shell.cpp)
 | 
			
		||||
target_link_libraries(LayerShellQtInterface PRIVATE layer-shell PUBLIC Qt5::Gui)
 | 
			
		||||
target_include_directories(LayerShellQtInterface PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>/LayerShellQt"
 | 
			
		||||
                                              INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/LayerShellQt>"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
generate_export_header(LayerShellQtInterface
 | 
			
		||||
    BASE_NAME LayerShellQtInterface
 | 
			
		||||
    EXPORT_MACRO_NAME LAYERSHELLQT_EXPORT
 | 
			
		||||
    EXPORT_FILE_NAME LayerShellQt/layershellqt_export.h
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
install(TARGETS layer-shell
 | 
			
		||||
        LIBRARY DESTINATION ${QT_PLUGIN_INSTALL_DIR}/wayland-shell-integration)
 | 
			
		||||
							
								
								
									
										16
									
								
								src/interfaces/shell.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/interfaces/shell.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "shell.h"
 | 
			
		||||
#include <qglobal.h>
 | 
			
		||||
#include <QByteArray>
 | 
			
		||||
 | 
			
		||||
using namespace LayerShellQt;
 | 
			
		||||
 | 
			
		||||
void Shell::useLayerShell()
 | 
			
		||||
{
 | 
			
		||||
    qputenv("QT_WAYLAND_SHELL_INTEGRATION", "layer-shell");
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								src/interfaces/shell.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/interfaces/shell.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef LAYERSHELLQTSHELL_H
 | 
			
		||||
#define LAYERSHELLQTSHELL_H
 | 
			
		||||
 | 
			
		||||
#include "layershellqt_export.h"
 | 
			
		||||
 | 
			
		||||
namespace LayerShellQt
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets the right environment so the shells created from now on use wlr-layer-shell.
 | 
			
		||||
 */
 | 
			
		||||
class LAYERSHELLQT_EXPORT Shell {
 | 
			
		||||
public:
 | 
			
		||||
    static void useLayerShell();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										66
									
								
								src/interfaces/window.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								src/interfaces/window.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,66 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "window.h"
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <private/qwaylandwindow_p.h>
 | 
			
		||||
#include <private/qwaylandshellsurface_p.h>
 | 
			
		||||
#include "../qwaylandlayersurface_p.h"
 | 
			
		||||
 | 
			
		||||
using namespace LayerShellQt;
 | 
			
		||||
 | 
			
		||||
class LayerShellQt::WindowPrivate
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    WindowPrivate(QWaylandLayerSurface *surface)
 | 
			
		||||
        : surface(surface)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QWaylandLayerSurface *const surface;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Window::~Window() = default;
 | 
			
		||||
 | 
			
		||||
void Window::setAnchor(Anchor anchor)
 | 
			
		||||
{
 | 
			
		||||
    d->surface->setAnchor(anchor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Window::setExclusiveZone(int32_t zone)
 | 
			
		||||
{
 | 
			
		||||
    d->surface->setExclusiveZone(zone);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Window::setMargins(const QMargins &margins)
 | 
			
		||||
{
 | 
			
		||||
    d->surface->setMargins(margins);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Window::setKeyboardInteractivity(bool enabled)
 | 
			
		||||
{
 | 
			
		||||
    d->surface->setKeyboardInteractivity(enabled);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Window::Window(WindowPrivate *d)
 | 
			
		||||
    : d(d)
 | 
			
		||||
{}
 | 
			
		||||
 | 
			
		||||
Window *Window::get(QWindow *window)
 | 
			
		||||
{
 | 
			
		||||
    auto ww = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window->handle());
 | 
			
		||||
    if (!ww) {
 | 
			
		||||
        qDebug() << "window not a wayland window" << window;
 | 
			
		||||
        return nullptr;
 | 
			
		||||
    }
 | 
			
		||||
    QWaylandLayerSurface* s = qobject_cast<QWaylandLayerSurface *>(ww->shellSurface());
 | 
			
		||||
    if (!s) {
 | 
			
		||||
        qDebug() << "window not using wlr-layer-shell" << window << ww->shellSurface();
 | 
			
		||||
        return nullptr;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return new Window(new WindowPrivate(s));
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										48
									
								
								src/interfaces/window.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/interfaces/window.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef LAYERSHELLQTWINDOW_H
 | 
			
		||||
#define LAYERSHELLQTWINDOW_H
 | 
			
		||||
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QWindow>
 | 
			
		||||
 | 
			
		||||
#include "layershellqt_export.h"
 | 
			
		||||
 | 
			
		||||
namespace LayerShellQt
 | 
			
		||||
{
 | 
			
		||||
class WindowPrivate;
 | 
			
		||||
 | 
			
		||||
class LAYERSHELLQT_EXPORT Window : public QObject
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    ~Window() override;
 | 
			
		||||
 | 
			
		||||
    enum Anchor {
 | 
			
		||||
        AnchorTop = 1, // the top edge of the anchor rectangle
 | 
			
		||||
        AnchorBottom = 2, // the bottom edge of the anchor rectangle
 | 
			
		||||
        AnchorLeft = 4, // the left edge of the anchor rectangle
 | 
			
		||||
        AnchorRight = 8, // the right edge of the anchor rectangle
 | 
			
		||||
    };
 | 
			
		||||
    Q_ENUM(Anchor);
 | 
			
		||||
 | 
			
		||||
    void setAnchor(Anchor anchor);
 | 
			
		||||
    void setExclusiveZone(int32_t zone);
 | 
			
		||||
    void setMargins(const QMargins &margins);
 | 
			
		||||
    void setKeyboardInteractivity(bool enabled);
 | 
			
		||||
 | 
			
		||||
    static Window *get(QWindow *window);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Window(WindowPrivate *d);
 | 
			
		||||
    QScopedPointer<WindowPrivate> d;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										3
									
								
								src/layer-shell.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/layer-shell.json
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
{
 | 
			
		||||
    "Keys": [ "layer-shell" ]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								src/qwaylandlayershell.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/qwaylandlayershell.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qwaylandlayershell_p.h"
 | 
			
		||||
#include "qwaylandlayersurface_p.h"
 | 
			
		||||
 | 
			
		||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
 | 
			
		||||
 | 
			
		||||
namespace LayerShellQt {
 | 
			
		||||
 | 
			
		||||
QWaylandLayerShell::QWaylandLayerShell(struct QtWayland::zwlr_layer_shell_v1 *shell)
 | 
			
		||||
    : QtWayland::zwlr_layer_shell_v1(shell->object())
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QWaylandLayerShell::~QWaylandLayerShell()
 | 
			
		||||
{
 | 
			
		||||
    zwlr_layer_shell_v1_destroy(object());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QWaylandLayerSurface *QWaylandLayerShell::createLayerSurface(
 | 
			
		||||
        QtWaylandClient::QWaylandWindow *window)
 | 
			
		||||
{
 | 
			
		||||
    return new QWaylandLayerSurface(this, window);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										33
									
								
								src/qwaylandlayershell_p.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/qwaylandlayershell_p.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _LAYERSHELL_H
 | 
			
		||||
#define _LAYERSHELL_H
 | 
			
		||||
 | 
			
		||||
#include <wayland-client.h>
 | 
			
		||||
 | 
			
		||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
 | 
			
		||||
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
 | 
			
		||||
 | 
			
		||||
#include "qwaylandlayersurface_p.h"
 | 
			
		||||
 | 
			
		||||
namespace LayerShellQt {
 | 
			
		||||
 | 
			
		||||
class QWaylandLayerShell : public QtWayland::zwlr_layer_shell_v1
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    QWaylandLayerShell(struct QtWayland::zwlr_layer_shell_v1 *shell);
 | 
			
		||||
    virtual ~QWaylandLayerShell();
 | 
			
		||||
 | 
			
		||||
    QWaylandLayerSurface *createLayerSurface(
 | 
			
		||||
            QtWaylandClient::QWaylandWindow *window);
 | 
			
		||||
    // TODO: Popups
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										53
									
								
								src/qwaylandlayershellintegration.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/qwaylandlayershellintegration.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qwaylandlayershellintegration_p.h"
 | 
			
		||||
#include "qwaylandlayershell_p.h"
 | 
			
		||||
 | 
			
		||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
 | 
			
		||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
 | 
			
		||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
 | 
			
		||||
 | 
			
		||||
QT_BEGIN_NAMESPACE
 | 
			
		||||
 | 
			
		||||
namespace LayerShellQt {
 | 
			
		||||
 | 
			
		||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration() :
 | 
			
		||||
    m_layerShell(Q_NULLPTR)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool QWaylandLayerShellIntegration::initialize(QtWaylandClient::QWaylandDisplay *display)
 | 
			
		||||
{
 | 
			
		||||
    QWaylandShellIntegration::initialize(display);
 | 
			
		||||
    display->addRegistryListener(registryLayer, this);
 | 
			
		||||
    return m_layerShell != nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::
 | 
			
		||||
    createShellSurface(QtWaylandClient::QWaylandWindow *window)
 | 
			
		||||
{
 | 
			
		||||
    return m_layerShell->createLayerSurface(window);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QWaylandLayerShellIntegration::registryLayer(void *data,
 | 
			
		||||
    struct wl_registry *registry, uint32_t id,
 | 
			
		||||
    const QString &interface, uint32_t version)
 | 
			
		||||
{
 | 
			
		||||
    QWaylandLayerShellIntegration *shell =
 | 
			
		||||
        static_cast<QWaylandLayerShellIntegration *>(data);
 | 
			
		||||
 | 
			
		||||
    if (interface == QStringLiteral("zwlr_layer_shell_v1"))
 | 
			
		||||
        shell->m_layerShell = new QWaylandLayerShell(
 | 
			
		||||
                new QtWayland::zwlr_layer_shell_v1(registry, id, version));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QT_END_NAMESPACE
 | 
			
		||||
 | 
			
		||||
//#include "qwaylandlayershellintegration.moc"
 | 
			
		||||
							
								
								
									
										37
									
								
								src/qwaylandlayershellintegration_p.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/qwaylandlayershellintegration_p.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _LAYERSHELLINTEGRATION_P_H
 | 
			
		||||
#define _LAYERSHELLINTEGRATION_P_H
 | 
			
		||||
 | 
			
		||||
#include <wayland-client.h>
 | 
			
		||||
 | 
			
		||||
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
 | 
			
		||||
 | 
			
		||||
namespace LayerShellQt {
 | 
			
		||||
 | 
			
		||||
class QWaylandLayerShell;
 | 
			
		||||
 | 
			
		||||
class QWaylandLayerShellIntegration : public QtWaylandClient::QWaylandShellIntegration
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    QWaylandLayerShellIntegration();
 | 
			
		||||
 | 
			
		||||
    bool initialize(QtWaylandClient::QWaylandDisplay *display) override;
 | 
			
		||||
    QtWaylandClient::QWaylandShellSurface *createShellSurface(
 | 
			
		||||
            QtWaylandClient::QWaylandWindow *window) override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    static void registryLayer(void *data, struct wl_registry *registry,
 | 
			
		||||
            uint32_t id, const QString &interface, uint32_t version);
 | 
			
		||||
 | 
			
		||||
    QWaylandLayerShell *m_layerShell;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										34
									
								
								src/qwaylandlayershellintegrationplugin.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/qwaylandlayershellintegrationplugin.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
 | 
			
		||||
#include "qwaylandlayershellintegration_p.h"
 | 
			
		||||
 | 
			
		||||
using namespace LayerShellQt;
 | 
			
		||||
 | 
			
		||||
class QWaylandLayerShellIntegrationPlugin :
 | 
			
		||||
        public QtWaylandClient::QWaylandShellIntegrationPlugin
 | 
			
		||||
{
 | 
			
		||||
        Q_OBJECT
 | 
			
		||||
        Q_PLUGIN_METADATA(
 | 
			
		||||
                        IID QWaylandShellIntegrationFactoryInterface_iid
 | 
			
		||||
                        FILE "layer-shell.json")
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    QWaylandLayerShellIntegrationPlugin() {}
 | 
			
		||||
 | 
			
		||||
    QtWaylandClient::QWaylandShellIntegration *create(
 | 
			
		||||
                    const QString &key, const QStringList ¶mList) override {
 | 
			
		||||
            Q_UNUSED(key);
 | 
			
		||||
            Q_UNUSED(paramList);
 | 
			
		||||
            return new QWaylandLayerShellIntegration();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Q_IMPORT_PLUGIN(QWaylandLayerShellIntegrationPlugin);
 | 
			
		||||
 | 
			
		||||
#include "qwaylandlayershellintegrationplugin.moc"
 | 
			
		||||
							
								
								
									
										82
									
								
								src/qwaylandlayersurface.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								src/qwaylandlayersurface.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,82 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "qwaylandlayershell_p.h"
 | 
			
		||||
#include "qwaylandlayersurface_p.h"
 | 
			
		||||
 | 
			
		||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
 | 
			
		||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
 | 
			
		||||
#include <QtWaylandClient/private/qwaylandsurface_p.h>
 | 
			
		||||
#include <QtWaylandClient/private/qwaylandscreen_p.h>
 | 
			
		||||
 | 
			
		||||
namespace LayerShellQt {
 | 
			
		||||
 | 
			
		||||
QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandClient::QWaylandWindow *window)
 | 
			
		||||
    : QtWaylandClient::QWaylandShellSurface(window)
 | 
			
		||||
    , QtWayland::zwlr_layer_surface_v1(
 | 
			
		||||
            // TODO: Specify namespace
 | 
			
		||||
            shell->get_layer_surface(window->waylandSurface()->object(),
 | 
			
		||||
                window->waylandScreen()->output(),
 | 
			
		||||
                QtWayland::zwlr_layer_shell_v1::layer_top,
 | 
			
		||||
                QStringLiteral("qt")))
 | 
			
		||||
{
 | 
			
		||||
    set_anchor(anchor_top | anchor_bottom | anchor_left | anchor_right);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QWaylandLayerSurface::~QWaylandLayerSurface()
 | 
			
		||||
{
 | 
			
		||||
    destroy();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
 | 
			
		||||
{
 | 
			
		||||
    window()->window()->close();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial,
 | 
			
		||||
            uint32_t width, uint32_t height)
 | 
			
		||||
{
 | 
			
		||||
    ack_configure(serial);
 | 
			
		||||
    m_pendingSize = QSize(width, height);
 | 
			
		||||
 | 
			
		||||
    if (!m_configured) {
 | 
			
		||||
        m_configured = true;
 | 
			
		||||
        window()->resizeFromApplyConfigure(m_pendingSize);
 | 
			
		||||
        window()->handleExpose(QRect(QPoint(), m_pendingSize));
 | 
			
		||||
    } else {
 | 
			
		||||
        // Later configures are resizes, so we have to queue them up for a time when we
 | 
			
		||||
        // are not painting to the window.
 | 
			
		||||
        window()->applyConfigureWhenPossible();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QWaylandLayerSurface::applyConfigure()
 | 
			
		||||
{
 | 
			
		||||
    window()->resizeFromApplyConfigure(m_pendingSize);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QWaylandLayerSurface::setAnchor(uint anchor)
 | 
			
		||||
{
 | 
			
		||||
    set_anchor(anchor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QWaylandLayerSurface::setExclusiveZone(int32_t zone)
 | 
			
		||||
{
 | 
			
		||||
    set_exclusive_zone(zone);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QWaylandLayerSurface::setMargins(const QMargins &margins)
 | 
			
		||||
{
 | 
			
		||||
    set_margin(margins.top(), margins.right(), margins.bottom(), margins.left());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void QWaylandLayerSurface::setKeyboardInteractivity(bool enabled)
 | 
			
		||||
{
 | 
			
		||||
    set_keyboard_interactivity(enabled);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										52
									
								
								src/qwaylandlayersurface_p.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/qwaylandlayersurface_p.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
/*
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 | 
			
		||||
 *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
 | 
			
		||||
 *
 | 
			
		||||
 *   SPDX-License-Identifier: LGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _LAYERSURFACE_H
 | 
			
		||||
#define _LAYERSURFACE_H
 | 
			
		||||
 | 
			
		||||
#include <wayland-client.h>
 | 
			
		||||
 | 
			
		||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
 | 
			
		||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
 | 
			
		||||
#include "layershellqt_export.h"
 | 
			
		||||
 | 
			
		||||
namespace LayerShellQt {
 | 
			
		||||
 | 
			
		||||
class QWaylandLayerShell;
 | 
			
		||||
 | 
			
		||||
class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylandShellSurface,
 | 
			
		||||
    public QtWayland::zwlr_layer_surface_v1
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    QWaylandLayerSurface(QWaylandLayerShell *shell,
 | 
			
		||||
            QtWaylandClient::QWaylandWindow *window);
 | 
			
		||||
    virtual ~QWaylandLayerSurface();
 | 
			
		||||
 | 
			
		||||
    bool isExposed() const override {
 | 
			
		||||
        return m_configured;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void setAnchor(uint32_t anchor);
 | 
			
		||||
    void setExclusiveZone(int32_t zone);
 | 
			
		||||
    void setMargins(const QMargins &margins);
 | 
			
		||||
    void setKeyboardInteractivity(bool enabled);
 | 
			
		||||
 | 
			
		||||
    void applyConfigure() override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void zwlr_layer_surface_v1_configure(uint32_t serial,
 | 
			
		||||
            uint32_t width, uint32_t height) override;
 | 
			
		||||
    void zwlr_layer_surface_v1_closed() override;
 | 
			
		||||
 | 
			
		||||
    QSize m_pendingSize;
 | 
			
		||||
    bool m_configured = false;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										286
									
								
								src/wlr-layer-shell-unstable-v1.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										286
									
								
								src/wlr-layer-shell-unstable-v1.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,286 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<protocol name="wlr_layer_shell_unstable_v1">
 | 
			
		||||
  <copyright>
 | 
			
		||||
    Copyright © 2017 Drew DeVault
 | 
			
		||||
 | 
			
		||||
    Permission to use, copy, modify, distribute, and sell this
 | 
			
		||||
    software and its documentation for any purpose is hereby granted
 | 
			
		||||
    without fee, provided that the above copyright notice appear in
 | 
			
		||||
    all copies and that both that copyright notice and this permission
 | 
			
		||||
    notice appear in supporting documentation, and that the name of
 | 
			
		||||
    the copyright holders not be used in advertising or publicity
 | 
			
		||||
    pertaining to distribution of the software without specific,
 | 
			
		||||
    written prior permission.  The copyright holders make no
 | 
			
		||||
    representations about the suitability of this software for any
 | 
			
		||||
    purpose.  It is provided "as is" without express or implied
 | 
			
		||||
    warranty.
 | 
			
		||||
 | 
			
		||||
    THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
 | 
			
		||||
    SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 | 
			
		||||
    FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
 | 
			
		||||
    SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
			
		||||
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
 | 
			
		||||
    AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 | 
			
		||||
    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
 | 
			
		||||
    THIS SOFTWARE.
 | 
			
		||||
  </copyright>
 | 
			
		||||
 | 
			
		||||
  <interface name="zwlr_layer_shell_v1" version="1">
 | 
			
		||||
    <description summary="create surfaces that are layers of the desktop">
 | 
			
		||||
      Clients can use this interface to assign the surface_layer role to
 | 
			
		||||
      wl_surfaces. Such surfaces are assigned to a "layer" of the output and
 | 
			
		||||
      rendered with a defined z-depth respective to each other. They may also be
 | 
			
		||||
      anchored to the edges and corners of a screen and specify input handling
 | 
			
		||||
      semantics. This interface should be suitable for the implementation of
 | 
			
		||||
      many desktop shell components, and a broad number of other applications
 | 
			
		||||
      that interact with the desktop.
 | 
			
		||||
    </description>
 | 
			
		||||
 | 
			
		||||
    <request name="get_layer_surface">
 | 
			
		||||
      <description summary="create a layer_surface from a surface">
 | 
			
		||||
        Create a layer surface for an existing surface. This assigns the role of
 | 
			
		||||
        layer_surface, or raises a protocol error if another role is already
 | 
			
		||||
        assigned.
 | 
			
		||||
 | 
			
		||||
        Creating a layer surface from a wl_surface which has a buffer attached
 | 
			
		||||
        or committed is a client error, and any attempts by a client to attach
 | 
			
		||||
        or manipulate a buffer prior to the first layer_surface.configure call
 | 
			
		||||
        must also be treated as errors.
 | 
			
		||||
 | 
			
		||||
        You may pass NULL for output to allow the compositor to decide which
 | 
			
		||||
        output to use. Generally this will be the one that the user most
 | 
			
		||||
        recently interacted with.
 | 
			
		||||
 | 
			
		||||
        Clients can specify a namespace that defines the purpose of the layer
 | 
			
		||||
        surface.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
 | 
			
		||||
      <arg name="surface" type="object" interface="wl_surface"/>
 | 
			
		||||
      <arg name="output" type="object" interface="wl_output" allow-null="true"/>
 | 
			
		||||
      <arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
 | 
			
		||||
      <!-- NOTE: Renamed from `namespace` upstream -->
 | 
			
		||||
      <arg name="layer_namespace" type="string" summary="namespace for the layer surface"/>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <enum name="error">
 | 
			
		||||
      <entry name="role" value="0" summary="wl_surface has another role"/>
 | 
			
		||||
      <entry name="invalid_layer" value="1" summary="layer value is invalid"/>
 | 
			
		||||
      <entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
 | 
			
		||||
    </enum>
 | 
			
		||||
 | 
			
		||||
    <enum name="layer">
 | 
			
		||||
      <description summary="available layers for surfaces">
 | 
			
		||||
        These values indicate which layers a surface can be rendered in. They
 | 
			
		||||
        are ordered by z depth, bottom-most first. Traditional shell surfaces
 | 
			
		||||
        will typically be rendered between the bottom and top layers.
 | 
			
		||||
        Fullscreen shell surfaces are typically rendered at the top layer.
 | 
			
		||||
        Multiple surfaces can share a single layer, and ordering within a
 | 
			
		||||
        single layer is undefined.
 | 
			
		||||
      </description>
 | 
			
		||||
 | 
			
		||||
      <entry name="background" value="0"/>
 | 
			
		||||
      <entry name="bottom" value="1"/>
 | 
			
		||||
      <entry name="top" value="2"/>
 | 
			
		||||
      <entry name="overlay" value="3"/>
 | 
			
		||||
    </enum>
 | 
			
		||||
  </interface>
 | 
			
		||||
 | 
			
		||||
  <interface name="zwlr_layer_surface_v1" version="1">
 | 
			
		||||
    <description summary="layer metadata interface">
 | 
			
		||||
      An interface that may be implemented by a wl_surface, for surfaces that
 | 
			
		||||
      are designed to be rendered as a layer of a stacked desktop-like
 | 
			
		||||
      environment.
 | 
			
		||||
 | 
			
		||||
      Layer surface state (size, anchor, exclusive zone, margin, interactivity)
 | 
			
		||||
      is double-buffered, and will be applied at the time wl_surface.commit of
 | 
			
		||||
      the corresponding wl_surface is called.
 | 
			
		||||
    </description>
 | 
			
		||||
 | 
			
		||||
    <request name="set_size">
 | 
			
		||||
      <description summary="sets the size of the surface">
 | 
			
		||||
        Sets the size of the surface in surface-local coordinates. The
 | 
			
		||||
        compositor will display the surface centered with respect to its
 | 
			
		||||
        anchors.
 | 
			
		||||
 | 
			
		||||
        If you pass 0 for either value, the compositor will assign it and
 | 
			
		||||
        inform you of the assignment in the configure event. You must set your
 | 
			
		||||
        anchor to opposite edges in the dimensions you omit; not doing so is a
 | 
			
		||||
        protocol error. Both values are 0 by default.
 | 
			
		||||
 | 
			
		||||
        Size is double-buffered, see wl_surface.commit.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="width" type="uint"/>
 | 
			
		||||
      <arg name="height" type="uint"/>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <request name="set_anchor">
 | 
			
		||||
      <description summary="configures the anchor point of the surface">
 | 
			
		||||
        Requests that the compositor anchor the surface to the specified edges
 | 
			
		||||
        and corners. If two orthoginal edges are specified (e.g. 'top' and
 | 
			
		||||
        'left'), then the anchor point will be the intersection of the edges
 | 
			
		||||
        (e.g. the top left corner of the output); otherwise the anchor point
 | 
			
		||||
        will be centered on that edge, or in the center if none is specified.
 | 
			
		||||
 | 
			
		||||
        Anchor is double-buffered, see wl_surface.commit.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="anchor" type="uint" enum="anchor"/>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <request name="set_exclusive_zone">
 | 
			
		||||
      <description summary="configures the exclusive geometry of this surface">
 | 
			
		||||
        Requests that the compositor avoids occluding an area of the surface
 | 
			
		||||
        with other surfaces. The compositor's use of this information is
 | 
			
		||||
        implementation-dependent - do not assume that this region will not
 | 
			
		||||
        actually be occluded.
 | 
			
		||||
 | 
			
		||||
        A positive value is only meaningful if the surface is anchored to an
 | 
			
		||||
        edge, rather than a corner. The zone is the number of surface-local
 | 
			
		||||
        coordinates from the edge that are considered exclusive.
 | 
			
		||||
 | 
			
		||||
        Surfaces that do not wish to have an exclusive zone may instead specify
 | 
			
		||||
        how they should interact with surfaces that do. If set to zero, the
 | 
			
		||||
        surface indicates that it would like to be moved to avoid occluding
 | 
			
		||||
        surfaces with a positive excluzive zone. If set to -1, the surface
 | 
			
		||||
        indicates that it would not like to be moved to accomodate for other
 | 
			
		||||
        surfaces, and the compositor should extend it all the way to the edges
 | 
			
		||||
        it is anchored to.
 | 
			
		||||
 | 
			
		||||
        For example, a panel might set its exclusive zone to 10, so that
 | 
			
		||||
        maximized shell surfaces are not shown on top of it. A notification
 | 
			
		||||
        might set its exclusive zone to 0, so that it is moved to avoid
 | 
			
		||||
        occluding the panel, but shell surfaces are shown underneath it. A
 | 
			
		||||
        wallpaper or lock screen might set their exclusive zone to -1, so that
 | 
			
		||||
        they stretch below or over the panel.
 | 
			
		||||
 | 
			
		||||
        The default value is 0.
 | 
			
		||||
 | 
			
		||||
        Exclusive zone is double-buffered, see wl_surface.commit.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="zone" type="int"/>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <request name="set_margin">
 | 
			
		||||
      <description summary="sets a margin from the anchor point">
 | 
			
		||||
        Requests that the surface be placed some distance away from the anchor
 | 
			
		||||
        point on the output, in surface-local coordinates. Setting this value
 | 
			
		||||
        for edges you are not anchored to has no effect.
 | 
			
		||||
 | 
			
		||||
        The exclusive zone includes the margin.
 | 
			
		||||
 | 
			
		||||
        Margin is double-buffered, see wl_surface.commit.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="top" type="int"/>
 | 
			
		||||
      <arg name="right" type="int"/>
 | 
			
		||||
      <arg name="bottom" type="int"/>
 | 
			
		||||
      <arg name="left" type="int"/>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <request name="set_keyboard_interactivity">
 | 
			
		||||
      <description summary="requests keyboard events">
 | 
			
		||||
        Set to 1 to request that the seat send keyboard events to this layer
 | 
			
		||||
        surface. For layers below the shell surface layer, the seat will use
 | 
			
		||||
        normal focus semantics. For layers above the shell surface layers, the
 | 
			
		||||
        seat will always give exclusive keyboard focus to the top-most layer
 | 
			
		||||
        which has keyboard interactivity set to true.
 | 
			
		||||
 | 
			
		||||
        Layer surfaces receive pointer, touch, and tablet events normally. If
 | 
			
		||||
        you do not want to receive them, set the input region on your surface
 | 
			
		||||
        to an empty region.
 | 
			
		||||
 | 
			
		||||
        Events is double-buffered, see wl_surface.commit.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="keyboard_interactivity" type="uint"/>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <request name="get_popup">
 | 
			
		||||
      <description summary="assign this layer_surface as an xdg_popup parent">
 | 
			
		||||
        This assigns an xdg_popup's parent to this layer_surface.  This popup
 | 
			
		||||
        should have been created via xdg_surface::get_popup with the parent set
 | 
			
		||||
        to NULL, and this request must be invoked before committing the popup's
 | 
			
		||||
        initial state.
 | 
			
		||||
 | 
			
		||||
        See the documentation of xdg_popup for more details about what an
 | 
			
		||||
        xdg_popup is and how it is used.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="popup" type="object" interface="xdg_popup"/>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <request name="ack_configure">
 | 
			
		||||
      <description summary="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 an ack_configure request sometime before the commit
 | 
			
		||||
        request, passing along the serial of the configure event.
 | 
			
		||||
 | 
			
		||||
        If the client receives multiple configure events before it
 | 
			
		||||
        can respond to one, it only has to ack the last configure event.
 | 
			
		||||
 | 
			
		||||
        A client is not required to commit immediately after sending
 | 
			
		||||
        an ack_configure request - it may even ack_configure several times
 | 
			
		||||
        before its next surface commit.
 | 
			
		||||
 | 
			
		||||
        A client may send multiple ack_configure requests before committing, but
 | 
			
		||||
        only the last request sent before a commit indicates which configure
 | 
			
		||||
        event the client really is responding to.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="serial" type="uint" summary="the serial from the configure event"/>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <request name="destroy" type="destructor">
 | 
			
		||||
      <description summary="destroy the layer_surface">
 | 
			
		||||
        This request destroys the layer surface.
 | 
			
		||||
      </description>
 | 
			
		||||
    </request>
 | 
			
		||||
 | 
			
		||||
    <event name="configure">
 | 
			
		||||
      <description summary="suggest a surface change">
 | 
			
		||||
        The configure event asks the client to resize its surface.
 | 
			
		||||
 | 
			
		||||
        Clients should arrange their surface for the new states, and then send
 | 
			
		||||
        an ack_configure request with the serial sent in this configure event at
 | 
			
		||||
        some point before committing the new surface.
 | 
			
		||||
 | 
			
		||||
        The client is free to dismiss all but the last configure event it
 | 
			
		||||
        received.
 | 
			
		||||
 | 
			
		||||
        The width and height arguments specify the size of the window in
 | 
			
		||||
        surface-local coordinates.
 | 
			
		||||
 | 
			
		||||
        The size is a hint, in the sense that the client is free to ignore it if
 | 
			
		||||
        it doesn't resize, pick a smaller size (to satisfy aspect ratio or
 | 
			
		||||
        resize in steps of NxM pixels). If the client picks a smaller size and
 | 
			
		||||
        is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
 | 
			
		||||
        surface will be centered on this axis.
 | 
			
		||||
 | 
			
		||||
        If the width or height arguments are zero, it means the client should
 | 
			
		||||
        decide its own window dimension.
 | 
			
		||||
      </description>
 | 
			
		||||
      <arg name="serial" type="uint"/>
 | 
			
		||||
      <arg name="width" type="uint"/>
 | 
			
		||||
      <arg name="height" type="uint"/>
 | 
			
		||||
    </event>
 | 
			
		||||
 | 
			
		||||
    <event name="closed">
 | 
			
		||||
      <description summary="surface should be closed">
 | 
			
		||||
        The closed event is sent by the compositor when the surface will no
 | 
			
		||||
        longer be shown. The output may have been destroyed or the user may
 | 
			
		||||
        have asked for it to be removed. Further changes to the surface will be
 | 
			
		||||
        ignored. The client should destroy the resource after receiving this
 | 
			
		||||
        event, and create a new surface if they so choose.
 | 
			
		||||
      </description>
 | 
			
		||||
    </event>
 | 
			
		||||
 | 
			
		||||
    <enum name="error">
 | 
			
		||||
      <entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
 | 
			
		||||
      <entry name="invalid_size" value="1" summary="size is invalid"/>
 | 
			
		||||
      <entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
 | 
			
		||||
    </enum>
 | 
			
		||||
 | 
			
		||||
    <enum name="anchor" bitfield="true">
 | 
			
		||||
      <entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
 | 
			
		||||
      <entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
 | 
			
		||||
      <entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
 | 
			
		||||
      <entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
 | 
			
		||||
    </enum>
 | 
			
		||||
  </interface>
 | 
			
		||||
</protocol>
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue